From aba97a033f1062774a038914e27241ed88a81cbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=AD=B1=E5=82=91?= <840465812@qq.com> Date: Mon, 31 May 2021 22:29:05 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E7=A7=BB=E9=99=A4=20ChineseChess.GUI=20?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=20=E6=8A=B1=E6=AD=89=EF=BC=8C=E8=BF=99?= =?UTF-8?q?=E6=A1=86=E6=9E=B6=E7=94=A8=E5=9C=A8=E8=BF=99=E4=B8=8A=E9=9D=A2?= =?UTF-8?q?=EF=BC=8C=E7=9C=9F=E6=98=AF=E7=94=A8=E9=95=AD=E5=B0=84=E7=82=AE?= =?UTF-8?q?=E6=89=93=E8=8B=8D=E8=9D=87=EF=BC=8C=E5=8F=88=E5=95=B0=E5=97=A6?= =?UTF-8?q?=E5=8F=88=E9=9A=BE=E7=94=A8=E3=80=82=20=E6=88=91=E8=A7=89?= =?UTF-8?q?=E5=BE=97WinForm=E6=AF=94=E8=BE=83=E9=80=82=E5=90=88=E8=BF=99?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=EF=BC=8C=E5=B0=B1=E8=BF=99=E6=A0=B7=E4=BA=86?= =?UTF-8?q?=E3=80=82=202.=20=E6=96=B0=E5=A2=9E=20ChineseChess=20=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=EF=BC=8C=E9=80=89=E6=8B=A9WinForm=E6=A1=86=E6=9E=B6?= =?UTF-8?q?=EF=BC=8C=E4=BD=BF=E7=94=A8.NET=205.0=EF=BC=88=E6=80=BB?= =?UTF-8?q?=E8=A6=81=E8=AF=95=E8=AF=95=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ChineseChess.GUI.Core.csproj | 15 -- .../Contracts/Services/IFileService.cs | 11 - ChineseChess.GUI.Core/Services/FileService.cs | 43 ---- ChineseChess.GUI.Core/readme.txt | 2 - .../ChineseChess.GUI.Tests.xUnit.csproj | 35 ---- ChineseChess.GUI.Tests.xUnit/PagesTests.cs | 98 --------- .../SettingsViewModelTests.cs | 66 ------ ChineseChess.GUI.Tests.xUnit/Tests.cs | 13 -- ChineseChess.GUI/App.xaml | 28 --- ChineseChess.GUI/App.xaml.cs | 96 --------- ChineseChess.GUI/ChineseChess.GUI.csproj | 38 ---- .../Activation/IActivationHandler.cs | 11 - .../Services/IApplicationInfoService.cs | 9 - .../Contracts/Services/INavigationService.cs | 22 -- .../Contracts/Services/IPageService.cs | 12 -- .../Services/IPersistAndRestoreService.cs | 9 - .../Contracts/Services/ISystemService.cs | 7 - .../Services/IThemeSelectorService.cs | 15 -- .../Contracts/ViewModels/INavigationAware.cs | 9 - .../Contracts/Views/IShellWindow.cs | 13 -- .../Converters/EnumToBooleanConverter.cs | 36 ---- ChineseChess.GUI/Helpers/FrameExtensions.cs | 23 -- ChineseChess.GUI/Models/AppConfig.cs | 11 - ChineseChess.GUI/Models/AppTheme.cs | 9 - .../Properties/Resources.Designer.cs | 197 ------------------ ChineseChess.GUI/Properties/Resources.resx | 147 ------------- .../Services/ApplicationHostService.cs | 93 --------- .../Services/ApplicationInfoService.cs | 23 -- .../Services/NavigationService.cs | 101 --------- ChineseChess.GUI/Services/PageService.cs | 68 ------ .../Services/PersistAndRestoreService.cs | 49 ----- ChineseChess.GUI/Services/SystemService.cs | 24 --- .../Services/ThemeSelectorService.cs | 63 ------ ChineseChess.GUI/Styles/MetroWindow.xaml | 14 -- ChineseChess.GUI/Styles/TextBlock.xaml | 54 ----- .../Styles/Themes/HC.Dark.Blue.xaml | 40 ---- .../Styles/Themes/HC.Light.Blue.xaml | 40 ---- ChineseChess.GUI/Styles/_FontSizes.xaml | 14 -- ChineseChess.GUI/Styles/_Thickness.xaml | 30 --- .../MenuItemTemplateSelector.cs | 29 --- ChineseChess.GUI/ViewModels/MainViewModel.cs | 14 -- .../ViewModels/SettingsViewModel.cs | 69 ------ ChineseChess.GUI/ViewModels/ShellViewModel.cs | 114 ---------- ChineseChess.GUI/Views/MainPage.xaml | 30 --- ChineseChess.GUI/Views/MainPage.xaml.cs | 15 -- ChineseChess.GUI/Views/SettingsPage.xaml | 106 ---------- ChineseChess.GUI/Views/SettingsPage.xaml.cs | 15 -- ChineseChess.GUI/Views/ShellWindow.xaml | 116 ----------- ChineseChess.GUI/Views/ShellWindow.xaml.cs | 27 --- ChineseChess.GUI/WTS.ProjectConfig.xml | 11 - ChineseChess.GUI/app.manifest | 11 - ChineseChess.GUI/appsettings.json | 7 - ChineseChess.sln | 54 ++--- ChineseChess/ChineseChess.csproj | 9 + ChineseChess/MainForm.Designer.cs | 50 +++++ ChineseChess/MainForm.cs | 25 +++ ChineseChess/MainForm.resx | 60 ++++++ ChineseChess/Program.cs | 23 ++ 58 files changed, 180 insertions(+), 2193 deletions(-) delete mode 100644 ChineseChess.GUI.Core/ChineseChess.GUI.Core.csproj delete mode 100644 ChineseChess.GUI.Core/Contracts/Services/IFileService.cs delete mode 100644 ChineseChess.GUI.Core/Services/FileService.cs delete mode 100644 ChineseChess.GUI.Core/readme.txt delete mode 100644 ChineseChess.GUI.Tests.xUnit/ChineseChess.GUI.Tests.xUnit.csproj delete mode 100644 ChineseChess.GUI.Tests.xUnit/PagesTests.cs delete mode 100644 ChineseChess.GUI.Tests.xUnit/SettingsViewModelTests.cs delete mode 100644 ChineseChess.GUI.Tests.xUnit/Tests.cs delete mode 100644 ChineseChess.GUI/App.xaml delete mode 100644 ChineseChess.GUI/App.xaml.cs delete mode 100644 ChineseChess.GUI/ChineseChess.GUI.csproj delete mode 100644 ChineseChess.GUI/Contracts/Activation/IActivationHandler.cs delete mode 100644 ChineseChess.GUI/Contracts/Services/IApplicationInfoService.cs delete mode 100644 ChineseChess.GUI/Contracts/Services/INavigationService.cs delete mode 100644 ChineseChess.GUI/Contracts/Services/IPageService.cs delete mode 100644 ChineseChess.GUI/Contracts/Services/IPersistAndRestoreService.cs delete mode 100644 ChineseChess.GUI/Contracts/Services/ISystemService.cs delete mode 100644 ChineseChess.GUI/Contracts/Services/IThemeSelectorService.cs delete mode 100644 ChineseChess.GUI/Contracts/ViewModels/INavigationAware.cs delete mode 100644 ChineseChess.GUI/Contracts/Views/IShellWindow.cs delete mode 100644 ChineseChess.GUI/Converters/EnumToBooleanConverter.cs delete mode 100644 ChineseChess.GUI/Helpers/FrameExtensions.cs delete mode 100644 ChineseChess.GUI/Models/AppConfig.cs delete mode 100644 ChineseChess.GUI/Models/AppTheme.cs delete mode 100644 ChineseChess.GUI/Properties/Resources.Designer.cs delete mode 100644 ChineseChess.GUI/Properties/Resources.resx delete mode 100644 ChineseChess.GUI/Services/ApplicationHostService.cs delete mode 100644 ChineseChess.GUI/Services/ApplicationInfoService.cs delete mode 100644 ChineseChess.GUI/Services/NavigationService.cs delete mode 100644 ChineseChess.GUI/Services/PageService.cs delete mode 100644 ChineseChess.GUI/Services/PersistAndRestoreService.cs delete mode 100644 ChineseChess.GUI/Services/SystemService.cs delete mode 100644 ChineseChess.GUI/Services/ThemeSelectorService.cs delete mode 100644 ChineseChess.GUI/Styles/MetroWindow.xaml delete mode 100644 ChineseChess.GUI/Styles/TextBlock.xaml delete mode 100644 ChineseChess.GUI/Styles/Themes/HC.Dark.Blue.xaml delete mode 100644 ChineseChess.GUI/Styles/Themes/HC.Light.Blue.xaml delete mode 100644 ChineseChess.GUI/Styles/_FontSizes.xaml delete mode 100644 ChineseChess.GUI/Styles/_Thickness.xaml delete mode 100644 ChineseChess.GUI/TemplateSelectors/MenuItemTemplateSelector.cs delete mode 100644 ChineseChess.GUI/ViewModels/MainViewModel.cs delete mode 100644 ChineseChess.GUI/ViewModels/SettingsViewModel.cs delete mode 100644 ChineseChess.GUI/ViewModels/ShellViewModel.cs delete mode 100644 ChineseChess.GUI/Views/MainPage.xaml delete mode 100644 ChineseChess.GUI/Views/MainPage.xaml.cs delete mode 100644 ChineseChess.GUI/Views/SettingsPage.xaml delete mode 100644 ChineseChess.GUI/Views/SettingsPage.xaml.cs delete mode 100644 ChineseChess.GUI/Views/ShellWindow.xaml delete mode 100644 ChineseChess.GUI/Views/ShellWindow.xaml.cs delete mode 100644 ChineseChess.GUI/WTS.ProjectConfig.xml delete mode 100644 ChineseChess.GUI/app.manifest delete mode 100644 ChineseChess.GUI/appsettings.json create mode 100644 ChineseChess/ChineseChess.csproj create mode 100644 ChineseChess/MainForm.Designer.cs create mode 100644 ChineseChess/MainForm.cs create mode 100644 ChineseChess/MainForm.resx create mode 100644 ChineseChess/Program.cs diff --git a/ChineseChess.GUI.Core/ChineseChess.GUI.Core.csproj b/ChineseChess.GUI.Core/ChineseChess.GUI.Core.csproj deleted file mode 100644 index 8c0ef43..0000000 --- a/ChineseChess.GUI.Core/ChineseChess.GUI.Core.csproj +++ /dev/null @@ -1,15 +0,0 @@ - - - - netstandard2.0 - ChineseChess.GUI.Core - - - - - - - - - - diff --git a/ChineseChess.GUI.Core/Contracts/Services/IFileService.cs b/ChineseChess.GUI.Core/Contracts/Services/IFileService.cs deleted file mode 100644 index 806ad86..0000000 --- a/ChineseChess.GUI.Core/Contracts/Services/IFileService.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace ChineseChess.GUI.Core.Contracts.Services -{ - public interface IFileService - { - T Read(string folderPath, string fileName); - - void Save(string folderPath, string fileName, T content); - - void Delete(string folderPath, string fileName); - } -} diff --git a/ChineseChess.GUI.Core/Services/FileService.cs b/ChineseChess.GUI.Core/Services/FileService.cs deleted file mode 100644 index ae23112..0000000 --- a/ChineseChess.GUI.Core/Services/FileService.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System.IO; -using System.Text; - -using ChineseChess.GUI.Core.Contracts.Services; - -using Newtonsoft.Json; - -namespace ChineseChess.GUI.Core.Services -{ - public class FileService : IFileService - { - public T Read(string folderPath, string fileName) - { - var path = Path.Combine(folderPath, fileName); - if (File.Exists(path)) - { - var json = File.ReadAllText(path); - return JsonConvert.DeserializeObject(json); - } - - return default; - } - - public void Save(string folderPath, string fileName, T content) - { - if (!Directory.Exists(folderPath)) - { - Directory.CreateDirectory(folderPath); - } - - var fileContent = JsonConvert.SerializeObject(content); - File.WriteAllText(Path.Combine(folderPath, fileName), fileContent, Encoding.UTF8); - } - - public void Delete(string folderPath, string fileName) - { - if (fileName != null && File.Exists(Path.Combine(folderPath, fileName))) - { - File.Delete(Path.Combine(folderPath, fileName)); - } - } - } -} diff --git a/ChineseChess.GUI.Core/readme.txt b/ChineseChess.GUI.Core/readme.txt deleted file mode 100644 index dd20676..0000000 --- a/ChineseChess.GUI.Core/readme.txt +++ /dev/null @@ -1,2 +0,0 @@ -This core project is a .net standard project. -It's a great place to put all your logic that is not platform dependent (e.g. model/helper classes) so they can be reused. \ No newline at end of file diff --git a/ChineseChess.GUI.Tests.xUnit/ChineseChess.GUI.Tests.xUnit.csproj b/ChineseChess.GUI.Tests.xUnit/ChineseChess.GUI.Tests.xUnit.csproj deleted file mode 100644 index 46d3728..0000000 --- a/ChineseChess.GUI.Tests.xUnit/ChineseChess.GUI.Tests.xUnit.csproj +++ /dev/null @@ -1,35 +0,0 @@ - - - - netcoreapp3.1 - false - uap10.0.18362 - x64;x86;AnyCPU - ChineseChess.GUI.Tests.xUnit - - - - x86 - - - - x64 - - - - AnyCPU - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/ChineseChess.GUI.Tests.xUnit/PagesTests.cs b/ChineseChess.GUI.Tests.xUnit/PagesTests.cs deleted file mode 100644 index f7d6507..0000000 --- a/ChineseChess.GUI.Tests.xUnit/PagesTests.cs +++ /dev/null @@ -1,98 +0,0 @@ -using System.IO; -using System.Reflection; - -using ChineseChess.GUI.Contracts.Services; -using ChineseChess.GUI.Core.Contracts.Services; -using ChineseChess.GUI.Core.Services; -using ChineseChess.GUI.Models; -using ChineseChess.GUI.Services; -using ChineseChess.GUI.ViewModels; -using ChineseChess.GUI.Views; - -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; - -using Xunit; - -namespace ChineseChess.GUI.Tests.XUnit -{ - public class PagesTests - { - private readonly IHost _host; - - public PagesTests() - { - var appLocation = Path.GetDirectoryName(Assembly.GetEntryAssembly()?.Location); - _host = Host.CreateDefaultBuilder() - .ConfigureAppConfiguration(c => c.SetBasePath(appLocation)) - .ConfigureServices(ConfigureServices) - .Build(); - } - - private void ConfigureServices(HostBuilderContext context, IServiceCollection services) - { - // Core Services - services.AddSingleton(); - - // Services - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); - - // ViewModels - services.AddTransient(); - services.AddTransient(); - - // Configuration - services.Configure(context.Configuration.GetSection(nameof(AppConfig))); - } - - // TODO WTS: Add tests for functionality you add to SettingsViewModel. - [Fact] - public void TestSettingsViewModelCreation() - { - var vm = _host.Services.GetService(typeof(SettingsViewModel)); - Assert.NotNull(vm); - } - - [Fact] - public void TestGetSettingsPageType() - { - if (_host.Services.GetService(typeof(IPageService)) is IPageService pageService) - { - var pageType = pageService.GetPageType(typeof(SettingsViewModel).FullName); - Assert.Equal(typeof(SettingsPage), pageType); - } - else - { - Assert.True(false, $"Can't resolve {nameof(IPageService)}"); - } - } - - // TODO WTS: Add tests for functionality you add to MainViewModel. - [Fact] - public void TestMainViewModelCreation() - { - var vm = _host.Services.GetService(typeof(MainViewModel)); - Assert.NotNull(vm); - } - - [Fact] - public void TestGetMainPageType() - { - if (_host.Services.GetService(typeof(IPageService)) is IPageService pageService) - { - var pageType = pageService.GetPageType(typeof(MainViewModel).FullName); - Assert.Equal(typeof(MainPage), pageType); - } - else - { - Assert.True(false, $"Can't resolve {nameof(IPageService)}"); - } - } - } -} diff --git a/ChineseChess.GUI.Tests.xUnit/SettingsViewModelTests.cs b/ChineseChess.GUI.Tests.xUnit/SettingsViewModelTests.cs deleted file mode 100644 index bcc903f..0000000 --- a/ChineseChess.GUI.Tests.xUnit/SettingsViewModelTests.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System; - -using ChineseChess.GUI.Contracts.Services; -using ChineseChess.GUI.Models; -using ChineseChess.GUI.ViewModels; - -using Microsoft.Extensions.Options; - -using Moq; - -using Xunit; - -namespace ChineseChess.GUI.Tests.XUnit -{ - public class SettingsViewModelTests - { - public SettingsViewModelTests() - { - } - - [Fact] - public void TestSettingsViewModel_SetCurrentTheme() - { - var mockThemeSelectorService = new Mock(); - mockThemeSelectorService.Setup(mock => mock.GetCurrentTheme()).Returns(AppTheme.Light); - var mockAppConfig = new Mock>(); - var mockSystemService = new Mock(); - var mockApplicationInfoService = new Mock(); - - var settingsVm = new SettingsViewModel(mockAppConfig.Object, mockThemeSelectorService.Object, mockSystemService.Object, mockApplicationInfoService.Object); - settingsVm.OnNavigatedTo(null); - - Assert.Equal(AppTheme.Light, settingsVm.Theme); - } - - [Fact] - public void TestSettingsViewModel_SetCurrentVersion() - { - var mockThemeSelectorService = new Mock(); - var mockAppConfig = new Mock>(); - var mockSystemService = new Mock(); - var mockApplicationInfoService = new Mock(); - var testVersion = new Version(1, 2, 3, 4); - mockApplicationInfoService.Setup(mock => mock.GetVersion()).Returns(testVersion); - - var settingsVm = new SettingsViewModel(mockAppConfig.Object, mockThemeSelectorService.Object, mockSystemService.Object, mockApplicationInfoService.Object); - settingsVm.OnNavigatedTo(null); - - Assert.Equal($"ChineseChess.GUI - {testVersion}", settingsVm.VersionDescription); - } - - [Fact] - public void TestSettingsViewModel_SetThemeCommand() - { - var mockThemeSelectorService = new Mock(); - var mockAppConfig = new Mock>(); - var mockSystemService = new Mock(); - var mockApplicationInfoService = new Mock(); - - var settingsVm = new SettingsViewModel(mockAppConfig.Object, mockThemeSelectorService.Object, mockSystemService.Object, mockApplicationInfoService.Object); - settingsVm.SetThemeCommand.Execute(AppTheme.Light.ToString()); - - mockThemeSelectorService.Verify(mock => mock.SetTheme(AppTheme.Light)); - } - } -} diff --git a/ChineseChess.GUI.Tests.xUnit/Tests.cs b/ChineseChess.GUI.Tests.xUnit/Tests.cs deleted file mode 100644 index 9493604..0000000 --- a/ChineseChess.GUI.Tests.xUnit/Tests.cs +++ /dev/null @@ -1,13 +0,0 @@ -using Xunit; - -namespace ChineseChess.GUI.Tests.XUnit -{ - // TODO WTS: Add appropriate unit tests. - public class Tests - { - [Fact] - public void TestMethod1() - { - } - } -} diff --git a/ChineseChess.GUI/App.xaml b/ChineseChess.GUI/App.xaml deleted file mode 100644 index bc8f9f7..0000000 --- a/ChineseChess.GUI/App.xaml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/ChineseChess.GUI/App.xaml.cs b/ChineseChess.GUI/App.xaml.cs deleted file mode 100644 index 8032844..0000000 --- a/ChineseChess.GUI/App.xaml.cs +++ /dev/null @@ -1,96 +0,0 @@ -using System.IO; -using System.Reflection; -using System.Windows; -using System.Windows.Threading; - -using ChineseChess.GUI.Contracts.Services; -using ChineseChess.GUI.Contracts.Views; -using ChineseChess.GUI.Core.Contracts.Services; -using ChineseChess.GUI.Core.Services; -using ChineseChess.GUI.Models; -using ChineseChess.GUI.Services; -using ChineseChess.GUI.ViewModels; -using ChineseChess.GUI.Views; - -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; - -namespace ChineseChess.GUI -{ - public partial class App : Application - { - private IHost _host; - - public T GetService() - where T : class - => _host.Services.GetService(typeof(T)) as T; - - public App() - { - } - - private async void OnStartup(object sender, StartupEventArgs e) - { - var appLocation = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location); - - // For more information about .NET generic host see https://docs.microsoft.com/aspnet/core/fundamentals/host/generic-host?view=aspnetcore-3.0 - _host = Host.CreateDefaultBuilder(e.Args) - .ConfigureAppConfiguration(c => - { - c.SetBasePath(appLocation); - }) - .ConfigureServices(ConfigureServices) - .Build(); - - await _host.StartAsync(); - } - - private void ConfigureServices(HostBuilderContext context, IServiceCollection services) - { - // TODO WTS: Register your services, viewmodels and pages here - - // App Host - services.AddHostedService(); - - // Activation Handlers - - // Core Services - services.AddSingleton(); - - // Services - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); - - // Views and ViewModels - services.AddTransient(); - services.AddTransient(); - - services.AddTransient(); - services.AddTransient(); - - services.AddTransient(); - services.AddTransient(); - - // Configuration - services.Configure(context.Configuration.GetSection(nameof(AppConfig))); - } - - private async void OnExit(object sender, ExitEventArgs e) - { - await _host.StopAsync(); - _host.Dispose(); - _host = null; - } - - private void OnDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e) - { - // TODO WTS: Please log and handle the exception as appropriate to your scenario - // For more info see https://docs.microsoft.com/dotnet/api/system.windows.application.dispatcherunhandledexception?view=netcore-3.0 - } - } -} diff --git a/ChineseChess.GUI/ChineseChess.GUI.csproj b/ChineseChess.GUI/ChineseChess.GUI.csproj deleted file mode 100644 index 339e969..0000000 --- a/ChineseChess.GUI/ChineseChess.GUI.csproj +++ /dev/null @@ -1,38 +0,0 @@ - - - WinExe - netcoreapp3.1 - ChineseChess.GUI - true - app.manifest - - - - - - - - - - - - - True - True - Resources.resx - - - - - - PublicResXFileCodeGenerator - Resources.Designer.cs - - - - - - Always - - - diff --git a/ChineseChess.GUI/Contracts/Activation/IActivationHandler.cs b/ChineseChess.GUI/Contracts/Activation/IActivationHandler.cs deleted file mode 100644 index afc6890..0000000 --- a/ChineseChess.GUI/Contracts/Activation/IActivationHandler.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System.Threading.Tasks; - -namespace ChineseChess.GUI.Contracts.Activation -{ - public interface IActivationHandler - { - bool CanHandle(); - - Task HandleAsync(); - } -} diff --git a/ChineseChess.GUI/Contracts/Services/IApplicationInfoService.cs b/ChineseChess.GUI/Contracts/Services/IApplicationInfoService.cs deleted file mode 100644 index fa3c5c0..0000000 --- a/ChineseChess.GUI/Contracts/Services/IApplicationInfoService.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System; - -namespace ChineseChess.GUI.Contracts.Services -{ - public interface IApplicationInfoService - { - Version GetVersion(); - } -} diff --git a/ChineseChess.GUI/Contracts/Services/INavigationService.cs b/ChineseChess.GUI/Contracts/Services/INavigationService.cs deleted file mode 100644 index e61ef3e..0000000 --- a/ChineseChess.GUI/Contracts/Services/INavigationService.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.Windows.Controls; - -namespace ChineseChess.GUI.Contracts.Services -{ - public interface INavigationService - { - event EventHandler Navigated; - - bool CanGoBack { get; } - - void Initialize(Frame shellFrame); - - bool NavigateTo(string pageKey, object parameter = null, bool clearNavigation = false); - - void GoBack(); - - void UnsubscribeNavigation(); - - void CleanNavigation(); - } -} diff --git a/ChineseChess.GUI/Contracts/Services/IPageService.cs b/ChineseChess.GUI/Contracts/Services/IPageService.cs deleted file mode 100644 index 678a6d2..0000000 --- a/ChineseChess.GUI/Contracts/Services/IPageService.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Windows.Controls; - -namespace ChineseChess.GUI.Contracts.Services -{ - public interface IPageService - { - Type GetPageType(string key); - - Page GetPage(string key); - } -} diff --git a/ChineseChess.GUI/Contracts/Services/IPersistAndRestoreService.cs b/ChineseChess.GUI/Contracts/Services/IPersistAndRestoreService.cs deleted file mode 100644 index c9b9cb3..0000000 --- a/ChineseChess.GUI/Contracts/Services/IPersistAndRestoreService.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace ChineseChess.GUI.Contracts.Services -{ - public interface IPersistAndRestoreService - { - void RestoreData(); - - void PersistData(); - } -} diff --git a/ChineseChess.GUI/Contracts/Services/ISystemService.cs b/ChineseChess.GUI/Contracts/Services/ISystemService.cs deleted file mode 100644 index 22658d1..0000000 --- a/ChineseChess.GUI/Contracts/Services/ISystemService.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace ChineseChess.GUI.Contracts.Services -{ - public interface ISystemService - { - void OpenInWebBrowser(string url); - } -} diff --git a/ChineseChess.GUI/Contracts/Services/IThemeSelectorService.cs b/ChineseChess.GUI/Contracts/Services/IThemeSelectorService.cs deleted file mode 100644 index aed1073..0000000 --- a/ChineseChess.GUI/Contracts/Services/IThemeSelectorService.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; - -using ChineseChess.GUI.Models; - -namespace ChineseChess.GUI.Contracts.Services -{ - public interface IThemeSelectorService - { - void InitializeTheme(); - - void SetTheme(AppTheme theme); - - AppTheme GetCurrentTheme(); - } -} diff --git a/ChineseChess.GUI/Contracts/ViewModels/INavigationAware.cs b/ChineseChess.GUI/Contracts/ViewModels/INavigationAware.cs deleted file mode 100644 index 7f449c9..0000000 --- a/ChineseChess.GUI/Contracts/ViewModels/INavigationAware.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace ChineseChess.GUI.Contracts.ViewModels -{ - public interface INavigationAware - { - void OnNavigatedTo(object parameter); - - void OnNavigatedFrom(); - } -} diff --git a/ChineseChess.GUI/Contracts/Views/IShellWindow.cs b/ChineseChess.GUI/Contracts/Views/IShellWindow.cs deleted file mode 100644 index e450467..0000000 --- a/ChineseChess.GUI/Contracts/Views/IShellWindow.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System.Windows.Controls; - -namespace ChineseChess.GUI.Contracts.Views -{ - public interface IShellWindow - { - Frame GetNavigationFrame(); - - void ShowWindow(); - - void CloseWindow(); - } -} diff --git a/ChineseChess.GUI/Converters/EnumToBooleanConverter.cs b/ChineseChess.GUI/Converters/EnumToBooleanConverter.cs deleted file mode 100644 index 75b1cf1..0000000 --- a/ChineseChess.GUI/Converters/EnumToBooleanConverter.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System; -using System.Globalization; -using System.Windows.Data; - -namespace ChineseChess.GUI.Converters -{ - public class EnumToBooleanConverter : IValueConverter - { - public Type EnumType { get; set; } - - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - if (parameter is string enumString) - { - if (Enum.IsDefined(EnumType, value)) - { - var enumValue = Enum.Parse(EnumType, enumString); - - return enumValue.Equals(value); - } - } - - return false; - } - - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) - { - if (parameter is string enumString) - { - return Enum.Parse(EnumType, enumString); - } - - return null; - } - } -} diff --git a/ChineseChess.GUI/Helpers/FrameExtensions.cs b/ChineseChess.GUI/Helpers/FrameExtensions.cs deleted file mode 100644 index c63852f..0000000 --- a/ChineseChess.GUI/Helpers/FrameExtensions.cs +++ /dev/null @@ -1,23 +0,0 @@ -namespace System.Windows.Controls -{ - public static class FrameExtensions - { - public static object GetDataContext(this Frame frame) - { - if (frame.Content is FrameworkElement element) - { - return element.DataContext; - } - - return null; - } - - public static void CleanNavigation(this Frame frame) - { - while (frame.CanGoBack) - { - frame.RemoveBackEntry(); - } - } - } -} diff --git a/ChineseChess.GUI/Models/AppConfig.cs b/ChineseChess.GUI/Models/AppConfig.cs deleted file mode 100644 index a03823c..0000000 --- a/ChineseChess.GUI/Models/AppConfig.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace ChineseChess.GUI.Models -{ - public class AppConfig - { - public string ConfigurationsFolder { get; set; } - - public string AppPropertiesFileName { get; set; } - - public string PrivacyStatement { get; set; } - } -} diff --git a/ChineseChess.GUI/Models/AppTheme.cs b/ChineseChess.GUI/Models/AppTheme.cs deleted file mode 100644 index d20c8b4..0000000 --- a/ChineseChess.GUI/Models/AppTheme.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace ChineseChess.GUI.Models -{ - public enum AppTheme - { - Default, - Light, - Dark - } -} diff --git a/ChineseChess.GUI/Properties/Resources.Designer.cs b/ChineseChess.GUI/Properties/Resources.Designer.cs deleted file mode 100644 index 4f1ae4b..0000000 --- a/ChineseChess.GUI/Properties/Resources.Designer.cs +++ /dev/null @@ -1,197 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace ChineseChess.GUI.Properties { - using System; - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - public class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - public static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ChineseChess.GUI.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - public static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - /// - /// Looks up a localized string similar to wts.ItemName. - /// - public static string AppDisplayName { - get { - return ResourceManager.GetString("AppDisplayName", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to ShellGoBackButton. - /// - public static string ShellGoBackButton { - get { - return ResourceManager.GetString("ShellGoBackButton", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to ShellHamburgerButtonName. - /// - public static string ShellHamburgerButtonName { - get { - return ResourceManager.GetString("ShellHamburgerButtonName", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Main. - /// - public static string MainPageTitle { - get { - return ResourceManager.GetString("MainPageTitle", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Main. - /// - public static string ShellMainPage { - get { - return ResourceManager.GetString("ShellMainPage", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Settings page placeholder text. Your app description goes here.. - /// - public static string SettingsPageAboutText { - get { - return ResourceManager.GetString("SettingsPageAboutText", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to About this application. - /// - public static string SettingsPageAboutTitle { - get { - return ResourceManager.GetString("SettingsPageAboutTitle", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Choose Theme. - /// - public static string SettingsPageChooseThemeText { - get { - return ResourceManager.GetString("SettingsPageChooseThemeText", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Personalization. - /// - public static string SettingsPagePersonalizationTitle { - get { - return ResourceManager.GetString("SettingsPagePersonalizationTitle", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Privacy Statement. - /// - public static string SettingsPagePrivacyStatementText { - get { - return ResourceManager.GetString("SettingsPagePrivacyStatementText", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Dark. - /// - public static string SettingsPageRadioButtonDarkTheme { - get { - return ResourceManager.GetString("SettingsPageRadioButtonDarkTheme", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Light. - /// - public static string SettingsPageRadioButtonLightTheme { - get { - return ResourceManager.GetString("SettingsPageRadioButtonLightTheme", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Default. - /// - public static string SettingsPageRadioButtonWindowsDefaultTheme { - get { - return ResourceManager.GetString("SettingsPageRadioButtonWindowsDefaultTheme", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Settings. - /// - public static string SettingsPageTitle { - get { - return ResourceManager.GetString("SettingsPageTitle", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Settings. - /// - public static string ShellSettingsPage { - get { - return ResourceManager.GetString("ShellSettingsPage", resourceCulture); - } - } - } -} diff --git a/ChineseChess.GUI/Properties/Resources.resx b/ChineseChess.GUI/Properties/Resources.resx deleted file mode 100644 index 4ef21cc..0000000 --- a/ChineseChess.GUI/Properties/Resources.resx +++ /dev/null @@ -1,147 +0,0 @@ - - - - Settings - - - Settings - - - Settings page placeholder text. Your app description goes here. - - - About this application - - - Choose Theme - - - Personalization - - - Privacy Statement - - - Dark - - - Light - - - Default - - - Main - - - Main - - - Go back - - - Open or close navigation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 1.3 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - ChineseChess.GUI - - diff --git a/ChineseChess.GUI/Services/ApplicationHostService.cs b/ChineseChess.GUI/Services/ApplicationHostService.cs deleted file mode 100644 index e29fb7d..0000000 --- a/ChineseChess.GUI/Services/ApplicationHostService.cs +++ /dev/null @@ -1,93 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; - -using ChineseChess.GUI.Contracts.Activation; -using ChineseChess.GUI.Contracts.Services; -using ChineseChess.GUI.Contracts.Views; -using ChineseChess.GUI.ViewModels; - -using Microsoft.Extensions.Hosting; - -namespace ChineseChess.GUI.Services -{ - public class ApplicationHostService : IHostedService - { - private readonly IServiceProvider _serviceProvider; - private readonly INavigationService _navigationService; - private readonly IPersistAndRestoreService _persistAndRestoreService; - private readonly IThemeSelectorService _themeSelectorService; - private readonly IEnumerable _activationHandlers; - private IShellWindow _shellWindow; - private bool _isInitialized; - - public ApplicationHostService(IServiceProvider serviceProvider, IEnumerable activationHandlers, INavigationService navigationService, IThemeSelectorService themeSelectorService, IPersistAndRestoreService persistAndRestoreService) - { - _serviceProvider = serviceProvider; - _activationHandlers = activationHandlers; - _navigationService = navigationService; - _themeSelectorService = themeSelectorService; - _persistAndRestoreService = persistAndRestoreService; - } - - public async Task StartAsync(CancellationToken cancellationToken) - { - // Initialize services that you need before app activation - await InitializeAsync(); - - await HandleActivationAsync(); - - // Tasks after activation - await StartupAsync(); - _isInitialized = true; - } - - public async Task StopAsync(CancellationToken cancellationToken) - { - _persistAndRestoreService.PersistData(); - await Task.CompletedTask; - } - - private async Task InitializeAsync() - { - if (!_isInitialized) - { - _persistAndRestoreService.RestoreData(); - _themeSelectorService.InitializeTheme(); - await Task.CompletedTask; - } - } - - private async Task StartupAsync() - { - if (!_isInitialized) - { - await Task.CompletedTask; - } - } - - private async Task HandleActivationAsync() - { - var activationHandler = _activationHandlers.FirstOrDefault(h => h.CanHandle()); - - if (activationHandler != null) - { - await activationHandler.HandleAsync(); - } - - await Task.CompletedTask; - - if (App.Current.Windows.OfType().Count() == 0) - { - // Default activation that navigates to the apps default page - _shellWindow = _serviceProvider.GetService(typeof(IShellWindow)) as IShellWindow; - _navigationService.Initialize(_shellWindow.GetNavigationFrame()); - _shellWindow.ShowWindow(); - _navigationService.NavigateTo(typeof(MainViewModel).FullName); - await Task.CompletedTask; - } - } - } -} diff --git a/ChineseChess.GUI/Services/ApplicationInfoService.cs b/ChineseChess.GUI/Services/ApplicationInfoService.cs deleted file mode 100644 index 02a8ae0..0000000 --- a/ChineseChess.GUI/Services/ApplicationInfoService.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using System.Diagnostics; -using System.Reflection; - -using ChineseChess.GUI.Contracts.Services; - -namespace ChineseChess.GUI.Services -{ - public class ApplicationInfoService : IApplicationInfoService - { - public ApplicationInfoService() - { - } - - public Version GetVersion() - { - // Set the app version in ChineseChess.GUI > Properties > Package > PackageVersion - string assemblyLocation = Assembly.GetExecutingAssembly().Location; - var version = FileVersionInfo.GetVersionInfo(assemblyLocation).FileVersion; - return new Version(version); - } - } -} diff --git a/ChineseChess.GUI/Services/NavigationService.cs b/ChineseChess.GUI/Services/NavigationService.cs deleted file mode 100644 index 93759e4..0000000 --- a/ChineseChess.GUI/Services/NavigationService.cs +++ /dev/null @@ -1,101 +0,0 @@ -using System; -using System.Windows.Controls; -using System.Windows.Navigation; - -using ChineseChess.GUI.Contracts.Services; -using ChineseChess.GUI.Contracts.ViewModels; - -namespace ChineseChess.GUI.Services -{ - public class NavigationService : INavigationService - { - private readonly IPageService _pageService; - private Frame _frame; - private object _lastParameterUsed; - - public event EventHandler Navigated; - - public bool CanGoBack => _frame.CanGoBack; - - public NavigationService(IPageService pageService) - { - _pageService = pageService; - } - - public void Initialize(Frame shellFrame) - { - if (_frame == null) - { - _frame = shellFrame; - _frame.Navigated += OnNavigated; - } - } - - public void UnsubscribeNavigation() - { - _frame.Navigated -= OnNavigated; - _frame = null; - } - - public void GoBack() - { - if (_frame.CanGoBack) - { - var vmBeforeNavigation = _frame.GetDataContext(); - _frame.GoBack(); - if (vmBeforeNavigation is INavigationAware navigationAware) - { - navigationAware.OnNavigatedFrom(); - } - } - } - - public bool NavigateTo(string pageKey, object parameter = null, bool clearNavigation = false) - { - var pageType = _pageService.GetPageType(pageKey); - - if (_frame.Content?.GetType() != pageType || (parameter != null && !parameter.Equals(_lastParameterUsed))) - { - _frame.Tag = clearNavigation; - var page = _pageService.GetPage(pageKey); - var navigated = _frame.Navigate(page, parameter); - if (navigated) - { - _lastParameterUsed = parameter; - var dataContext = _frame.GetDataContext(); - if (dataContext is INavigationAware navigationAware) - { - navigationAware.OnNavigatedFrom(); - } - } - - return navigated; - } - - return false; - } - - public void CleanNavigation() - => _frame.CleanNavigation(); - - private void OnNavigated(object sender, NavigationEventArgs e) - { - if (sender is Frame frame) - { - bool clearNavigation = (bool)frame.Tag; - if (clearNavigation) - { - frame.CleanNavigation(); - } - - var dataContext = frame.GetDataContext(); - if (dataContext is INavigationAware navigationAware) - { - navigationAware.OnNavigatedTo(e.ExtraData); - } - - Navigated?.Invoke(sender, dataContext.GetType().FullName); - } - } - } -} diff --git a/ChineseChess.GUI/Services/PageService.cs b/ChineseChess.GUI/Services/PageService.cs deleted file mode 100644 index 7acbd79..0000000 --- a/ChineseChess.GUI/Services/PageService.cs +++ /dev/null @@ -1,68 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Windows.Controls; - -using ChineseChess.GUI.Contracts.Services; -using ChineseChess.GUI.ViewModels; -using ChineseChess.GUI.Views; - -using Microsoft.Toolkit.Mvvm.ComponentModel; - -namespace ChineseChess.GUI.Services -{ - public class PageService : IPageService - { - private readonly Dictionary _pages = new Dictionary(); - private readonly IServiceProvider _serviceProvider; - - public PageService(IServiceProvider serviceProvider) - { - _serviceProvider = serviceProvider; - Configure(); - Configure(); - } - - public Type GetPageType(string key) - { - Type pageType; - lock (_pages) - { - if (!_pages.TryGetValue(key, out pageType)) - { - throw new ArgumentException($"Page not found: {key}. Did you forget to call PageService.Configure?"); - } - } - - return pageType; - } - - public Page GetPage(string key) - { - var pageType = GetPageType(key); - return _serviceProvider.GetService(pageType) as Page; - } - - private void Configure() - where VM : ObservableObject - where V : Page - { - lock (_pages) - { - var key = typeof(VM).FullName; - if (_pages.ContainsKey(key)) - { - throw new ArgumentException($"The key {key} is already configured in PageService"); - } - - var type = typeof(V); - if (_pages.Any(p => p.Value == type)) - { - throw new ArgumentException($"This type is already configured with key {_pages.First(p => p.Value == type).Key}"); - } - - _pages.Add(key, type); - } - } - } -} diff --git a/ChineseChess.GUI/Services/PersistAndRestoreService.cs b/ChineseChess.GUI/Services/PersistAndRestoreService.cs deleted file mode 100644 index ea052e1..0000000 --- a/ChineseChess.GUI/Services/PersistAndRestoreService.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System; -using System.Collections; -using System.IO; - -using ChineseChess.GUI.Contracts.Services; -using ChineseChess.GUI.Core.Contracts.Services; -using ChineseChess.GUI.Models; - -using Microsoft.Extensions.Options; - -namespace ChineseChess.GUI.Services -{ - public class PersistAndRestoreService : IPersistAndRestoreService - { - private readonly IFileService _fileService; - private readonly AppConfig _appConfig; - private readonly string _localAppData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); - - public PersistAndRestoreService(IFileService fileService, IOptions appConfig) - { - _fileService = fileService; - _appConfig = appConfig.Value; - } - - public void PersistData() - { - if (App.Current.Properties != null) - { - var folderPath = Path.Combine(_localAppData, _appConfig.ConfigurationsFolder); - var fileName = _appConfig.AppPropertiesFileName; - _fileService.Save(folderPath, fileName, App.Current.Properties); - } - } - - public void RestoreData() - { - var folderPath = Path.Combine(_localAppData, _appConfig.ConfigurationsFolder); - var fileName = _appConfig.AppPropertiesFileName; - var properties = _fileService.Read(folderPath, fileName); - if (properties != null) - { - foreach (DictionaryEntry property in properties) - { - App.Current.Properties.Add(property.Key, property.Value); - } - } - } - } -} diff --git a/ChineseChess.GUI/Services/SystemService.cs b/ChineseChess.GUI/Services/SystemService.cs deleted file mode 100644 index 0a9b9dc..0000000 --- a/ChineseChess.GUI/Services/SystemService.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System.Diagnostics; - -using ChineseChess.GUI.Contracts.Services; - -namespace ChineseChess.GUI.Services -{ - public class SystemService : ISystemService - { - public SystemService() - { - } - - public void OpenInWebBrowser(string url) - { - // For more info see https://github.com/dotnet/corefx/issues/10361 - var psi = new ProcessStartInfo - { - FileName = url, - UseShellExecute = true - }; - Process.Start(psi); - } - } -} diff --git a/ChineseChess.GUI/Services/ThemeSelectorService.cs b/ChineseChess.GUI/Services/ThemeSelectorService.cs deleted file mode 100644 index 2b569b9..0000000 --- a/ChineseChess.GUI/Services/ThemeSelectorService.cs +++ /dev/null @@ -1,63 +0,0 @@ -using System; -using System.Windows; - -using ChineseChess.GUI.Contracts.Services; -using ChineseChess.GUI.Models; - -using ControlzEx.Theming; - -using MahApps.Metro.Theming; - -namespace ChineseChess.GUI.Services -{ - public class ThemeSelectorService : IThemeSelectorService - { - private const string HcDarkTheme = "pack://application:,,,/Styles/Themes/HC.Dark.Blue.xaml"; - private const string HcLightTheme = "pack://application:,,,/Styles/Themes/HC.Light.Blue.xaml"; - - public ThemeSelectorService() - { - } - - public void InitializeTheme() - { - // TODO WTS: Mahapps.Metro supports syncronization with high contrast but you have to provide custom high contrast themes - // We've added basic high contrast dictionaries for Dark and Light themes - // Please complete these themes following the docs on https://mahapps.com/docs/themes/thememanager#creating-custom-themes - ThemeManager.Current.AddLibraryTheme(new LibraryTheme(new Uri(HcDarkTheme), MahAppsLibraryThemeProvider.DefaultInstance)); - ThemeManager.Current.AddLibraryTheme(new LibraryTheme(new Uri(HcLightTheme), MahAppsLibraryThemeProvider.DefaultInstance)); - - var theme = GetCurrentTheme(); - SetTheme(theme); - } - - public void SetTheme(AppTheme theme) - { - if (theme == AppTheme.Default) - { - ThemeManager.Current.ThemeSyncMode = ThemeSyncMode.SyncAll; - ThemeManager.Current.SyncTheme(); - } - else - { - ThemeManager.Current.ThemeSyncMode = ThemeSyncMode.SyncWithHighContrast; - ThemeManager.Current.SyncTheme(); - ThemeManager.Current.ChangeTheme(Application.Current, $"{theme}.Blue", SystemParameters.HighContrast); - } - - App.Current.Properties["Theme"] = theme.ToString(); - } - - public AppTheme GetCurrentTheme() - { - if (App.Current.Properties.Contains("Theme")) - { - var themeName = App.Current.Properties["Theme"].ToString(); - Enum.TryParse(themeName, out AppTheme theme); - return theme; - } - - return AppTheme.Default; - } - } -} diff --git a/ChineseChess.GUI/Styles/MetroWindow.xaml b/ChineseChess.GUI/Styles/MetroWindow.xaml deleted file mode 100644 index 2ddb27e..0000000 --- a/ChineseChess.GUI/Styles/MetroWindow.xaml +++ /dev/null @@ -1,14 +0,0 @@ - - - - diff --git a/ChineseChess.GUI/Styles/TextBlock.xaml b/ChineseChess.GUI/Styles/TextBlock.xaml deleted file mode 100644 index e8ad872..0000000 --- a/ChineseChess.GUI/Styles/TextBlock.xaml +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ChineseChess.GUI/Styles/Themes/HC.Dark.Blue.xaml b/ChineseChess.GUI/Styles/Themes/HC.Dark.Blue.xaml deleted file mode 100644 index 4daf357..0000000 --- a/ChineseChess.GUI/Styles/Themes/HC.Dark.Blue.xaml +++ /dev/null @@ -1,40 +0,0 @@ - - - - Dark.Blue - ChineseChess.GUI - Blue (Dark) - Dark - Blue - true - #FF0078D7 - - - - - - - #FFFFFFFF - #FF000000 - #FFFFFFFF - - - - - - - - - \ No newline at end of file diff --git a/ChineseChess.GUI/Styles/Themes/HC.Light.Blue.xaml b/ChineseChess.GUI/Styles/Themes/HC.Light.Blue.xaml deleted file mode 100644 index 2b68ae6..0000000 --- a/ChineseChess.GUI/Styles/Themes/HC.Light.Blue.xaml +++ /dev/null @@ -1,40 +0,0 @@ - - - - Light.Blue - ChineseChess.GUI - Blue (Light) - Light - Blue - true - #FF0078D7 - - - - - - - #FF000000 - #FFFFFFFF - #FF000000 - - - - - - - - - \ No newline at end of file diff --git a/ChineseChess.GUI/Styles/_FontSizes.xaml b/ChineseChess.GUI/Styles/_FontSizes.xaml deleted file mode 100644 index 814c112..0000000 --- a/ChineseChess.GUI/Styles/_FontSizes.xaml +++ /dev/null @@ -1,14 +0,0 @@ - - - 12 - - 14 - - 18 - - 22 - - diff --git a/ChineseChess.GUI/Styles/_Thickness.xaml b/ChineseChess.GUI/Styles/_Thickness.xaml deleted file mode 100644 index 49abd94..0000000 --- a/ChineseChess.GUI/Styles/_Thickness.xaml +++ /dev/null @@ -1,30 +0,0 @@ - - - - 24,0,0,0 - 24,24,24,0 - 0,24,0,0 - 24,0,24,0 - 0, 0, 0, 24 - 24,24,24,24 - - - 12, 0, 0, 0 - 12, 12, 0, 0 - 12, 0, 12, 0 - 0, 12, 0, 0 - 0, 0, 12, 0 - 0, 12, 0, 12 - 12, 12, 12, 12 - - - 8, 0, 0, 0 - 0, 8, 0, 0 - 8, 8, 8, 8 - - - 0, 4, 0, 0 - - diff --git a/ChineseChess.GUI/TemplateSelectors/MenuItemTemplateSelector.cs b/ChineseChess.GUI/TemplateSelectors/MenuItemTemplateSelector.cs deleted file mode 100644 index 7bd94b5..0000000 --- a/ChineseChess.GUI/TemplateSelectors/MenuItemTemplateSelector.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System.Windows; -using System.Windows.Controls; - -using MahApps.Metro.Controls; - -namespace ChineseChess.GUI.TemplateSelectors -{ - public class MenuItemTemplateSelector : DataTemplateSelector - { - public DataTemplate GlyphDataTemplate { get; set; } - - public DataTemplate ImageDataTemplate { get; set; } - - public override DataTemplate SelectTemplate(object item, DependencyObject container) - { - if (item is HamburgerMenuGlyphItem) - { - return GlyphDataTemplate; - } - - if (item is HamburgerMenuImageItem) - { - return ImageDataTemplate; - } - - return base.SelectTemplate(item, container); - } - } -} diff --git a/ChineseChess.GUI/ViewModels/MainViewModel.cs b/ChineseChess.GUI/ViewModels/MainViewModel.cs deleted file mode 100644 index ec59779..0000000 --- a/ChineseChess.GUI/ViewModels/MainViewModel.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; - -using Microsoft.Toolkit.Mvvm.ComponentModel; -using Microsoft.Toolkit.Mvvm.Input; - -namespace ChineseChess.GUI.ViewModels -{ - public class MainViewModel : ObservableObject - { - public MainViewModel() - { - } - } -} diff --git a/ChineseChess.GUI/ViewModels/SettingsViewModel.cs b/ChineseChess.GUI/ViewModels/SettingsViewModel.cs deleted file mode 100644 index 90ec165..0000000 --- a/ChineseChess.GUI/ViewModels/SettingsViewModel.cs +++ /dev/null @@ -1,69 +0,0 @@ -using System; -using System.Windows.Input; - -using ChineseChess.GUI.Contracts.Services; -using ChineseChess.GUI.Contracts.ViewModels; -using ChineseChess.GUI.Models; - -using Microsoft.Extensions.Options; -using Microsoft.Toolkit.Mvvm.ComponentModel; -using Microsoft.Toolkit.Mvvm.Input; - -namespace ChineseChess.GUI.ViewModels -{ - // TODO WTS: Change the URL for your privacy policy in the appsettings.json file, currently set to https://YourPrivacyUrlGoesHere - public class SettingsViewModel : ObservableObject, INavigationAware - { - private readonly AppConfig _appConfig; - private readonly IThemeSelectorService _themeSelectorService; - private readonly ISystemService _systemService; - private readonly IApplicationInfoService _applicationInfoService; - private AppTheme _theme; - private string _versionDescription; - private ICommand _setThemeCommand; - private ICommand _privacyStatementCommand; - - public AppTheme Theme - { - get { return _theme; } - set { SetProperty(ref _theme, value); } - } - - public string VersionDescription - { - get { return _versionDescription; } - set { SetProperty(ref _versionDescription, value); } - } - - public ICommand SetThemeCommand => _setThemeCommand ??= new RelayCommand(OnSetTheme); - - public ICommand PrivacyStatementCommand => _privacyStatementCommand ??= new RelayCommand(OnPrivacyStatement); - - public SettingsViewModel(IOptions appConfig, IThemeSelectorService themeSelectorService, ISystemService systemService, IApplicationInfoService applicationInfoService) - { - _appConfig = appConfig.Value; - _themeSelectorService = themeSelectorService; - _systemService = systemService; - _applicationInfoService = applicationInfoService; - } - - public void OnNavigatedTo(object parameter) - { - VersionDescription = $"{Properties.Resources.AppDisplayName} - {_applicationInfoService.GetVersion()}"; - Theme = _themeSelectorService.GetCurrentTheme(); - } - - public void OnNavigatedFrom() - { - } - - private void OnSetTheme(string themeName) - { - var theme = (AppTheme)Enum.Parse(typeof(AppTheme), themeName); - _themeSelectorService.SetTheme(theme); - } - - private void OnPrivacyStatement() - => _systemService.OpenInWebBrowser(_appConfig.PrivacyStatement); - } -} diff --git a/ChineseChess.GUI/ViewModels/ShellViewModel.cs b/ChineseChess.GUI/ViewModels/ShellViewModel.cs deleted file mode 100644 index d37985b..0000000 --- a/ChineseChess.GUI/ViewModels/ShellViewModel.cs +++ /dev/null @@ -1,114 +0,0 @@ -using System; -using System.Collections.ObjectModel; -using System.Linq; -using System.Windows.Input; - -using ChineseChess.GUI.Contracts.Services; -using ChineseChess.GUI.Properties; - -using MahApps.Metro.Controls; - -using Microsoft.Toolkit.Mvvm.ComponentModel; -using Microsoft.Toolkit.Mvvm.Input; - -namespace ChineseChess.GUI.ViewModels -{ - public class ShellViewModel : ObservableObject - { - private readonly INavigationService _navigationService; - private HamburgerMenuItem _selectedMenuItem; - private HamburgerMenuItem _selectedOptionsMenuItem; - private RelayCommand _goBackCommand; - private ICommand _menuItemInvokedCommand; - private ICommand _optionsMenuItemInvokedCommand; - private ICommand _loadedCommand; - private ICommand _unloadedCommand; - - public HamburgerMenuItem SelectedMenuItem - { - get { return _selectedMenuItem; } - set { SetProperty(ref _selectedMenuItem, value); } - } - - public HamburgerMenuItem SelectedOptionsMenuItem - { - get { return _selectedOptionsMenuItem; } - set { SetProperty(ref _selectedOptionsMenuItem, value); } - } - - // TODO WTS: Change the icons and titles for all HamburgerMenuItems here. - public ObservableCollection MenuItems { get; } = new ObservableCollection() - { - new HamburgerMenuGlyphItem() { Label = Resources.ShellMainPage, Glyph = "\uE8A5", TargetPageType = typeof(MainViewModel) }, - }; - - public ObservableCollection OptionMenuItems { get; } = new ObservableCollection() - { - new HamburgerMenuGlyphItem() { Label = Resources.ShellSettingsPage, Glyph = "\uE713", TargetPageType = typeof(SettingsViewModel) } - }; - - public RelayCommand GoBackCommand => _goBackCommand ??= new RelayCommand(OnGoBack, CanGoBack); - - public ICommand MenuItemInvokedCommand => _menuItemInvokedCommand ??= new RelayCommand(OnMenuItemInvoked); - - public ICommand OptionsMenuItemInvokedCommand => _optionsMenuItemInvokedCommand ??= new RelayCommand(OnOptionsMenuItemInvoked); - - public ICommand LoadedCommand => _loadedCommand ??= new RelayCommand(OnLoaded); - - public ICommand UnloadedCommand => _unloadedCommand ??= new RelayCommand(OnUnloaded); - - public ShellViewModel(INavigationService navigationService) - { - _navigationService = navigationService; - } - - private void OnLoaded() - { - _navigationService.Navigated += OnNavigated; - } - - private void OnUnloaded() - { - _navigationService.Navigated -= OnNavigated; - } - - private bool CanGoBack() - => _navigationService.CanGoBack; - - private void OnGoBack() - => _navigationService.GoBack(); - - private void OnMenuItemInvoked() - => NavigateTo(SelectedMenuItem.TargetPageType); - - private void OnOptionsMenuItemInvoked() - => NavigateTo(SelectedOptionsMenuItem.TargetPageType); - - private void NavigateTo(Type targetViewModel) - { - if (targetViewModel != null) - { - _navigationService.NavigateTo(targetViewModel.FullName); - } - } - - private void OnNavigated(object sender, string viewModelName) - { - var item = MenuItems - .OfType() - .FirstOrDefault(i => viewModelName == i.TargetPageType?.FullName); - if (item != null) - { - SelectedMenuItem = item; - } - else - { - SelectedOptionsMenuItem = OptionMenuItems - .OfType() - .FirstOrDefault(i => viewModelName == i.TargetPageType?.FullName); - } - - GoBackCommand.NotifyCanExecuteChanged(); - } - } -} diff --git a/ChineseChess.GUI/Views/MainPage.xaml b/ChineseChess.GUI/Views/MainPage.xaml deleted file mode 100644 index 1e84b6a..0000000 --- a/ChineseChess.GUI/Views/MainPage.xaml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - diff --git a/ChineseChess.GUI/Views/MainPage.xaml.cs b/ChineseChess.GUI/Views/MainPage.xaml.cs deleted file mode 100644 index 03d94fe..0000000 --- a/ChineseChess.GUI/Views/MainPage.xaml.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System.Windows.Controls; - -using ChineseChess.GUI.ViewModels; - -namespace ChineseChess.GUI.Views -{ - public partial class MainPage : Page - { - public MainPage(MainViewModel viewModel) - { - InitializeComponent(); - DataContext = viewModel; - } - } -} diff --git a/ChineseChess.GUI/Views/SettingsPage.xaml b/ChineseChess.GUI/Views/SettingsPage.xaml deleted file mode 100644 index b266adf..0000000 --- a/ChineseChess.GUI/Views/SettingsPage.xaml +++ /dev/null @@ -1,106 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ChineseChess.GUI/Views/SettingsPage.xaml.cs b/ChineseChess.GUI/Views/SettingsPage.xaml.cs deleted file mode 100644 index 375059f..0000000 --- a/ChineseChess.GUI/Views/SettingsPage.xaml.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System.Windows.Controls; - -using ChineseChess.GUI.ViewModels; - -namespace ChineseChess.GUI.Views -{ - public partial class SettingsPage : Page - { - public SettingsPage(SettingsViewModel viewModel) - { - InitializeComponent(); - DataContext = viewModel; - } - } -} diff --git a/ChineseChess.GUI/Views/ShellWindow.xaml b/ChineseChess.GUI/Views/ShellWindow.xaml deleted file mode 100644 index 71adfe7..0000000 --- a/ChineseChess.GUI/Views/ShellWindow.xaml +++ /dev/null @@ -1,116 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ChineseChess.GUI/Views/ShellWindow.xaml.cs b/ChineseChess.GUI/Views/ShellWindow.xaml.cs deleted file mode 100644 index 6fc4acc..0000000 --- a/ChineseChess.GUI/Views/ShellWindow.xaml.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System.Windows.Controls; - -using ChineseChess.GUI.Contracts.Views; -using ChineseChess.GUI.ViewModels; - -using MahApps.Metro.Controls; - -namespace ChineseChess.GUI.Views -{ - public partial class ShellWindow : MetroWindow, IShellWindow - { - public ShellWindow(ShellViewModel viewModel) - { - InitializeComponent(); - DataContext = viewModel; - } - - public Frame GetNavigationFrame() - => shellFrame; - - public void ShowWindow() - => Show(); - - public void CloseWindow() - => Close(); - } -} diff --git a/ChineseChess.GUI/WTS.ProjectConfig.xml b/ChineseChess.GUI/WTS.ProjectConfig.xml deleted file mode 100644 index 55fd5dd..0000000 --- a/ChineseChess.GUI/WTS.ProjectConfig.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - diff --git a/ChineseChess.GUI/app.manifest b/ChineseChess.GUI/app.manifest deleted file mode 100644 index d1b636a..0000000 --- a/ChineseChess.GUI/app.manifest +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - true/PM - PerMonitorV2, PerMonitor - - - \ No newline at end of file diff --git a/ChineseChess.GUI/appsettings.json b/ChineseChess.GUI/appsettings.json deleted file mode 100644 index 11ec1ba..0000000 --- a/ChineseChess.GUI/appsettings.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "AppConfig": { - "configurationsFolder": "ChineseChess.GUI\\Configurations", - "appPropertiesFileName": "AppProperties.json", - "privacyStatement": "https://YourPrivacyUrlGoesHere/" - } -} diff --git a/ChineseChess.sln b/ChineseChess.sln index 9a82c90..00e7979 100644 --- a/ChineseChess.sln +++ b/ChineseChess.sln @@ -5,11 +5,7 @@ VisualStudioVersion = 16.0.31129.286 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ChineseChess.Core", "ChineseChess.Core\ChineseChess.Core.csproj", "{6E2FA057-9341-496B-BD68-EC3E4CE3E18A}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ChineseChess.GUI", "ChineseChess.GUI\ChineseChess.GUI.csproj", "{0B8FD863-5EBC-48F0-9A7F-9604C1185F0B}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ChineseChess.GUI.Core", "ChineseChess.GUI.Core\ChineseChess.GUI.Core.csproj", "{FF15C546-6BA2-4DA8-8BB6-70C4ABB2B8E1}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ChineseChess.GUI.Tests.xUnit", "ChineseChess.GUI.Tests.xUnit\ChineseChess.GUI.Tests.xUnit.csproj", "{649553A0-4005-4383-BBE5-E601198A49A7}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ChineseChess", "ChineseChess\ChineseChess.csproj", "{F671D991-AD7D-4FD9-BC57-AE4BE8CD1136}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -33,42 +29,18 @@ Global {6E2FA057-9341-496B-BD68-EC3E4CE3E18A}.Release|x64.Build.0 = Release|Any CPU {6E2FA057-9341-496B-BD68-EC3E4CE3E18A}.Release|x86.ActiveCfg = Release|Any CPU {6E2FA057-9341-496B-BD68-EC3E4CE3E18A}.Release|x86.Build.0 = Release|Any CPU - {0B8FD863-5EBC-48F0-9A7F-9604C1185F0B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0B8FD863-5EBC-48F0-9A7F-9604C1185F0B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0B8FD863-5EBC-48F0-9A7F-9604C1185F0B}.Debug|x64.ActiveCfg = Debug|Any CPU - {0B8FD863-5EBC-48F0-9A7F-9604C1185F0B}.Debug|x64.Build.0 = Debug|Any CPU - {0B8FD863-5EBC-48F0-9A7F-9604C1185F0B}.Debug|x86.ActiveCfg = Debug|Any CPU - {0B8FD863-5EBC-48F0-9A7F-9604C1185F0B}.Debug|x86.Build.0 = Debug|Any CPU - {0B8FD863-5EBC-48F0-9A7F-9604C1185F0B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0B8FD863-5EBC-48F0-9A7F-9604C1185F0B}.Release|Any CPU.Build.0 = Release|Any CPU - {0B8FD863-5EBC-48F0-9A7F-9604C1185F0B}.Release|x64.ActiveCfg = Release|Any CPU - {0B8FD863-5EBC-48F0-9A7F-9604C1185F0B}.Release|x64.Build.0 = Release|Any CPU - {0B8FD863-5EBC-48F0-9A7F-9604C1185F0B}.Release|x86.ActiveCfg = Release|Any CPU - {0B8FD863-5EBC-48F0-9A7F-9604C1185F0B}.Release|x86.Build.0 = Release|Any CPU - {FF15C546-6BA2-4DA8-8BB6-70C4ABB2B8E1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {FF15C546-6BA2-4DA8-8BB6-70C4ABB2B8E1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FF15C546-6BA2-4DA8-8BB6-70C4ABB2B8E1}.Debug|x64.ActiveCfg = Debug|Any CPU - {FF15C546-6BA2-4DA8-8BB6-70C4ABB2B8E1}.Debug|x64.Build.0 = Debug|Any CPU - {FF15C546-6BA2-4DA8-8BB6-70C4ABB2B8E1}.Debug|x86.ActiveCfg = Debug|Any CPU - {FF15C546-6BA2-4DA8-8BB6-70C4ABB2B8E1}.Debug|x86.Build.0 = Debug|Any CPU - {FF15C546-6BA2-4DA8-8BB6-70C4ABB2B8E1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {FF15C546-6BA2-4DA8-8BB6-70C4ABB2B8E1}.Release|Any CPU.Build.0 = Release|Any CPU - {FF15C546-6BA2-4DA8-8BB6-70C4ABB2B8E1}.Release|x64.ActiveCfg = Release|Any CPU - {FF15C546-6BA2-4DA8-8BB6-70C4ABB2B8E1}.Release|x64.Build.0 = Release|Any CPU - {FF15C546-6BA2-4DA8-8BB6-70C4ABB2B8E1}.Release|x86.ActiveCfg = Release|Any CPU - {FF15C546-6BA2-4DA8-8BB6-70C4ABB2B8E1}.Release|x86.Build.0 = Release|Any CPU - {649553A0-4005-4383-BBE5-E601198A49A7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {649553A0-4005-4383-BBE5-E601198A49A7}.Debug|Any CPU.Build.0 = Debug|Any CPU - {649553A0-4005-4383-BBE5-E601198A49A7}.Debug|x64.ActiveCfg = Debug|x64 - {649553A0-4005-4383-BBE5-E601198A49A7}.Debug|x64.Build.0 = Debug|x64 - {649553A0-4005-4383-BBE5-E601198A49A7}.Debug|x86.ActiveCfg = Debug|x86 - {649553A0-4005-4383-BBE5-E601198A49A7}.Debug|x86.Build.0 = Debug|x86 - {649553A0-4005-4383-BBE5-E601198A49A7}.Release|Any CPU.ActiveCfg = Release|Any CPU - {649553A0-4005-4383-BBE5-E601198A49A7}.Release|Any CPU.Build.0 = Release|Any CPU - {649553A0-4005-4383-BBE5-E601198A49A7}.Release|x64.ActiveCfg = Release|x64 - {649553A0-4005-4383-BBE5-E601198A49A7}.Release|x64.Build.0 = Release|x64 - {649553A0-4005-4383-BBE5-E601198A49A7}.Release|x86.ActiveCfg = Release|x86 - {649553A0-4005-4383-BBE5-E601198A49A7}.Release|x86.Build.0 = Release|x86 + {F671D991-AD7D-4FD9-BC57-AE4BE8CD1136}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F671D991-AD7D-4FD9-BC57-AE4BE8CD1136}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F671D991-AD7D-4FD9-BC57-AE4BE8CD1136}.Debug|x64.ActiveCfg = Debug|Any CPU + {F671D991-AD7D-4FD9-BC57-AE4BE8CD1136}.Debug|x64.Build.0 = Debug|Any CPU + {F671D991-AD7D-4FD9-BC57-AE4BE8CD1136}.Debug|x86.ActiveCfg = Debug|Any CPU + {F671D991-AD7D-4FD9-BC57-AE4BE8CD1136}.Debug|x86.Build.0 = Debug|Any CPU + {F671D991-AD7D-4FD9-BC57-AE4BE8CD1136}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F671D991-AD7D-4FD9-BC57-AE4BE8CD1136}.Release|Any CPU.Build.0 = Release|Any CPU + {F671D991-AD7D-4FD9-BC57-AE4BE8CD1136}.Release|x64.ActiveCfg = Release|Any CPU + {F671D991-AD7D-4FD9-BC57-AE4BE8CD1136}.Release|x64.Build.0 = Release|Any CPU + {F671D991-AD7D-4FD9-BC57-AE4BE8CD1136}.Release|x86.ActiveCfg = Release|Any CPU + {F671D991-AD7D-4FD9-BC57-AE4BE8CD1136}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/ChineseChess/ChineseChess.csproj b/ChineseChess/ChineseChess.csproj new file mode 100644 index 0000000..a2d4310 --- /dev/null +++ b/ChineseChess/ChineseChess.csproj @@ -0,0 +1,9 @@ + + + + WinExe + net5.0-windows + true + + + \ No newline at end of file diff --git a/ChineseChess/MainForm.Designer.cs b/ChineseChess/MainForm.Designer.cs new file mode 100644 index 0000000..78b9be4 --- /dev/null +++ b/ChineseChess/MainForm.Designer.cs @@ -0,0 +1,50 @@ + +namespace ChineseChess +{ + partial class MainForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.SuspendLayout(); + // + // MainForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(784, 561); + this.Name = "MainForm"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "象棋"; + this.Load += new System.EventHandler(this.Form1_Load); + this.ResumeLayout(false); + + } + + #endregion + } +} + diff --git a/ChineseChess/MainForm.cs b/ChineseChess/MainForm.cs new file mode 100644 index 0000000..d668d52 --- /dev/null +++ b/ChineseChess/MainForm.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace ChineseChess +{ + public partial class MainForm : Form + { + public MainForm() + { + InitializeComponent(); + } + + private void Form1_Load(object sender, EventArgs e) + { + + } + } +} diff --git a/ChineseChess/MainForm.resx b/ChineseChess/MainForm.resx new file mode 100644 index 0000000..f298a7b --- /dev/null +++ b/ChineseChess/MainForm.resx @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ChineseChess/Program.cs b/ChineseChess/Program.cs new file mode 100644 index 0000000..4cbab15 --- /dev/null +++ b/ChineseChess/Program.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace ChineseChess +{ + static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.SetHighDpiMode(HighDpiMode.SystemAware); + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new MainForm()); + } + } +}