XAMLで書けるインストーラを作るプロジェクト
| Revision | 50f8ed7dd581d224c4b21e23eeca1856b76aa93e (tree) |
|---|---|
| Time | 2011-06-03 18:22:10 |
| Author | azyobuzin <azyobuzin@user...> |
| Commiter | azyobuzin |
MVVM的に分けた
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | <Application x:Class="Azyobuzi.XamlIn.Installer.App" |
| 2 | 2 | xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
| 3 | 3 | xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
| 4 | - StartupUri="MainWindow.xaml"> | |
| 4 | + StartupUri="Views\MainWindow.xaml"> | |
| 5 | 5 | <Application.Resources> |
| 6 | 6 | |
| 7 | 7 | </Application.Resources> |
| @@ -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 | -} |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | using System.IO; |
| 2 | 2 | using System.Windows; |
| 3 | 3 | |
| 4 | -namespace Azyobuzi.XamlIn.Installer | |
| 4 | +namespace Azyobuzi.XamlIn.Installer.Models | |
| 5 | 5 | { |
| 6 | 6 | /// <summary> |
| 7 | 7 | /// インストーラのリソースとして持つファイルソース |
| @@ -1,6 +1,6 @@ | ||
| 1 | 1 | using System.Collections.ObjectModel; |
| 2 | 2 | |
| 3 | -namespace Azyobuzi.XamlIn.Installer | |
| 3 | +namespace Azyobuzi.XamlIn.Installer.Models | |
| 4 | 4 | { |
| 5 | 5 | /// <summary> |
| 6 | 6 | /// <see cref="File"/>のコレクション |
| @@ -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 | +} |
| @@ -3,7 +3,7 @@ using System.Collections.Generic; | ||
| 3 | 3 | using System.Linq; |
| 4 | 4 | using System.Text; |
| 5 | 5 | |
| 6 | -namespace Azyobuzi.XamlIn.Installer | |
| 6 | +namespace Azyobuzi.XamlIn.Installer.Models | |
| 7 | 7 | { |
| 8 | 8 | /// <summary> |
| 9 | 9 | /// インストーラの設定 |
| @@ -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 | +} |
| @@ -53,4 +53,4 @@ using System.Windows.Markup; | ||
| 53 | 53 | [assembly: AssemblyVersion("1.0.0.0")] |
| 54 | 54 | [assembly: AssemblyFileVersion("1.0.0.0")] |
| 55 | 55 | |
| 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 |
| @@ -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 | +} |
| @@ -1,4 +1,4 @@ | ||
| 1 | -<Window x:Class="Azyobuzi.XamlIn.Installer.MainWindow" | |
| 1 | +<Window x:Class="Azyobuzi.XamlIn.Installer.Views.MainWindow" | |
| 2 | 2 | Name="mainWindow" |
| 3 | 3 | xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
| 4 | 4 | xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
| @@ -12,7 +12,7 @@ using System.Windows.Media.Imaging; | ||
| 12 | 12 | using System.Windows.Navigation; |
| 13 | 13 | using System.Windows.Shapes; |
| 14 | 14 | |
| 15 | -namespace Azyobuzi.XamlIn.Installer | |
| 15 | +namespace Azyobuzi.XamlIn.Installer.Views | |
| 16 | 16 | { |
| 17 | 17 | /// <summary> |
| 18 | 18 | /// インストーラウィザードを表示するウィンドウ |
| @@ -63,10 +63,10 @@ | ||
| 63 | 63 | <Generator>MSBuild:Compile</Generator> |
| 64 | 64 | <SubType>Designer</SubType> |
| 65 | 65 | </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"> | |
| 70 | 70 | <Generator>MSBuild:Compile</Generator> |
| 71 | 71 | <SubType>Designer</SubType> |
| 72 | 72 | </Page> |
| @@ -74,8 +74,10 @@ | ||
| 74 | 74 | <DependentUpon>App.xaml</DependentUpon> |
| 75 | 75 | <SubType>Code</SubType> |
| 76 | 76 | </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"> | |
| 79 | 81 | <DependentUpon>MainWindow.xaml</DependentUpon> |
| 80 | 82 | <SubType>Code</SubType> |
| 81 | 83 | </Compile> |