• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

XAMLで書けるインストーラを作るプロジェクト


Commit MetaInfo

Revision50f8ed7dd581d224c4b21e23eeca1856b76aa93e (tree)
Time2011-06-03 18:22:10
Authorazyobuzin <azyobuzin@user...>
Commiterazyobuzin

Log Message

MVVM的に分けた

Change Summary

Incremental Difference

--- a/XamlIn.Installer/App.xaml
+++ b/XamlIn.Installer/App.xaml
@@ -1,7 +1,7 @@
11 <Application x:Class="Azyobuzi.XamlIn.Installer.App"
22 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
33 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4- StartupUri="MainWindow.xaml">
4+ StartupUri="Views\MainWindow.xaml">
55 <Application.Resources>
66
77 </Application.Resources>
--- a/XamlIn.Installer/Installer.cs
+++ /dev/null
@@ -1,29 +0,0 @@
1-using System;
2-using System.Collections.Generic;
3-using System.Linq;
4-using System.Text;
5-using System.ComponentModel;
6-using System.Linq.Expressions;
7-
8-namespace Azyobuzi.XamlIn.Installer
9-{
10- /// <summary>
11- /// インストーラの状況など。ViewModel(&Model)的な役割。
12- /// </summary>
13- public class Installer : INotifyPropertyChanged
14- {
15- #region PropertyChanged
16- /// <summary>
17- /// プロパティ値が変更されたときに発生します。
18- /// </summary>
19- public event PropertyChangedEventHandler PropertyChanged;
20-
21- private void RaisePropertyChanged<T>(Expression<Func<T>> property)
22- {
23- if (this.PropertyChanged != null)
24- this.PropertyChanged(this, new PropertyChangedEventArgs(
25- ((MemberExpression)property.Body).Member.Name));
26- }
27- #endregion
28- }
29-}
--- a/XamlIn.Installer/File.cs
+++ b/XamlIn.Installer/Models/File.cs
@@ -1,7 +1,7 @@
11 using System.IO;
22 using System.Windows;
33
4-namespace Azyobuzi.XamlIn.Installer
4+namespace Azyobuzi.XamlIn.Installer.Models
55 {
66 /// <summary>
77 /// インストーラのリソースとして持つファイルソース
--- a/XamlIn.Installer/FileCollection.cs
+++ b/XamlIn.Installer/Models/FileCollection.cs
@@ -1,6 +1,6 @@
11 using System.Collections.ObjectModel;
22
3-namespace Azyobuzi.XamlIn.Installer
3+namespace Azyobuzi.XamlIn.Installer.Models
44 {
55 /// <summary>
66 /// <see cref="File"/>のコレクション
--- /dev/null
+++ b/XamlIn.Installer/Models/MainModel.cs
@@ -0,0 +1,17 @@
1+using System;
2+using System.Collections.Generic;
3+using System.Linq;
4+using System.Text;
5+using System.ComponentModel;
6+using System.Linq.Expressions;
7+
8+namespace Azyobuzi.XamlIn.Installer.Models
9+{
10+ /// <summary>
11+ /// インストーラの状況など
12+ /// </summary>
13+ public class MainModel : NotifyObject
14+ {
15+
16+ }
17+}
--- a/XamlIn.Installer/XamlIn.cs
+++ b/XamlIn.Installer/Models/XamlIn.cs
@@ -3,7 +3,7 @@ using System.Collections.Generic;
33 using System.Linq;
44 using System.Text;
55
6-namespace Azyobuzi.XamlIn.Installer
6+namespace Azyobuzi.XamlIn.Installer.Models
77 {
88 /// <summary>
99 /// インストーラの設定
--- /dev/null
+++ b/XamlIn.Installer/NotifyObject.cs
@@ -0,0 +1,37 @@
1+using System;
2+using System.Collections.Generic;
3+using System.Linq;
4+using System.Text;
5+using System.ComponentModel;
6+using System.Linq.Expressions;
7+
8+namespace Azyobuzi.XamlIn.Installer
9+{
10+ public abstract class NotifyObject : INotifyPropertyChanged
11+ {
12+ /// <summary>
13+ /// プロパティ値が変更されたときに発生します。
14+ /// </summary>
15+ public event PropertyChangedEventHandler PropertyChanged;
16+
17+ /// <summary>
18+ /// PropertyChangedを発生させます。
19+ /// </summary>
20+ /// <param name="propertyName">プロパティ名</param>
21+ protected virtual void RaisePropertyChanged(string propertyName)
22+ {
23+ if (this.PropertyChanged != null)
24+ this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
25+ }
26+
27+ /// <summary>
28+ /// PropertyChangedを発生させます。
29+ /// </summary>
30+ /// <typeparam name="T">プロパティの型</typeparam>
31+ /// <param name="property">通知するプロパティを<c>() => PropertyName</c>の様に指定します。</param>
32+ protected virtual void RaisePropertyChanged<T>(Expression<Func<T>> property)
33+ {
34+ this.RaisePropertyChanged(((MemberExpression)property.Body).Member.Name);
35+ }
36+ }
37+}
--- a/XamlIn.Installer/Properties/AssemblyInfo.cs
+++ b/XamlIn.Installer/Properties/AssemblyInfo.cs
@@ -53,4 +53,4 @@ using System.Windows.Markup;
5353 [assembly: AssemblyVersion("1.0.0.0")]
5454 [assembly: AssemblyFileVersion("1.0.0.0")]
5555
56-[assembly: XmlnsDefinition("http://azyobuzinet.ohitashi.com/schemas/xamlin.html", "Azyobuzi.XamlIn.Installer")]
\ No newline at end of file
56+[assembly: XmlnsDefinition("http://azyobuzinet.ohitashi.com/schemas/xamlin.html", "Azyobuzi.XamlIn.Installer.Models")]
\ No newline at end of file
--- /dev/null
+++ b/XamlIn.Installer/ViewModels/MainWindowViewModel.cs
@@ -0,0 +1,15 @@
1+using System;
2+using System.Collections.Generic;
3+using System.Linq;
4+using System.Text;
5+
6+namespace Azyobuzi.XamlIn.Installer.ViewModels
7+{
8+ /// <summary>
9+ /// <see cref="MainWindow"/>のViewModel。のはずなのにコントロールもってたりする。
10+ /// <see cref="Models.MainModel"/>をラップします。
11+ /// </summary>
12+ public class MainWindowViewModel : NotifyObject
13+ {
14+ }
15+}
--- a/XamlIn.Installer/MainWindow.xaml
+++ b/XamlIn.Installer/Views/MainWindow.xaml
@@ -1,4 +1,4 @@
1-<Window x:Class="Azyobuzi.XamlIn.Installer.MainWindow"
1+<Window x:Class="Azyobuzi.XamlIn.Installer.Views.MainWindow"
22 Name="mainWindow"
33 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
44 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
--- a/XamlIn.Installer/MainWindow.xaml.cs
+++ b/XamlIn.Installer/Views/MainWindow.xaml.cs
@@ -12,7 +12,7 @@ using System.Windows.Media.Imaging;
1212 using System.Windows.Navigation;
1313 using System.Windows.Shapes;
1414
15-namespace Azyobuzi.XamlIn.Installer
15+namespace Azyobuzi.XamlIn.Installer.Views
1616 {
1717 /// <summary>
1818 /// インストーラウィザードを表示するウィンドウ
--- a/XamlIn.Installer/XamlIn.Installer.csproj
+++ b/XamlIn.Installer/XamlIn.Installer.csproj
@@ -63,10 +63,10 @@
6363 <Generator>MSBuild:Compile</Generator>
6464 <SubType>Designer</SubType>
6565 </ApplicationDefinition>
66- <Compile Include="File.cs" />
67- <Compile Include="FileCollection.cs" />
68- <Compile Include="XamlIn.cs" />
69- <Page Include="MainWindow.xaml">
66+ <Compile Include="Models\File.cs" />
67+ <Compile Include="Models\FileCollection.cs" />
68+ <Compile Include="Models\XamlIn.cs" />
69+ <Page Include="Views\MainWindow.xaml">
7070 <Generator>MSBuild:Compile</Generator>
7171 <SubType>Designer</SubType>
7272 </Page>
@@ -74,8 +74,10 @@
7474 <DependentUpon>App.xaml</DependentUpon>
7575 <SubType>Code</SubType>
7676 </Compile>
77- <Compile Include="Installer.cs" />
78- <Compile Include="MainWindow.xaml.cs">
77+ <Compile Include="Models\MainModel.cs" />
78+ <Compile Include="NotifyObject.cs" />
79+ <Compile Include="ViewModels\MainWindowViewModel.cs" />
80+ <Compile Include="Views\MainWindow.xaml.cs">
7981 <DependentUpon>MainWindow.xaml</DependentUpon>
8082 <SubType>Code</SubType>
8183 </Compile>