From c44012c58c28246a1a79e080b48ddf31fc91ec06 Mon Sep 17 00:00:00 2001
From: abazov73 <92822431+abazov73@users.noreply.github.com>
Date: Thu, 16 Nov 2023 23:49:40 +0400
Subject: [PATCH] Lab03: Add interests view
---
.../AbazovViewComponents.csproj | 1 +
AbazovApp/AccountsApp/AccountsApp.csproj | 16 +++
AbazovApp/AccountsApp/FormAccount.Designer.cs | 46 +++++++
AbazovApp/AccountsApp/FormAccount.cs | 20 +++
AbazovApp/AccountsApp/FormAccount.resx | 60 +++++++++
.../AccountsApp/FormInterests.Designer.cs | 90 +++++++++++++
AbazovApp/AccountsApp/FormInterests.cs | 104 +++++++++++++++
AbazovApp/AccountsApp/FormInterests.resx | 66 +++++++++
AbazovApp/AccountsApp/FormMain.Designer.cs | 125 +++++++++++++++++-
AbazovApp/AccountsApp/FormMain.cs | 21 +++
AbazovApp/AccountsApp/FormMain.resx | 3 +
AbazovApp/AccountsApp/Program.cs | 26 +++-
.../Properties/Resources.Designer.cs | 63 +++++++++
.../AccountsApp/Properties/Resources.resx | 120 +++++++++++++++++
14 files changed, 759 insertions(+), 2 deletions(-)
create mode 100644 AbazovApp/AccountsApp/FormAccount.Designer.cs
create mode 100644 AbazovApp/AccountsApp/FormAccount.cs
create mode 100644 AbazovApp/AccountsApp/FormAccount.resx
create mode 100644 AbazovApp/AccountsApp/FormInterests.Designer.cs
create mode 100644 AbazovApp/AccountsApp/FormInterests.cs
create mode 100644 AbazovApp/AccountsApp/FormInterests.resx
create mode 100644 AbazovApp/AccountsApp/Properties/Resources.Designer.cs
create mode 100644 AbazovApp/AccountsApp/Properties/Resources.resx
diff --git a/AbazovApp/AbazovViewComponents/AbazovViewComponents.csproj b/AbazovApp/AbazovViewComponents/AbazovViewComponents.csproj
index 37c6f6a..6880b53 100644
--- a/AbazovApp/AbazovViewComponents/AbazovViewComponents.csproj
+++ b/AbazovApp/AbazovViewComponents/AbazovViewComponents.csproj
@@ -5,6 +5,7 @@
enable
true
enable
+ True
diff --git a/AbazovApp/AccountsApp/AccountsApp.csproj b/AbazovApp/AccountsApp/AccountsApp.csproj
index cb91785..cbcc800 100644
--- a/AbazovApp/AccountsApp/AccountsApp.csproj
+++ b/AbazovApp/AccountsApp/AccountsApp.csproj
@@ -19,7 +19,23 @@
+
+
+
+ True
+ True
+ Resources.resx
+
+
+
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+
+
+
\ No newline at end of file
diff --git a/AbazovApp/AccountsApp/FormAccount.Designer.cs b/AbazovApp/AccountsApp/FormAccount.Designer.cs
new file mode 100644
index 0000000..541fb89
--- /dev/null
+++ b/AbazovApp/AccountsApp/FormAccount.Designer.cs
@@ -0,0 +1,46 @@
+namespace AccountsApp
+{
+ partial class FormAccount
+ {
+ ///
+ /// 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();
+ //
+ // FormAccount
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(800, 450);
+ this.Name = "FormAccount";
+ this.Text = "Аккаунт";
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/AbazovApp/AccountsApp/FormAccount.cs b/AbazovApp/AccountsApp/FormAccount.cs
new file mode 100644
index 0000000..8d117db
--- /dev/null
+++ b/AbazovApp/AccountsApp/FormAccount.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 AccountsApp
+{
+ public partial class FormAccount : Form
+ {
+ public FormAccount()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/AbazovApp/AccountsApp/FormAccount.resx b/AbazovApp/AccountsApp/FormAccount.resx
new file mode 100644
index 0000000..f298a7b
--- /dev/null
+++ b/AbazovApp/AccountsApp/FormAccount.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/AbazovApp/AccountsApp/FormInterests.Designer.cs b/AbazovApp/AccountsApp/FormInterests.Designer.cs
new file mode 100644
index 0000000..0d91e8c
--- /dev/null
+++ b/AbazovApp/AccountsApp/FormInterests.Designer.cs
@@ -0,0 +1,90 @@
+namespace AccountsApp
+{
+ partial class FormInterests
+ {
+ ///
+ /// 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.dataGridView = new System.Windows.Forms.DataGridView();
+ this.NameCol = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ this.Id = new System.Windows.Forms.DataGridViewTextBoxColumn();
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
+ this.SuspendLayout();
+ //
+ // dataGridView
+ //
+ this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ this.dataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
+ this.NameCol,
+ this.Id});
+ this.dataGridView.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.dataGridView.Location = new System.Drawing.Point(0, 0);
+ this.dataGridView.Name = "dataGridView";
+ this.dataGridView.RowHeadersWidth = 51;
+ this.dataGridView.RowTemplate.Height = 29;
+ this.dataGridView.Size = new System.Drawing.Size(613, 304);
+ this.dataGridView.TabIndex = 0;
+ this.dataGridView.CellValueChanged += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView_CellValueChanged);
+ this.dataGridView.UserDeletingRow += new System.Windows.Forms.DataGridViewRowCancelEventHandler(this.dataGridView_UserDeletingRow);
+ this.dataGridView.KeyUp += new System.Windows.Forms.KeyEventHandler(this.dataGridView_KeyUp);
+ //
+ // NameCol
+ //
+ this.NameCol.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
+ this.NameCol.HeaderText = "Название";
+ this.NameCol.MinimumWidth = 6;
+ this.NameCol.Name = "NameCol";
+ //
+ // Id
+ //
+ this.Id.HeaderText = "Id";
+ this.Id.MinimumWidth = 6;
+ this.Id.Name = "Id";
+ this.Id.Visible = false;
+ this.Id.Width = 125;
+ //
+ // FormInterests
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.BackColor = System.Drawing.Color.White;
+ this.ClientSize = new System.Drawing.Size(613, 304);
+ this.Controls.Add(this.dataGridView);
+ this.Name = "FormInterests";
+ this.Text = "Интересы";
+ this.Load += new System.EventHandler(this.FormInterests_Load);
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private DataGridView dataGridView;
+ private DataGridViewTextBoxColumn NameCol;
+ private DataGridViewTextBoxColumn Id;
+ }
+}
\ No newline at end of file
diff --git a/AbazovApp/AccountsApp/FormInterests.cs b/AbazovApp/AccountsApp/FormInterests.cs
new file mode 100644
index 0000000..c4ca6e6
--- /dev/null
+++ b/AbazovApp/AccountsApp/FormInterests.cs
@@ -0,0 +1,104 @@
+using AccountsContracts.BindingModels;
+using AccountsContracts.BusinessLogicContracts;
+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 AccountsApp
+{
+ public partial class FormInterests : Form
+ {
+ private readonly IInterestLogic _logic;
+ private bool loading = false;
+
+ public FormInterests(IInterestLogic logic)
+ {
+ InitializeComponent();
+ _logic = logic;
+ }
+
+ private void FormInterests_Load(object sender, EventArgs e)
+ {
+ LoadData();
+ }
+
+ private void LoadData()
+ {
+ loading = true;
+ try
+ {
+ var list = _logic.ReadList(null);
+ if (list != null)
+ {
+ foreach (var interest in list)
+ {
+ int rowIndex = dataGridView.Rows.Add();
+ dataGridView.Rows[rowIndex].Cells[0].Value = interest.Name;
+ dataGridView.Rows[rowIndex].Cells[1].Value = interest.Id;
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ finally
+ {
+ loading = false;
+ }
+ }
+
+ private void dataGridView_CellValueChanged(object sender, DataGridViewCellEventArgs e)
+ {
+ if (loading || e.RowIndex < 0 || e.ColumnIndex != 0) return;
+ if (dataGridView.Rows[e.RowIndex].Cells[1].Value != null && !string.IsNullOrEmpty(dataGridView.Rows[e.RowIndex].Cells[1].Value.ToString()))
+ {
+ var name = dataGridView.Rows[e.RowIndex].Cells[e.ColumnIndex].Value;
+ if (name is null) return;
+ _logic.Update(new InterestBindingModel { Id = Convert.ToInt32(dataGridView.Rows[e.RowIndex].Cells[1].Value), Name = name.ToString() });
+ }
+ else
+ {
+ var name = dataGridView.Rows[e.RowIndex].Cells[e.ColumnIndex].Value;
+ if (name is null) return;
+ _logic.Create(new InterestBindingModel { Id = 0, Name = name.ToString() });
+ int newInterestId = _logic.ReadList(null).ToList().Last().Id;
+ dataGridView.Rows[e.RowIndex].Cells[1].Value = newInterestId;
+ }
+ }
+
+ private void dataGridView_KeyUp(object sender, KeyEventArgs e)
+ {
+ switch (e.KeyCode)
+ {
+ case Keys.Insert:
+ dataGridView.Rows.Add();
+ break;
+ }
+ }
+
+ private void deleteRows(DataGridViewSelectedRowCollection rows)
+ {
+ for (int i = 0; i < rows.Count; i++)
+ {
+ DataGridViewRow row = rows[i];
+ if (!_logic.Delete(new InterestBindingModel { Id = Convert.ToInt32(row.Cells[1].Value) })) continue;
+ dataGridView.Rows.Remove(row);
+ }
+ }
+
+ private void dataGridView_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e)
+ {
+ e.Cancel = true;
+ if (dataGridView.SelectedRows == null) return;
+ if (MessageBox.Show("Удалить записи?", "Подтвердите действие", MessageBoxButtons.YesNo) == DialogResult.No) return;
+ deleteRows(dataGridView.SelectedRows);
+ }
+ }
+}
diff --git a/AbazovApp/AccountsApp/FormInterests.resx b/AbazovApp/AccountsApp/FormInterests.resx
new file mode 100644
index 0000000..c68f54e
--- /dev/null
+++ b/AbazovApp/AccountsApp/FormInterests.resx
@@ -0,0 +1,66 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 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
+
+
+ True
+
+
+ True
+
+
\ No newline at end of file
diff --git a/AbazovApp/AccountsApp/FormMain.Designer.cs b/AbazovApp/AccountsApp/FormMain.Designer.cs
index 0318f8b..6b8d611 100644
--- a/AbazovApp/AccountsApp/FormMain.Designer.cs
+++ b/AbazovApp/AccountsApp/FormMain.Designer.cs
@@ -28,19 +28,142 @@
///
private void InitializeComponent()
{
+ this.controlDataTableAccounts = new ControlsLibraryNet60.Data.ControlDataTableTable();
+ this.menuStrip1 = new System.Windows.Forms.MenuStrip();
+ this.аккаунтыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.создатьToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.редактироватьToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.удалитьToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.отчётыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.документToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.документСТаблицейToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.документСДиаграммойToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.интересыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.menuStrip1.SuspendLayout();
this.SuspendLayout();
//
+ // controlDataTableAccounts
+ //
+ this.controlDataTableAccounts.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.controlDataTableAccounts.Location = new System.Drawing.Point(0, 28);
+ this.controlDataTableAccounts.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
+ this.controlDataTableAccounts.Name = "controlDataTableAccounts";
+ this.controlDataTableAccounts.SelectedRowIndex = -1;
+ this.controlDataTableAccounts.Size = new System.Drawing.Size(800, 422);
+ this.controlDataTableAccounts.TabIndex = 0;
+ //
+ // menuStrip1
+ //
+ this.menuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
+ this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.аккаунтыToolStripMenuItem,
+ this.отчётыToolStripMenuItem,
+ this.интересыToolStripMenuItem});
+ this.menuStrip1.Location = new System.Drawing.Point(0, 0);
+ this.menuStrip1.Name = "menuStrip1";
+ this.menuStrip1.Size = new System.Drawing.Size(800, 28);
+ this.menuStrip1.TabIndex = 1;
+ this.menuStrip1.Text = "menuStrip1";
+ //
+ // аккаунтыToolStripMenuItem
+ //
+ this.аккаунтыToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.создатьToolStripMenuItem,
+ this.редактироватьToolStripMenuItem,
+ this.удалитьToolStripMenuItem});
+ this.аккаунтыToolStripMenuItem.Name = "аккаунтыToolStripMenuItem";
+ this.аккаунтыToolStripMenuItem.Size = new System.Drawing.Size(88, 24);
+ this.аккаунтыToolStripMenuItem.Text = "Аккаунты";
+ //
+ // создатьToolStripMenuItem
+ //
+ this.создатьToolStripMenuItem.Name = "создатьToolStripMenuItem";
+ this.создатьToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.A)));
+ this.создатьToolStripMenuItem.Size = new System.Drawing.Size(246, 26);
+ this.создатьToolStripMenuItem.Text = "Создать";
+ this.создатьToolStripMenuItem.Click += new System.EventHandler(this.создатьToolStripMenuItem_Click);
+ //
+ // редактироватьToolStripMenuItem
+ //
+ this.редактироватьToolStripMenuItem.Name = "редактироватьToolStripMenuItem";
+ this.редактироватьToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.U)));
+ this.редактироватьToolStripMenuItem.Size = new System.Drawing.Size(246, 26);
+ this.редактироватьToolStripMenuItem.Text = "Редактировать";
+ //
+ // удалитьToolStripMenuItem
+ //
+ this.удалитьToolStripMenuItem.Name = "удалитьToolStripMenuItem";
+ this.удалитьToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.D)));
+ this.удалитьToolStripMenuItem.Size = new System.Drawing.Size(246, 26);
+ this.удалитьToolStripMenuItem.Text = "Удалить";
+ //
+ // отчётыToolStripMenuItem
+ //
+ this.отчётыToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.документToolStripMenuItem,
+ this.документСТаблицейToolStripMenuItem,
+ this.документСДиаграммойToolStripMenuItem});
+ this.отчётыToolStripMenuItem.Name = "отчётыToolStripMenuItem";
+ this.отчётыToolStripMenuItem.Size = new System.Drawing.Size(73, 24);
+ this.отчётыToolStripMenuItem.Text = "Отчёты";
+ //
+ // документToolStripMenuItem
+ //
+ this.документToolStripMenuItem.Name = "документToolStripMenuItem";
+ this.документToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S)));
+ this.документToolStripMenuItem.Size = new System.Drawing.Size(313, 26);
+ this.документToolStripMenuItem.Text = "Документ";
+ //
+ // документСТаблицейToolStripMenuItem
+ //
+ this.документСТаблицейToolStripMenuItem.Name = "документСТаблицейToolStripMenuItem";
+ this.документСТаблицейToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.T)));
+ this.документСТаблицейToolStripMenuItem.Size = new System.Drawing.Size(313, 26);
+ this.документСТаблицейToolStripMenuItem.Text = "Документ с таблицей";
+ //
+ // документСДиаграммойToolStripMenuItem
+ //
+ this.документСДиаграммойToolStripMenuItem.Name = "документСДиаграммойToolStripMenuItem";
+ this.документСДиаграммойToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.C)));
+ this.документСДиаграммойToolStripMenuItem.Size = new System.Drawing.Size(313, 26);
+ this.документСДиаграммойToolStripMenuItem.Text = "Документ с диаграммой";
+ //
+ // интересыToolStripMenuItem
+ //
+ this.интересыToolStripMenuItem.Name = "интересыToolStripMenuItem";
+ this.интересыToolStripMenuItem.Size = new System.Drawing.Size(92, 24);
+ this.интересыToolStripMenuItem.Text = "Интересы";
+ this.интересыToolStripMenuItem.Click += new System.EventHandler(this.интересыToolStripMenuItem_Click);
+ //
// FormMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
+ this.Controls.Add(this.controlDataTableAccounts);
+ this.Controls.Add(this.menuStrip1);
+ this.MainMenuStrip = this.menuStrip1;
this.Name = "FormMain";
- this.Text = "FormMain";
+ this.Text = "Аккаунты";
+ this.menuStrip1.ResumeLayout(false);
+ this.menuStrip1.PerformLayout();
this.ResumeLayout(false);
+ this.PerformLayout();
}
#endregion
+
+ private ControlsLibraryNet60.Data.ControlDataTableTable controlDataTableAccounts;
+ private MenuStrip menuStrip1;
+ private ToolStripMenuItem аккаунтыToolStripMenuItem;
+ private ToolStripMenuItem создатьToolStripMenuItem;
+ private ToolStripMenuItem редактироватьToolStripMenuItem;
+ private ToolStripMenuItem удалитьToolStripMenuItem;
+ private ToolStripMenuItem отчётыToolStripMenuItem;
+ private ToolStripMenuItem документToolStripMenuItem;
+ private ToolStripMenuItem документСТаблицейToolStripMenuItem;
+ private ToolStripMenuItem документСДиаграммойToolStripMenuItem;
+ private ToolStripMenuItem интересыToolStripMenuItem;
}
}
\ No newline at end of file
diff --git a/AbazovApp/AccountsApp/FormMain.cs b/AbazovApp/AccountsApp/FormMain.cs
index fec03cc..1dacfd5 100644
--- a/AbazovApp/AccountsApp/FormMain.cs
+++ b/AbazovApp/AccountsApp/FormMain.cs
@@ -16,5 +16,26 @@ namespace AccountsApp
{
InitializeComponent();
}
+
+ private void создатьToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormAccount));
+ if (service is FormAccount form)
+ {
+ if (form.ShowDialog() == DialogResult.OK)
+ {
+
+ }
+ }
+ }
+
+ private void интересыToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormInterests));
+ if (service is FormInterests form)
+ {
+ form.ShowDialog();
+ }
+ }
}
}
diff --git a/AbazovApp/AccountsApp/FormMain.resx b/AbazovApp/AccountsApp/FormMain.resx
index f298a7b..938108a 100644
--- a/AbazovApp/AccountsApp/FormMain.resx
+++ b/AbazovApp/AccountsApp/FormMain.resx
@@ -57,4 +57,7 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ 17, 17
+
\ No newline at end of file
diff --git a/AbazovApp/AccountsApp/Program.cs b/AbazovApp/AccountsApp/Program.cs
index 313a10f..8ac456f 100644
--- a/AbazovApp/AccountsApp/Program.cs
+++ b/AbazovApp/AccountsApp/Program.cs
@@ -1,7 +1,17 @@
+using AccountsBusinessLogic.BusinessLogics;
+using AccountsContracts.BusinessLogicContracts;
+using AccountsContracts.StorageContracts;
+using AccountsDataBaseImplement.Implements;
+using Microsoft.Extensions.DependencyInjection;
+using System;
+
namespace AccountsApp
{
internal static class Program
{
+ private static ServiceProvider? _serviceProvider;
+ public static ServiceProvider? ServiceProvider => _serviceProvider;
+
///
/// The main entry point for the application.
///
@@ -11,7 +21,21 @@ namespace AccountsApp
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
- Application.Run(new FormMain());
+ var services = new ServiceCollection();
+ ConfigureServices(services);
+ _serviceProvider = services.BuildServiceProvider();
+ Application.Run(_serviceProvider.GetRequiredService());
+ }
+
+ private static void ConfigureServices(ServiceCollection services)
+ {
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
}
}
}
\ No newline at end of file
diff --git a/AbazovApp/AccountsApp/Properties/Resources.Designer.cs b/AbazovApp/AccountsApp/Properties/Resources.Designer.cs
new file mode 100644
index 0000000..2f8ddee
--- /dev/null
+++ b/AbazovApp/AccountsApp/Properties/Resources.Designer.cs
@@ -0,0 +1,63 @@
+//------------------------------------------------------------------------------
+//
+// Этот код создан программой.
+// Исполняемая версия:4.0.30319.42000
+//
+// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
+// повторной генерации кода.
+//
+//------------------------------------------------------------------------------
+
+namespace AccountsApp.Properties {
+ using System;
+
+
+ ///
+ /// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д.
+ ///
+ // Этот класс создан автоматически классом StronglyTypedResourceBuilder
+ // с помощью такого средства, как ResGen или Visual Studio.
+ // Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen
+ // с параметром /str или перестройте свой проект VS.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal 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() {
+ }
+
+ ///
+ /// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("AccountsApp.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// Перезаписывает свойство CurrentUICulture текущего потока для всех
+ /// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+ }
+}
diff --git a/AbazovApp/AccountsApp/Properties/Resources.resx b/AbazovApp/AccountsApp/Properties/Resources.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/AbazovApp/AccountsApp/Properties/Resources.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