From 41c8d1ed1286a32b547b1288d6bf228b09319675 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=95=D0=BB=D0=B5=D0=BD=D0=B0=20=D0=91=D0=B0=D0=BA=D0=B0?= =?UTF-8?q?=D0=BB=D1=8C=D1=81=D0=BA=D0=B0=D1=8F?= Date: Tue, 23 Apr 2024 22:21:24 +0400 Subject: [PATCH] =?UTF-8?q?=D0=B4=D0=B2=D0=B5=20=D1=84=D0=BE=D1=80=D0=BC?= =?UTF-8?q?=D1=8B=20=D1=81=D0=BC=D0=B5=D1=88=D0=BD=D1=8B=D0=B5,=20=D0=BF?= =?UTF-8?q?=D0=BE=D0=B4=D0=BA=D0=BB=D1=8E=D1=87=D0=B5=D0=BD=D1=8B=20=D0=BF?= =?UTF-8?q?=D0=B0=D0=BA=D0=B5=D1=82=D1=8B=20=D0=B4=D0=BB=D1=8F=20=D0=B2?= =?UTF-8?q?=D0=BD=D0=B5=D0=B4=D1=80=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=B7=D0=B0?= =?UTF-8?q?=D0=B2=D0=B8=D1=81=D0=B8=D0=BC=D0=BE=D1=81=D1=82=D0=B5=D0=B9,?= =?UTF-8?q?=20=D0=BF=D1=80=D0=BE=D0=BF=D0=B8=D1=81=D0=B0=D0=BD=20=D1=81?= =?UTF-8?q?=D0=B5=D1=80=D0=B2=D0=B8=D1=81=20=D0=BF=D1=80=D0=BE=D0=B2=D0=B0?= =?UTF-8?q?=D0=B9=D0=B4=D0=B5=D1=80=20=D0=B2=20Program.cs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BeautySalon/BeautySalon.sln | 8 +- BeautySalon/BeautySalon/BeautySalon.csproj | 6 + BeautySalon/BeautySalon/FormHello.Designer.cs | 64 ++++++++++ BeautySalon/BeautySalon/FormHello.cs | 32 +++++ BeautySalon/BeautySalon/FormHello.resx | 120 ++++++++++++++++++ BeautySalon/BeautySalon/FormMain.Designer.cs | 39 ++++++ BeautySalon/BeautySalon/FormMain.cs | 20 +++ BeautySalon/BeautySalon/FormMain.resx | 120 ++++++++++++++++++ BeautySalon/BeautySalon/Program.cs | 27 +++- .../BeautySalonDBModels.csproj | 13 ++ 10 files changed, 447 insertions(+), 2 deletions(-) create mode 100644 BeautySalon/BeautySalon/FormHello.Designer.cs create mode 100644 BeautySalon/BeautySalon/FormHello.cs create mode 100644 BeautySalon/BeautySalon/FormHello.resx create mode 100644 BeautySalon/BeautySalon/FormMain.Designer.cs create mode 100644 BeautySalon/BeautySalon/FormMain.cs create mode 100644 BeautySalon/BeautySalon/FormMain.resx create mode 100644 BeautySalon/BeautySalonDBModels/BeautySalonDBModels.csproj diff --git a/BeautySalon/BeautySalon.sln b/BeautySalon/BeautySalon.sln index 4c799c5..509795c 100644 --- a/BeautySalon/BeautySalon.sln +++ b/BeautySalon/BeautySalon.sln @@ -3,7 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.9.34714.143 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BeautySalon", "BeautySalon\BeautySalon.csproj", "{1F929511-ADDE-4469-80EE-564D8A9C4F13}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BeautySalon", "BeautySalon\BeautySalon.csproj", "{1F929511-ADDE-4469-80EE-564D8A9C4F13}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BeautySalonDBModels", "BeautySalonDBModels\BeautySalonDBModels.csproj", "{1EF50F69-B58A-4D5B-85A4-FD184ABEFE5E}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -15,6 +17,10 @@ Global {1F929511-ADDE-4469-80EE-564D8A9C4F13}.Debug|Any CPU.Build.0 = Debug|Any CPU {1F929511-ADDE-4469-80EE-564D8A9C4F13}.Release|Any CPU.ActiveCfg = Release|Any CPU {1F929511-ADDE-4469-80EE-564D8A9C4F13}.Release|Any CPU.Build.0 = Release|Any CPU + {1EF50F69-B58A-4D5B-85A4-FD184ABEFE5E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1EF50F69-B58A-4D5B-85A4-FD184ABEFE5E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1EF50F69-B58A-4D5B-85A4-FD184ABEFE5E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1EF50F69-B58A-4D5B-85A4-FD184ABEFE5E}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/BeautySalon/BeautySalon/BeautySalon.csproj b/BeautySalon/BeautySalon/BeautySalon.csproj index 663fdb8..783d4c0 100644 --- a/BeautySalon/BeautySalon/BeautySalon.csproj +++ b/BeautySalon/BeautySalon/BeautySalon.csproj @@ -8,4 +8,10 @@ enable + + + + + + \ No newline at end of file diff --git a/BeautySalon/BeautySalon/FormHello.Designer.cs b/BeautySalon/BeautySalon/FormHello.Designer.cs new file mode 100644 index 0000000..63ec819 --- /dev/null +++ b/BeautySalon/BeautySalon/FormHello.Designer.cs @@ -0,0 +1,64 @@ +namespace BeautySalon +{ + partial class FormHello + { + /// + /// 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() + { + buttonOpen = new Button(); + SuspendLayout(); + // + // buttonOpen + // + buttonOpen.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; + buttonOpen.BackColor = Color.Teal; + buttonOpen.Font = new Font("Candara", 13.8F, FontStyle.Regular, GraphicsUnit.Point, 204); + buttonOpen.ForeColor = SystemColors.ButtonHighlight; + buttonOpen.Location = new Point(333, 193); + buttonOpen.Name = "buttonOpen"; + buttonOpen.Size = new Size(213, 83); + buttonOpen.TabIndex = 0; + buttonOpen.Text = "Войти в салон"; + buttonOpen.UseVisualStyleBackColor = false; + buttonOpen.Click += buttonOpen_Click; + // + // FormHello + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + BackColor = Color.FromArgb(192, 255, 255); + ClientSize = new Size(837, 462); + Controls.Add(buttonOpen); + Name = "FormHello"; + Text = "FormHello"; + ResumeLayout(false); + } + + #endregion + + private Button buttonOpen; + } +} \ No newline at end of file diff --git a/BeautySalon/BeautySalon/FormHello.cs b/BeautySalon/BeautySalon/FormHello.cs new file mode 100644 index 0000000..0fe2ce5 --- /dev/null +++ b/BeautySalon/BeautySalon/FormHello.cs @@ -0,0 +1,32 @@ +using Microsoft.Extensions.Logging; +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 BeautySalon +{ + public partial class FormHello : Form + { + private readonly ILogger logger; + public FormHello(ILogger logger) + { + this.logger = logger; + InitializeComponent(); + } + + private void buttonOpen_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormMain)); + if (service is FormMain form ) + { + form.ShowDialog(); + } + } + } +} diff --git a/BeautySalon/BeautySalon/FormHello.resx b/BeautySalon/BeautySalon/FormHello.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/BeautySalon/BeautySalon/FormHello.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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/BeautySalon/BeautySalon/FormMain.Designer.cs b/BeautySalon/BeautySalon/FormMain.Designer.cs new file mode 100644 index 0000000..248a5c3 --- /dev/null +++ b/BeautySalon/BeautySalon/FormMain.Designer.cs @@ -0,0 +1,39 @@ +namespace BeautySalon +{ + partial class FormMain + { + /// + /// 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.components = new System.ComponentModel.Container(); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(800, 450); + this.Text = "FormMain"; + } + + #endregion + } +} \ No newline at end of file diff --git a/BeautySalon/BeautySalon/FormMain.cs b/BeautySalon/BeautySalon/FormMain.cs new file mode 100644 index 0000000..0626836 --- /dev/null +++ b/BeautySalon/BeautySalon/FormMain.cs @@ -0,0 +1,20 @@ +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 BeautySalon +{ + public partial class FormMain : Form + { + public FormMain() + { + InitializeComponent(); + } + } +} diff --git a/BeautySalon/BeautySalon/FormMain.resx b/BeautySalon/BeautySalon/FormMain.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/BeautySalon/BeautySalon/FormMain.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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/BeautySalon/BeautySalon/Program.cs b/BeautySalon/BeautySalon/Program.cs index d8ac575..cffe55f 100644 --- a/BeautySalon/BeautySalon/Program.cs +++ b/BeautySalon/BeautySalon/Program.cs @@ -1,7 +1,14 @@ +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; +using NLog.Extensions.Logging; +using System.Text; + namespace BeautySalon { internal static class Program { + private static ServiceProvider? _serviceProvider; + public static ServiceProvider? ServiceProvider => _serviceProvider; /// /// The main entry point for the application. /// @@ -11,7 +18,25 @@ namespace BeautySalon // To customize application configuration such as set high DPI settings or default font, // see https://aka.ms/applicationconfiguration. ApplicationConfiguration.Initialize(); - Application.Run(new Form1()); + var services = new ServiceCollection(); + // PDF + // NuGet System.Text.Encoding.CodePages + Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); + ConfigureServices(services); + _serviceProvider = services.BuildServiceProvider(); + Application.Run(_serviceProvider.GetRequiredService()); + } + + private static void ConfigureServices(ServiceCollection services) + { + services.AddLogging(option => + { + option.SetMinimumLevel(LogLevel.Information); + option.AddNLog("nlog.config"); + }); + ////services.AddTransient(); + services.AddTransient(); + services.AddTransient(); } } } \ No newline at end of file diff --git a/BeautySalon/BeautySalonDBModels/BeautySalonDBModels.csproj b/BeautySalon/BeautySalonDBModels/BeautySalonDBModels.csproj new file mode 100644 index 0000000..a578900 --- /dev/null +++ b/BeautySalon/BeautySalonDBModels/BeautySalonDBModels.csproj @@ -0,0 +1,13 @@ + + + + net8.0 + enable + enable + + + + + + +