From a501c9f0fe23e42b2c58f6ec3a4cedd3b28c669c Mon Sep 17 00:00:00 2001
From: Stan___Kudri <53861218+Stan-Kudri@users.noreply.github.com>
Date: Mon, 28 Oct 2024 23:59:34 +0300
Subject: [PATCH 1/2] WatchList.WPF - Create project and add first button.
---
WatchList.WPF/App.xaml | 6 ++
WatchList.WPF/App.xaml.cs | 78 +++++++++++++++++++
WatchList.WPF/AssemblyInfo.cs | 10 +++
WatchList.WPF/CinemaWindow.xaml | 31 ++++++++
WatchList.WPF/CinemaWindow.xaml.cs | 24 ++++++
WatchList.WPF/WatchList.WPF.csproj | 25 ++++++
WatchList.WPF/WindowBox/MessageBoxPage.xaml | 14 ++++
.../WindowBox/MessageBoxPage.xaml.cs | 47 +++++++++++
WatchList.sln | 8 +-
9 files changed, 242 insertions(+), 1 deletion(-)
create mode 100644 WatchList.WPF/App.xaml
create mode 100644 WatchList.WPF/App.xaml.cs
create mode 100644 WatchList.WPF/AssemblyInfo.cs
create mode 100644 WatchList.WPF/CinemaWindow.xaml
create mode 100644 WatchList.WPF/CinemaWindow.xaml.cs
create mode 100644 WatchList.WPF/WatchList.WPF.csproj
create mode 100644 WatchList.WPF/WindowBox/MessageBoxPage.xaml
create mode 100644 WatchList.WPF/WindowBox/MessageBoxPage.xaml.cs
diff --git a/WatchList.WPF/App.xaml b/WatchList.WPF/App.xaml
new file mode 100644
index 0000000..943ca27
--- /dev/null
+++ b/WatchList.WPF/App.xaml
@@ -0,0 +1,6 @@
+
+
+
diff --git a/WatchList.WPF/App.xaml.cs b/WatchList.WPF/App.xaml.cs
new file mode 100644
index 0000000..d2c377a
--- /dev/null
+++ b/WatchList.WPF/App.xaml.cs
@@ -0,0 +1,78 @@
+using System.IO;
+using System.Windows;
+using Microsoft.Extensions.DependencyInjection;
+using Serilog;
+using Serilog.Core;
+using WatchList.Core.Extension;
+using WatchList.Core.Repository;
+using WatchList.Core.Service;
+using WatchList.Core.Service.Component;
+using WatchList.Core.Service.DataLoading;
+using WatchList.Migrations.SQLite;
+using WatchList.WPF.WindowBox;
+
+namespace WatchList.WPF
+{
+ ///
+ /// Interaction logic for App.xaml
+ ///
+ public partial class App : Application
+ {
+ private void Application_Startup(object sender, StartupEventArgs e)
+ {
+ Log.Logger = CreateLogger();
+
+ try
+ {
+ Log.Information("Starting WinForms applications");
+ var serviceCollection = AppServiceDI();
+ serviceCollection.AddSerilog();
+
+ using var contain = serviceCollection.BuildServiceProvider(
+ new ServiceProviderOptions
+ {
+ ValidateOnBuild = true,
+ ValidateScopes = true,
+ });
+
+ using var scope = contain.CreateScope();
+ var serviceProvider = scope.ServiceProvider;
+
+ // Create the startup window
+ CinemaWindow cinemaWindow = new CinemaWindow(serviceProvider);
+ // Show the window
+ cinemaWindow.Show();
+ }
+ catch (Exception ex)
+ {
+ Log.Fatal(ex, "Application terminated unexpectedly");
+ }
+ finally
+ {
+ Log.CloseAndFlush();
+ }
+ }
+
+ private static IServiceCollection AppServiceDI()
+ => new ServiceCollection().AddSingleton(new DbContextFactoryMigrator("app.db"))
+ .AddScoped(e => e.GetRequiredService().Create())
+ .AddScoped()
+ .AddScoped()
+ .AddScoped()
+ .AddScoped()
+ .AddLogging();
+
+ private static Logger CreateLogger(string logDirectory = "log")
+ {
+ try
+ {
+ Directory.CreateDirectory(logDirectory);
+ }
+ catch
+ {
+ }
+
+ return logDirectory.CreateLogger();
+ }
+ }
+}
diff --git a/WatchList.WPF/AssemblyInfo.cs b/WatchList.WPF/AssemblyInfo.cs
new file mode 100644
index 0000000..b0ec827
--- /dev/null
+++ b/WatchList.WPF/AssemblyInfo.cs
@@ -0,0 +1,10 @@
+using System.Windows;
+
+[assembly: ThemeInfo(
+ ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
+ //(used if a resource is not found in the page,
+ // or application resource dictionaries)
+ ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
+ //(used if a resource is not found in the page,
+ // app, or any theme specific resource dictionaries)
+)]
diff --git a/WatchList.WPF/CinemaWindow.xaml b/WatchList.WPF/CinemaWindow.xaml
new file mode 100644
index 0000000..99536cf
--- /dev/null
+++ b/WatchList.WPF/CinemaWindow.xaml
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/WatchList.WPF/CinemaWindow.xaml.cs b/WatchList.WPF/CinemaWindow.xaml.cs
new file mode 100644
index 0000000..4d66f37
--- /dev/null
+++ b/WatchList.WPF/CinemaWindow.xaml.cs
@@ -0,0 +1,24 @@
+using System.Windows;
+
+namespace WatchList.WPF
+{
+ ///
+ /// Interaction logic for MainWindow.xaml
+ ///
+ public partial class CinemaWindow : Window
+ {
+ IServiceProvider _serviceProvider;
+
+ public CinemaWindow(IServiceProvider serviceProvider)
+ {
+ _serviceProvider = serviceProvider;
+
+ InitializeComponent();
+ }
+
+ private void Button_Click(object sender, RoutedEventArgs e)
+ {
+
+ }
+ }
+}
diff --git a/WatchList.WPF/WatchList.WPF.csproj b/WatchList.WPF/WatchList.WPF.csproj
new file mode 100644
index 0000000..64be435
--- /dev/null
+++ b/WatchList.WPF/WatchList.WPF.csproj
@@ -0,0 +1,25 @@
+
+
+
+ WinExe
+ net7.0-windows
+ enable
+ enable
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/WatchList.WPF/WindowBox/MessageBoxPage.xaml b/WatchList.WPF/WindowBox/MessageBoxPage.xaml
new file mode 100644
index 0000000..6071c1c
--- /dev/null
+++ b/WatchList.WPF/WindowBox/MessageBoxPage.xaml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
diff --git a/WatchList.WPF/WindowBox/MessageBoxPage.xaml.cs b/WatchList.WPF/WindowBox/MessageBoxPage.xaml.cs
new file mode 100644
index 0000000..ea905d3
--- /dev/null
+++ b/WatchList.WPF/WindowBox/MessageBoxPage.xaml.cs
@@ -0,0 +1,47 @@
+using System.Windows.Controls;
+using WatchList.Core.Model.QuestionResult;
+using WatchList.Core.Service.Component;
+
+namespace WatchList.WPF.WindowBox
+{
+ ///
+ /// Interaction logic for MessageBoxPage.xaml
+ ///
+ public partial class MessageBoxPage : Page, IMessageBox
+ {
+ public MessageBoxPage()
+ {
+ InitializeComponent();
+ }
+
+ public Task ShowDataReplaceQuestion(string titleItem)
+ {
+ throw new NotImplementedException();
+ }
+
+ public Task ShowError(string message)
+ {
+ throw new NotImplementedException();
+ }
+
+ public Task ShowInfo(string message)
+ {
+ throw new NotImplementedException();
+ }
+
+ public Task ShowQuestion(string message)
+ {
+ throw new NotImplementedException();
+ }
+
+ public Task ShowQuestionSaveItem(string message)
+ {
+ throw new NotImplementedException();
+ }
+
+ public Task ShowWarning(string message)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/WatchList.sln b/WatchList.sln
index 45b4942..c100ca8 100644
--- a/WatchList.sln
+++ b/WatchList.sln
@@ -16,7 +16,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WatchList.Migrations.SQLite
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WatchList.MudBlazors", "WatchList.MudBlazors\WatchList.MudBlazors.csproj", "{F1C2F716-B695-48AF-AAAA-C05D77D2868B}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchList.ASP.Net.Controllers", "WatchList.ASP.Net.Controllers\WatchList.ASP.Net.Controllers.csproj", "{BD4F2A24-8EDE-4C8F-A3B8-ECBEEF78F21B}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WatchList.ASP.Net.Controllers", "WatchList.ASP.Net.Controllers\WatchList.ASP.Net.Controllers.csproj", "{BD4F2A24-8EDE-4C8F-A3B8-ECBEEF78F21B}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WatchList.WPF", "WatchList.WPF\WatchList.WPF.csproj", "{FA27F47E-F9C6-48EE-AB8C-C46B18C53E15}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -48,6 +50,10 @@ Global
{BD4F2A24-8EDE-4C8F-A3B8-ECBEEF78F21B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BD4F2A24-8EDE-4C8F-A3B8-ECBEEF78F21B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BD4F2A24-8EDE-4C8F-A3B8-ECBEEF78F21B}.Release|Any CPU.Build.0 = Release|Any CPU
+ {FA27F47E-F9C6-48EE-AB8C-C46B18C53E15}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {FA27F47E-F9C6-48EE-AB8C-C46B18C53E15}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {FA27F47E-F9C6-48EE-AB8C-C46B18C53E15}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {FA27F47E-F9C6-48EE-AB8C-C46B18C53E15}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
From 87d8888b751db1ccea90d54a9c3f2d4b93785b87 Mon Sep 17 00:00:00 2001
From: Stan___Kudri <53861218+Stan-Kudri@users.noreply.github.com>
Date: Tue, 29 Oct 2024 00:03:25 +0300
Subject: [PATCH 2/2] WatchList.WPF - Fixed Linter.
---
WatchList.WPF/App.xaml.cs | 2 +-
WatchList.WPF/CinemaWindow.xaml.cs | 4 +---
WatchList.WPF/WatchList.WPF.csproj | 2 ++
WatchList.WPF/WindowBox/MessageBoxPage.xaml | 5 +----
4 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/WatchList.WPF/App.xaml.cs b/WatchList.WPF/App.xaml.cs
index d2c377a..b65ef12 100644
--- a/WatchList.WPF/App.xaml.cs
+++ b/WatchList.WPF/App.xaml.cs
@@ -16,7 +16,7 @@ namespace WatchList.WPF
///
/// Interaction logic for App.xaml
///
- public partial class App : Application
+ public partial class App : System.Windows.Application
{
private void Application_Startup(object sender, StartupEventArgs e)
{
diff --git a/WatchList.WPF/CinemaWindow.xaml.cs b/WatchList.WPF/CinemaWindow.xaml.cs
index 4d66f37..79424dd 100644
--- a/WatchList.WPF/CinemaWindow.xaml.cs
+++ b/WatchList.WPF/CinemaWindow.xaml.cs
@@ -7,18 +7,16 @@ namespace WatchList.WPF
///
public partial class CinemaWindow : Window
{
- IServiceProvider _serviceProvider;
+ private readonly IServiceProvider _serviceProvider;
public CinemaWindow(IServiceProvider serviceProvider)
{
_serviceProvider = serviceProvider;
-
InitializeComponent();
}
private void Button_Click(object sender, RoutedEventArgs e)
{
-
}
}
}
diff --git a/WatchList.WPF/WatchList.WPF.csproj b/WatchList.WPF/WatchList.WPF.csproj
index 64be435..c56e355 100644
--- a/WatchList.WPF/WatchList.WPF.csproj
+++ b/WatchList.WPF/WatchList.WPF.csproj
@@ -6,6 +6,8 @@
enable
enable
true
+ True
+ true
diff --git a/WatchList.WPF/WindowBox/MessageBoxPage.xaml b/WatchList.WPF/WindowBox/MessageBoxPage.xaml
index 6071c1c..a1e6162 100644
--- a/WatchList.WPF/WindowBox/MessageBoxPage.xaml
+++ b/WatchList.WPF/WindowBox/MessageBoxPage.xaml
@@ -7,8 +7,5 @@
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"
Title="MessageBoxPage">
-
-
-
-
+