added LoggingModule
This commit is contained in:
parent
a17ea99642
commit
ad1e92362d
1200
PhotoRenamer.Base/Annotations.cs
Normal file
1200
PhotoRenamer.Base/Annotations.cs
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,13 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using ExifLibrary;
|
||||
using JetBrains.Annotations;
|
||||
using PhotoRenamer.Base.Types;
|
||||
|
||||
namespace PhotoRenamer.Base
|
||||
{
|
||||
|
||||
public static class FilesHelper
|
||||
{
|
||||
private static readonly string[] SupportedFileExtensions = {".jpg", ".cr2", ".mp4"};
|
||||
@ -26,7 +25,7 @@ namespace PhotoRenamer.Base
|
||||
}
|
||||
}
|
||||
|
||||
public static IEnumerable<MediaFile> GetMediaFiles([NotNull] IEnumerable<string> files)
|
||||
public static IEnumerable<MediaFile> GetMediaFiles(IEnumerable<string> files)
|
||||
{
|
||||
if (files == null) throw new ArgumentNullException(nameof(files));
|
||||
|
||||
@ -39,17 +38,4 @@ namespace PhotoRenamer.Base
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class MediaFile
|
||||
{
|
||||
public string Path { get; }
|
||||
public DateTime CreationDate { get; }
|
||||
|
||||
public MediaFile(string path, DateTime creationDate)
|
||||
{
|
||||
Path = path;
|
||||
CreationDate = creationDate;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,11 +2,12 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ExifLibNet" Version="2.1.1" />
|
||||
<PackageReference Include="JetBrains.Annotations" Version="2019.1.3" />
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.8">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
|
8
PhotoRenamer.Base/RegionNames.cs
Normal file
8
PhotoRenamer.Base/RegionNames.cs
Normal file
@ -0,0 +1,8 @@
|
||||
namespace PhotoRenamer.Base
|
||||
{
|
||||
public static class RegionNames
|
||||
{
|
||||
public static string ContentRegion { get; } = "ContentRegion";
|
||||
public static string LoggingRegion { get; } = "LoggingRegion";
|
||||
}
|
||||
}
|
17
PhotoRenamer.Base/Types/MediaFile.cs
Normal file
17
PhotoRenamer.Base/Types/MediaFile.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using System;
|
||||
|
||||
namespace PhotoRenamer.Base.Types
|
||||
{
|
||||
public class MediaFile
|
||||
{
|
||||
public MediaFile(string path, DateTime creationDate)
|
||||
{
|
||||
Path = path;
|
||||
CreationDate = creationDate;
|
||||
}
|
||||
|
||||
public string Path { get; }
|
||||
public DateTime CreationDate { get; }
|
||||
|
||||
}
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using PhotoRenamer.Base;
|
||||
using PhotoRenamer.File.Views;
|
||||
using Prism.Ioc;
|
||||
using Prism.Modularity;
|
||||
@ -23,7 +24,7 @@ namespace PhotoRenamer.File
|
||||
public void RegisterTypes(IContainerRegistry containerRegistry)
|
||||
{
|
||||
containerRegistry.RegisterForNavigation<ViewA>();
|
||||
_regionManager.RequestNavigate("ContentRegion", new Uri(nameof(ViewA), UriKind.Relative));
|
||||
_regionManager.RequestNavigate(RegionNames.ContentRegion, new Uri(nameof(ViewA), UriKind.Relative));
|
||||
}
|
||||
}
|
||||
}
|
@ -1,15 +1,19 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<UseWPF>true</UseWPF>
|
||||
<AssemblyName>PhotoRenamer.File</AssemblyName>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="JetBrains.Annotations" Version="2019.1.3" />
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.8">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Prism.Wpf" Version="7.2.0.1422" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\PhotoRenamer.Base\PhotoRenamer.Base.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
30
PhotoRenamer.Logging/LoggingModule.cs
Normal file
30
PhotoRenamer.Logging/LoggingModule.cs
Normal file
@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using PhotoRenamer.Base;
|
||||
using PhotoRenamer.Logging.Views;
|
||||
using Prism.Ioc;
|
||||
using Prism.Modularity;
|
||||
using Prism.Regions;
|
||||
|
||||
namespace PhotoRenamer.Logging
|
||||
{
|
||||
public class LoggingModule : IModule
|
||||
{
|
||||
private readonly IRegionManager _regionManager;
|
||||
|
||||
public LoggingModule(IRegionManager regionManager)
|
||||
{
|
||||
_regionManager = regionManager;
|
||||
}
|
||||
|
||||
public void OnInitialized(IContainerProvider containerProvider)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void RegisterTypes(IContainerRegistry containerRegistry)
|
||||
{
|
||||
containerRegistry.RegisterForNavigation<ViewA>();
|
||||
_regionManager.RequestNavigate(RegionNames.LoggingRegion, new Uri(nameof(ViewA), UriKind.Relative));
|
||||
}
|
||||
}
|
||||
}
|
19
PhotoRenamer.Logging/PhotoRenamer.Logging.csproj
Normal file
19
PhotoRenamer.Logging/PhotoRenamer.Logging.csproj
Normal file
@ -0,0 +1,19 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<UseWPF>true</UseWPF>
|
||||
<AssemblyName>PhotoRenamer.Logging</AssemblyName>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.8">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Prism.Wpf" Version="7.2.0.1422" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\PhotoRenamer.Base\PhotoRenamer.Base.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
14
PhotoRenamer.Logging/ViewModels/ViewAViewModel.cs
Normal file
14
PhotoRenamer.Logging/ViewModels/ViewAViewModel.cs
Normal file
@ -0,0 +1,14 @@
|
||||
using System.Windows.Input;
|
||||
using JetBrains.Annotations;
|
||||
using Prism.Mvvm;
|
||||
|
||||
namespace PhotoRenamer.Logging.ViewModels
|
||||
{
|
||||
[UsedImplicitly]
|
||||
public class ViewAViewModel : BindableBase
|
||||
{
|
||||
public ICommand SelectFilesCommand { get; }
|
||||
|
||||
public ICommand ClearCommand { get; }
|
||||
}
|
||||
}
|
17
PhotoRenamer.Logging/Views/ViewA.xaml
Normal file
17
PhotoRenamer.Logging/Views/ViewA.xaml
Normal file
@ -0,0 +1,17 @@
|
||||
<UserControl
|
||||
x:Class="PhotoRenamer.Logging.Views.ViewA"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:prism="http://prismlibrary.com/"
|
||||
xmlns:viewModels="clr-namespace:PhotoRenamer.Logging.ViewModels"
|
||||
d:DataContext="{d:DesignInstance viewModels:ViewAViewModel}"
|
||||
d:DesignHeight="300"
|
||||
d:DesignWidth="300"
|
||||
prism:ViewModelLocator.AutoWireViewModel="True"
|
||||
mc:Ignorable="d">
|
||||
<GroupBox Margin="5" Header="Log">
|
||||
<ListView />
|
||||
</GroupBox>
|
||||
</UserControl>
|
13
PhotoRenamer.Logging/Views/ViewA.xaml.cs
Normal file
13
PhotoRenamer.Logging/Views/ViewA.xaml.cs
Normal file
@ -0,0 +1,13 @@
|
||||
namespace PhotoRenamer.Logging.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for ViewA.xaml
|
||||
/// </summary>
|
||||
public partial class ViewA
|
||||
{
|
||||
public ViewA()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -3,6 +3,7 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using PhotoRenamer.Base;
|
||||
using PhotoRenamer.Base.Types;
|
||||
|
||||
namespace PhotoRenamer.Test
|
||||
{
|
||||
|
@ -7,7 +7,6 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="JetBrains.Annotations" Version="2019.1.3" />
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.8">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
@ -15,7 +14,7 @@
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />
|
||||
<PackageReference Include="MSTest.TestAdapter" Version="2.0.0" />
|
||||
<PackageReference Include="MSTest.TestFramework" Version="2.0.0" />
|
||||
<PackageReference Include="coverlet.collector" Version="1.1.0">
|
||||
<PackageReference Include="coverlet.collector" Version="1.2.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
|
@ -11,6 +11,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PhotoRenamer.Test", "PhotoR
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PhotoRenamer.Base", "PhotoRenamer.Base\PhotoRenamer.Base.csproj", "{DE85C395-3D50-4C12-9B7A-021180E26CE1}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PhotoRenamer.Logging", "PhotoRenamer.Logging\PhotoRenamer.Logging.csproj", "{1AB0E84A-BEEA-4AAA-96BC-D0D66AC63E11}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@ -33,6 +35,10 @@ Global
|
||||
{DE85C395-3D50-4C12-9B7A-021180E26CE1}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{DE85C395-3D50-4C12-9B7A-021180E26CE1}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{DE85C395-3D50-4C12-9B7A-021180E26CE1}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{1AB0E84A-BEEA-4AAA-96BC-D0D66AC63E11}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1AB0E84A-BEEA-4AAA-96BC-D0D66AC63E11}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1AB0E84A-BEEA-4AAA-96BC-D0D66AC63E11}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1AB0E84A-BEEA-4AAA-96BC-D0D66AC63E11}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -2,6 +2,7 @@
|
||||
using PhotoRenamer.Views;
|
||||
using System.Windows;
|
||||
using PhotoRenamer.File;
|
||||
using PhotoRenamer.Logging;
|
||||
using Prism.Modularity;
|
||||
|
||||
namespace PhotoRenamer
|
||||
@ -18,12 +19,13 @@ namespace PhotoRenamer
|
||||
|
||||
protected override void RegisterTypes(IContainerRegistry containerRegistry)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected override void ConfigureModuleCatalog(IModuleCatalog moduleCatalog)
|
||||
{
|
||||
moduleCatalog.AddModule<FileModule>();
|
||||
moduleCatalog.AddModule<LoggingModule>();
|
||||
base.ConfigureModuleCatalog(moduleCatalog);
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<UseWPF>true</UseWPF>
|
||||
<AssemblyName>PhotoRenamer</AssemblyName>
|
||||
<StartupObject>PhotoRenamer.App</StartupObject>
|
||||
@ -10,9 +11,9 @@
|
||||
<PublishSingleFile>false</PublishSingleFile>
|
||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||
<RunAnalyzersDuringBuild>true</RunAnalyzersDuringBuild>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="JetBrains.Annotations" Version="2019.1.3" />
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.8">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
@ -20,6 +21,8 @@
|
||||
<PackageReference Include="Prism.DryIoc" Version="7.2.0.1422" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\PhotoRenamer.Base\PhotoRenamer.Base.csproj" />
|
||||
<ProjectReference Include="..\PhotoRenamer.File\PhotoRenamer.File.csproj" />
|
||||
<ProjectReference Include="..\PhotoRenamer.Logging\PhotoRenamer.Logging.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -2,17 +2,23 @@
|
||||
x:Class="PhotoRenamer.Views.MainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:base="clr-namespace:PhotoRenamer.Base;assembly=PhotoRenamer.Base"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:prism="http://prismlibrary.com/"
|
||||
xmlns:viewModels="clr-namespace:PhotoRenamer.ViewModels"
|
||||
Title="{Binding Title}"
|
||||
Width="525"
|
||||
Height="350"
|
||||
Width="1000"
|
||||
Height="800"
|
||||
d:DataContext="{d:DesignInstance viewModels:MainWindowViewModel}"
|
||||
prism:ViewModelLocator.AutoWireViewModel="True"
|
||||
mc:Ignorable="d">
|
||||
<Grid>
|
||||
<ContentControl prism:RegionManager.RegionName="ContentRegion" />
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ContentControl prism:RegionManager.RegionName="{x:Static base:RegionNames.ContentRegion}" />
|
||||
<ContentControl Grid.Column="1" prism:RegionManager.RegionName="{x:Static base:RegionNames.LoggingRegion}" />
|
||||
</Grid>
|
||||
</Window>
|
||||
|
Loading…
x
Reference in New Issue
Block a user