ファイル整理用ツールのPrism+WPFサンプル実装
Revisão | 1bed29561da2c12fe6e5c172c82d2d7dbe3c4c6c (tree) |
---|---|
Hora | 2023-09-30 22:39:49 |
Autor | yoshy <yoshy.org.bitbucket@gz.j...> |
Commiter | yoshy |
[MOD] Appプロジェクトの接尾辞 .00App を削除
[MOD] OuterEdge 配下の Behavior を Infra に移動
[MOD] アセンブリ名・ルート名前空間をプロジェクト名を置換して生成するように修正
@@ -2,8 +2,9 @@ | ||
2 | 2 | <PropertyGroup> |
3 | 3 | <TargetFramework>net6.0-windows10.0.19041.0</TargetFramework> |
4 | 4 | <UseWPF>true</UseWPF> |
5 | - <AssemblyName>FolderCategorizer2.Domain</AssemblyName> | |
6 | - <RootNamespace>FolderCategorizer2.Domain</RootNamespace> | |
5 | + <NameRegex><![CDATA[\.[0-9]+]]></NameRegex> | |
6 | + <AssemblyName>$([System.Text.RegularExpressions.Regex]::Replace($(MSBuildProjectName),$(NameRegex),"."))</AssemblyName> | |
7 | + <RootNamespace>$(AssemblyName)</RootNamespace> | |
7 | 8 | </PropertyGroup> |
8 | 9 | <ItemGroup> |
9 | 10 | <ProjectReference Include="..\FolderCategorizer2.05Infra\FolderCategorizer2.05Infra.csproj" /> |
@@ -4,9 +4,9 @@ | ||
4 | 4 | <TargetFramework>net6.0-windows10.0.19041.0</TargetFramework> |
5 | 5 | <Nullable>enable</Nullable> |
6 | 6 | <UseWPF>true</UseWPF> |
7 | - <SupportedOSPlatformVersion>10.0.19041.0</SupportedOSPlatformVersion> | |
8 | - <RootNamespace>FolderCategorizer2.UseCase</RootNamespace> | |
9 | - <AssemblyName>FolderCategorizer2.UseCase</AssemblyName> | |
7 | + <NameRegex><![CDATA[\.[0-9]+]]></NameRegex> | |
8 | + <AssemblyName>$([System.Text.RegularExpressions.Regex]::Replace($(MSBuildProjectName),$(NameRegex),"."))</AssemblyName> | |
9 | + <RootNamespace>$(AssemblyName)</RootNamespace> | |
10 | 10 | </PropertyGroup> |
11 | 11 | |
12 | 12 | <ItemGroup> |
@@ -2,8 +2,9 @@ | ||
2 | 2 | <PropertyGroup> |
3 | 3 | <TargetFramework>net6.0-windows10.0.19041.0</TargetFramework> |
4 | 4 | <UseWPF>true</UseWPF> |
5 | - <AssemblyName>FolderCategorizer2.Adaptor</AssemblyName> | |
6 | - <RootNamespace>FolderCategorizer2.Adaptor</RootNamespace> | |
5 | + <NameRegex><![CDATA[\.[0-9]+]]></NameRegex> | |
6 | + <AssemblyName>$([System.Text.RegularExpressions.Regex]::Replace($(MSBuildProjectName),$(NameRegex),"."))</AssemblyName> | |
7 | + <RootNamespace>$(AssemblyName)</RootNamespace> | |
7 | 8 | </PropertyGroup> |
8 | 9 | <ItemGroup> |
9 | 10 | <ProjectReference Include="..\FolderCategorizer2.02UseCase\FolderCategorizer2.02UseCase.csproj" /> |
@@ -2,8 +2,9 @@ | ||
2 | 2 | <PropertyGroup> |
3 | 3 | <TargetFramework>net6.0-windows10.0.19041.0</TargetFramework> |
4 | 4 | <UseWPF>true</UseWPF> |
5 | - <AssemblyName>FolderCategorizer2.OuterEdge</AssemblyName> | |
6 | - <RootNamespace>FolderCategorizer2.OuterEdge</RootNamespace> | |
5 | + <NameRegex><![CDATA[\.[0-9]+]]></NameRegex> | |
6 | + <AssemblyName>$([System.Text.RegularExpressions.Regex]::Replace($(MSBuildProjectName),$(NameRegex),"."))</AssemblyName> | |
7 | + <RootNamespace>$(AssemblyName)</RootNamespace> | |
7 | 8 | </PropertyGroup> |
8 | 9 | <ItemGroup> |
9 | 10 | <ProjectReference Include="..\FolderCategorizer2.03Adaptor\FolderCategorizer2.03Adaptor.csproj" /> |
@@ -5,7 +5,7 @@ | ||
5 | 5 | xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
6 | 6 | xmlns:prism="http://prismlibrary.com/" |
7 | 7 | xmlns:i="http://schemas.microsoft.com/xaml/behaviors" |
8 | - xmlns:bh="clr-namespace:FolderCategorizer2.OuterEdge.UI.Behavior" | |
8 | + xmlns:bh="http://schemas.drillion.net/folderCategorizer2/behavior" | |
9 | 9 | xmlns:vm="http://schemas.drillion.net/folderCategorizer2/viewmodel" |
10 | 10 | mc:Ignorable="d" |
11 | 11 | d:DataContext="{d:DesignInstance Type=vm:ICategorizePromptViewModel}" |
@@ -5,7 +5,7 @@ | ||
5 | 5 | xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
6 | 6 | xmlns:prism="http://prismlibrary.com/" |
7 | 7 | xmlns:i="http://schemas.microsoft.com/xaml/behaviors" |
8 | - xmlns:bh="clr-namespace:FolderCategorizer2.OuterEdge.UI.Behavior" | |
8 | + xmlns:bh="http://schemas.drillion.net/folderCategorizer2/behavior" | |
9 | 9 | xmlns:vm="http://schemas.drillion.net/folderCategorizer2/viewmodel" |
10 | 10 | mc:Ignorable="d" |
11 | 11 | d:DataContext="{d:DesignInstance Type=vm:IUserPromptViewModel}" |
@@ -14,4 +14,5 @@ using System.Windows.Markup; | ||
14 | 14 | |
15 | 15 | [assembly: Guid("f63f7e9f-b879-470f-a987-91f744f74de7")] |
16 | 16 | |
17 | +[assembly: XmlnsDefinition("http://schemas.drillion.net/folderCategorizer2/behavior", "FolderCategorizer2.Infra.Xaml.Behavior")] | |
17 | 18 | [assembly: XmlnsDefinition("http://schemas.drillion.net/folderCategorizer2/xaml/markup", "FolderCategorizer2.Infra.Xaml.Markup")] |
@@ -2,8 +2,9 @@ | ||
2 | 2 | <PropertyGroup> |
3 | 3 | <TargetFramework>net6.0-windows10.0.19041.0</TargetFramework> |
4 | 4 | <UseWPF>true</UseWPF> |
5 | - <AssemblyName>FolderCategorizer2.Infra</AssemblyName> | |
6 | - <RootNamespace>FolderCategorizer2.Infra</RootNamespace> | |
5 | + <NameRegex><![CDATA[\.[0-9]+]]></NameRegex> | |
6 | + <AssemblyName>$([System.Text.RegularExpressions.Regex]::Replace($(MSBuildProjectName),$(NameRegex),"."))</AssemblyName> | |
7 | + <RootNamespace>$(AssemblyName)</RootNamespace> | |
7 | 8 | </PropertyGroup> |
8 | 9 | <ItemGroup> |
9 | 10 | <None Remove="Resources\Image\FolderError_256x.png" /> |
@@ -3,9 +3,9 @@ using NLog; | ||
3 | 3 | using System.Windows; |
4 | 4 | using System.Windows.Controls; |
5 | 5 | |
6 | -namespace FolderCategorizer2.OuterEdge.UI.Behavior | |
6 | +namespace FolderCategorizer2.Infra.Xaml.Behavior | |
7 | 7 | { |
8 | - internal class GotFocusSelectAllBehavior : Behavior<TextBox> | |
8 | + public class GotFocusSelectAllBehavior : Behavior<TextBox> | |
9 | 9 | { |
10 | 10 | private static readonly ILogger logger = LogManager.GetCurrentClassLogger(); |
11 | 11 |
@@ -3,9 +3,9 @@ using NLog; | ||
3 | 3 | using System.Windows; |
4 | 4 | using System.Windows.Controls; |
5 | 5 | |
6 | -namespace FolderCategorizer2.OuterEdge.UI.Behavior | |
6 | +namespace FolderCategorizer2.Infra.Xaml.Behavior | |
7 | 7 | { |
8 | - internal class OnLoadedSelectAllBehavior : Behavior<TextBox> | |
8 | + public class OnLoadedSelectAllBehavior : Behavior<TextBox> | |
9 | 9 | { |
10 | 10 | private static readonly ILogger logger = LogManager.GetCurrentClassLogger(); |
11 | 11 |
@@ -3,9 +3,9 @@ using NLog; | ||
3 | 3 | using System.Windows; |
4 | 4 | using System.Windows.Controls; |
5 | 5 | |
6 | -namespace FolderCategorizer2.OuterEdge.UI.Behavior | |
6 | +namespace FolderCategorizer2.Infra.Xaml.Behavior | |
7 | 7 | { |
8 | - internal class OnLoadedSetFocusBehavior : Behavior<TextBox> | |
8 | + public class OnLoadedSetFocusBehavior : Behavior<TextBox> | |
9 | 9 | { |
10 | 10 | private static readonly ILogger logger = LogManager.GetCurrentClassLogger(); |
11 | 11 |
@@ -3,8 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00 | ||
3 | 3 | # Visual Studio Version 17 |
4 | 4 | VisualStudioVersion = 17.0.32112.339 |
5 | 5 | MinimumVisualStudioVersion = 10.0.40219.1 |
6 | -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FolderCategorizer2.00App", "FolderCategorizer2.00App\FolderCategorizer2.00App.csproj", "{F4F34524-B841-4393-83DE-7516B58AD2B2}" | |
7 | -EndProject | |
8 | 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FolderCategorizer2.01Domain", "FolderCategorizer2.01Domain\FolderCategorizer2.01Domain.csproj", "{94876FAE-BA0C-4961-8C98-5C6D40795526}" |
9 | 7 | EndProject |
10 | 8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FolderCategorizer2.02UseCase", "FolderCategorizer2.02UseCase\FolderCategorizer2.02UseCase.csproj", "{EDC87115-3518-49D5-9F3D-193A031CE5AE}" |
@@ -29,16 +27,14 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CleanAuLait.ObservableColle | ||
29 | 27 | EndProject |
30 | 28 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CleanAuLait.Prism.WPF", "..\CleanAuLait.Prism.WPF\CleanAuLait.Prism.WPF.csproj", "{9F83D4FE-6925-44C3-A0C4-715A7A87F13B}" |
31 | 29 | EndProject |
30 | +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FolderCategorizer2", "FolderCategorizer2\FolderCategorizer2.csproj", "{06ED7A57-E285-4E59-B4EB-3354300A9DE5}" | |
31 | +EndProject | |
32 | 32 | Global |
33 | 33 | GlobalSection(SolutionConfigurationPlatforms) = preSolution |
34 | 34 | Debug|Any CPU = Debug|Any CPU |
35 | 35 | Release|Any CPU = Release|Any CPU |
36 | 36 | EndGlobalSection |
37 | 37 | GlobalSection(ProjectConfigurationPlatforms) = postSolution |
38 | - {F4F34524-B841-4393-83DE-7516B58AD2B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |
39 | - {F4F34524-B841-4393-83DE-7516B58AD2B2}.Debug|Any CPU.Build.0 = Debug|Any CPU | |
40 | - {F4F34524-B841-4393-83DE-7516B58AD2B2}.Release|Any CPU.ActiveCfg = Release|Any CPU | |
41 | - {F4F34524-B841-4393-83DE-7516B58AD2B2}.Release|Any CPU.Build.0 = Release|Any CPU | |
42 | 38 | {94876FAE-BA0C-4961-8C98-5C6D40795526}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
43 | 39 | {94876FAE-BA0C-4961-8C98-5C6D40795526}.Debug|Any CPU.Build.0 = Debug|Any CPU |
44 | 40 | {94876FAE-BA0C-4961-8C98-5C6D40795526}.Release|Any CPU.ActiveCfg = Release|Any CPU |
@@ -75,6 +71,10 @@ Global | ||
75 | 71 | {9F83D4FE-6925-44C3-A0C4-715A7A87F13B}.Debug|Any CPU.Build.0 = Debug|Any CPU |
76 | 72 | {9F83D4FE-6925-44C3-A0C4-715A7A87F13B}.Release|Any CPU.ActiveCfg = Release|Any CPU |
77 | 73 | {9F83D4FE-6925-44C3-A0C4-715A7A87F13B}.Release|Any CPU.Build.0 = Release|Any CPU |
74 | + {06ED7A57-E285-4E59-B4EB-3354300A9DE5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |
75 | + {06ED7A57-E285-4E59-B4EB-3354300A9DE5}.Debug|Any CPU.Build.0 = Debug|Any CPU | |
76 | + {06ED7A57-E285-4E59-B4EB-3354300A9DE5}.Release|Any CPU.ActiveCfg = Release|Any CPU | |
77 | + {06ED7A57-E285-4E59-B4EB-3354300A9DE5}.Release|Any CPU.Build.0 = Release|Any CPU | |
78 | 78 | EndGlobalSection |
79 | 79 | GlobalSection(SolutionProperties) = preSolution |
80 | 80 | HideSolutionNode = FALSE |
@@ -208,11 +208,17 @@ namespace FolderCategorizer2 | ||
208 | 208 | |
209 | 209 | // Show Application Version |
210 | 210 | |
211 | - AssemblyName asm = Assembly.GetExecutingAssembly().GetName(); | |
212 | - Version ver = asm.Version; | |
211 | + Assembly asm = Assembly.GetExecutingAssembly(); | |
212 | + AssemblyName asmInfo = asm.GetName(); | |
213 | 213 | |
214 | - logger.Info("{0} v{1}.{2}.{3}.{4} initialized.", | |
215 | - asm.Name, ver.Major, ver.Minor, ver.Build, ver.Revision); | |
214 | + Version ver = asmInfo.Version; | |
215 | + string asmVer = $"{ver.Major}.{ver.Minor}.{ver.Build}.{ver.Revision}"; | |
216 | + string infoVer = asm.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion; | |
217 | + infoVer = asmVer.StartsWith(infoVer) ? infoVer + "-release" : infoVer; | |
218 | + | |
219 | + string appVersion = $"{asmInfo.Name} v{infoVer} ({asmVer})"; | |
220 | + | |
221 | + logger.Info("{0} initialized.", appVersion); | |
216 | 222 | |
217 | 223 | logger.Trace("OnStartup end"); |
218 | 224 | } |
@@ -2,11 +2,15 @@ | ||
2 | 2 | <PropertyGroup> |
3 | 3 | <OutputType>WinExe</OutputType> |
4 | 4 | <TargetFramework>net6.0-windows10.0.19041.0</TargetFramework> |
5 | - <UseWPF>true</UseWPF> | |
5 | + <VersionPrefix>1.0.0</VersionPrefix> | |
6 | + <UseWPF>true</UseWPF> | |
6 | 7 | <AssemblyName>FolderCategorizer2</AssemblyName> |
7 | 8 | <RootNamespace>FolderCategorizer2</RootNamespace> |
8 | 9 | <ApplicationManifest>app.manifest</ApplicationManifest> |
9 | 10 | </PropertyGroup> |
11 | + <PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> | |
12 | + <VersionSuffix>pre$([System.DateTime]::Now.ToString(yyyyMMdd-HHmm))</VersionSuffix> | |
13 | + </PropertyGroup> | |
10 | 14 | <ItemGroup> |
11 | 15 | <None Remove="C:\Users\yoshy\.nuget\packages\nlog.config\4.7.13\contentFiles\any\any\NLog.config" /> |
12 | 16 | </ItemGroup> |