From e3268653ae25e9b16b6ef7ac418f127f91cce037 Mon Sep 17 00:00:00 2001 From: klavirshik Date: Mon, 5 Aug 2024 16:15:50 +0200 Subject: [PATCH] =?UTF-8?q?=D1=80=D0=B5=D0=B4=D0=B0=D0=BA=D1=82=D0=B8?= =?UTF-8?q?=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20=D1=81=D1=82=D0=B0?= =?UTF-8?q?=D1=82=D1=83=D1=81=D0=BE=D0=B2=20=20=D0=B2=D0=B8=D0=B4=D0=B0=20?= =?UTF-8?q?=D0=B8=D1=81=D1=82=D0=BE=D1=80=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Reseter2/Form1.Designer.cs | 157 ++++++++++++++--------- Reseter2/Form1.cs | 30 ++--- Reseter2/Form1.resx | 52 -------- Reseter2/History/FormHistory.Designer.cs | 79 ------------ Reseter2/History/FormHistory.cs | 36 ------ Reseter2/History/FormHistory.resx | 120 ----------------- Reseter2/History/HistoryItem.cs | 21 +++ Reseter2/History/HistoryList.cs | 30 +++-- Reseter2/IStatusTask.cs | 7 +- Reseter2/ReseteTask.cs | 5 +- Reseter2/Reseter2.csproj | 9 -- Reseter2/Shutdown.cs | 2 +- Reseter2/StatusReboot.cs | 8 +- Reseter2/StatusRebootStop.cs | 4 +- Reseter2/StatusRebootSucces.cs | 2 +- Reseter2/StatusRebooting.cs | 4 +- Reseter2/StausPreReboot.cs | 8 +- 17 files changed, 172 insertions(+), 402 deletions(-) delete mode 100644 Reseter2/History/FormHistory.Designer.cs delete mode 100644 Reseter2/History/FormHistory.cs delete mode 100644 Reseter2/History/FormHistory.resx diff --git a/Reseter2/Form1.Designer.cs b/Reseter2/Form1.Designer.cs index 77fa06a..6b49b9f 100644 --- a/Reseter2/Form1.Designer.cs +++ b/Reseter2/Form1.Designer.cs @@ -29,22 +29,25 @@ private void InitializeComponent() { this.components = new System.ComponentModel.Container(); - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1)); this.tb_comp = new System.Windows.Forms.TextBox(); this.label1 = new System.Windows.Forms.Label(); this.bt_reset = new System.Windows.Forms.Button(); - this.toolStrip1 = new System.Windows.Forms.ToolStrip(); - this.toolStripButton1 = new System.Windows.Forms.ToolStripButton(); - this.toolStripButton2 = new System.Windows.Forms.ToolStripButton(); - this.toolStripButton3 = new System.Windows.Forms.ToolStripButton(); - this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); this.timer1 = new System.Windows.Forms.Timer(this.components); - this.toolStrip1.SuspendLayout(); + this.tabControl1 = new System.Windows.Forms.TabControl(); + this.tabPage1 = new System.Windows.Forms.TabPage(); + this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); + this.tabPage2 = new System.Windows.Forms.TabPage(); + this.tabPage3 = new System.Windows.Forms.TabPage(); + this.tabPage4 = new System.Windows.Forms.TabPage(); + this.lb_history = new System.Windows.Forms.ListBox(); + this.tabControl1.SuspendLayout(); + this.tabPage1.SuspendLayout(); + this.tabPage3.SuspendLayout(); this.SuspendLayout(); // // tb_comp // - this.tb_comp.Location = new System.Drawing.Point(65, 33); + this.tb_comp.Location = new System.Drawing.Point(67, 12); this.tb_comp.Name = "tb_comp"; this.tb_comp.Size = new System.Drawing.Size(195, 20); this.tb_comp.TabIndex = 0; @@ -52,7 +55,7 @@ // label1 // this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(12, 36); + this.label1.Location = new System.Drawing.Point(14, 15); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(47, 13); this.label1.TabIndex = 1; @@ -61,7 +64,7 @@ // // bt_reset // - this.bt_reset.Location = new System.Drawing.Point(266, 31); + this.bt_reset.Location = new System.Drawing.Point(268, 10); this.bt_reset.Name = "bt_reset"; this.bt_reset.Size = new System.Drawing.Size(122, 23); this.bt_reset.TabIndex = 2; @@ -69,46 +72,37 @@ this.bt_reset.UseVisualStyleBackColor = true; this.bt_reset.Click += new System.EventHandler(this.bt_reset_Click); // - // toolStrip1 + // timer1 // - this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.toolStripButton1, - this.toolStripButton2, - this.toolStripButton3}); - this.toolStrip1.Location = new System.Drawing.Point(0, 0); - this.toolStrip1.Name = "toolStrip1"; - this.toolStrip1.Size = new System.Drawing.Size(394, 25); - this.toolStrip1.TabIndex = 3; - this.toolStrip1.Text = "toolStrip1"; + this.timer1.Enabled = true; + this.timer1.Interval = 1000; + this.timer1.Tick += new System.EventHandler(this.timer1_Tick); // - // toolStripButton1 + // tabControl1 // - this.toolStripButton1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; - this.toolStripButton1.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton1.Image"))); - this.toolStripButton1.ImageTransparentColor = System.Drawing.Color.Magenta; - this.toolStripButton1.Name = "toolStripButton1"; - this.toolStripButton1.Size = new System.Drawing.Size(54, 22); - this.toolStripButton1.Text = "Каталог"; + this.tabControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.tabControl1.Controls.Add(this.tabPage1); + this.tabControl1.Controls.Add(this.tabPage2); + this.tabControl1.Controls.Add(this.tabPage3); + this.tabControl1.Controls.Add(this.tabPage4); + this.tabControl1.Location = new System.Drawing.Point(2, 39); + this.tabControl1.Name = "tabControl1"; + this.tabControl1.SelectedIndex = 0; + this.tabControl1.Size = new System.Drawing.Size(410, 697); + this.tabControl1.TabIndex = 4; // - // toolStripButton2 + // tabPage1 // - this.toolStripButton2.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; - this.toolStripButton2.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton2.Image"))); - this.toolStripButton2.ImageTransparentColor = System.Drawing.Color.Magenta; - this.toolStripButton2.Name = "toolStripButton2"; - this.toolStripButton2.Size = new System.Drawing.Size(58, 22); - this.toolStripButton2.Text = "История"; - this.toolStripButton2.Click += new System.EventHandler(this.toolStripButton2_Click); - // - // toolStripButton3 - // - this.toolStripButton3.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; - this.toolStripButton3.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton3.Image"))); - this.toolStripButton3.ImageTransparentColor = System.Drawing.Color.Magenta; - this.toolStripButton3.Name = "toolStripButton3"; - this.toolStripButton3.RightToLeft = System.Windows.Forms.RightToLeft.No; - this.toolStripButton3.Size = new System.Drawing.Size(86, 22); - this.toolStripButton3.Text = "О программе"; + this.tabPage1.BackColor = System.Drawing.SystemColors.Control; + this.tabPage1.Controls.Add(this.flowLayoutPanel1); + this.tabPage1.Location = new System.Drawing.Point(4, 22); + this.tabPage1.Name = "tabPage1"; + this.tabPage1.Padding = new System.Windows.Forms.Padding(3); + this.tabPage1.Size = new System.Drawing.Size(402, 671); + this.tabPage1.TabIndex = 0; + this.tabPage1.Text = "Задания"; // // flowLayoutPanel1 // @@ -116,35 +110,68 @@ | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.flowLayoutPanel1.AutoScroll = true; - this.flowLayoutPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - this.flowLayoutPanel1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; - this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 67); + this.flowLayoutPanel1.Location = new System.Drawing.Point(3, 3); this.flowLayoutPanel1.Name = "flowLayoutPanel1"; - this.flowLayoutPanel1.Size = new System.Drawing.Size(394, 654); - this.flowLayoutPanel1.TabIndex = 4; + this.flowLayoutPanel1.Size = new System.Drawing.Size(396, 665); + this.flowLayoutPanel1.TabIndex = 0; this.flowLayoutPanel1.WrapContents = false; // - // timer1 + // tabPage2 // - this.timer1.Enabled = true; - this.timer1.Interval = 1000; - this.timer1.Tick += new System.EventHandler(this.timer1_Tick); + this.tabPage2.Location = new System.Drawing.Point(4, 22); + this.tabPage2.Name = "tabPage2"; + this.tabPage2.Padding = new System.Windows.Forms.Padding(3); + this.tabPage2.Size = new System.Drawing.Size(392, 671); + this.tabPage2.TabIndex = 1; + this.tabPage2.Text = "Справочник"; + this.tabPage2.UseVisualStyleBackColor = true; + // + // tabPage3 + // + this.tabPage3.Controls.Add(this.lb_history); + this.tabPage3.Location = new System.Drawing.Point(4, 22); + this.tabPage3.Name = "tabPage3"; + this.tabPage3.Padding = new System.Windows.Forms.Padding(3); + this.tabPage3.Size = new System.Drawing.Size(402, 671); + this.tabPage3.TabIndex = 2; + this.tabPage3.Text = "История"; + this.tabPage3.UseVisualStyleBackColor = true; + // + // tabPage4 + // + this.tabPage4.Location = new System.Drawing.Point(4, 22); + this.tabPage4.Name = "tabPage4"; + this.tabPage4.Padding = new System.Windows.Forms.Padding(3); + this.tabPage4.Size = new System.Drawing.Size(392, 671); + this.tabPage4.TabIndex = 3; + this.tabPage4.Text = "Настройки"; + this.tabPage4.UseVisualStyleBackColor = true; + // + // lb_history + // + this.lb_history.Dock = System.Windows.Forms.DockStyle.Fill; + this.lb_history.FormattingEnabled = true; + this.lb_history.Location = new System.Drawing.Point(3, 3); + this.lb_history.Name = "lb_history"; + this.lb_history.Size = new System.Drawing.Size(396, 665); + this.lb_history.TabIndex = 0; // // Form1 // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - this.ClientSize = new System.Drawing.Size(394, 717); - this.Controls.Add(this.flowLayoutPanel1); - this.Controls.Add(this.toolStrip1); + this.ClientSize = new System.Drawing.Size(410, 753); + this.Controls.Add(this.tabControl1); this.Controls.Add(this.bt_reset); this.Controls.Add(this.label1); this.Controls.Add(this.tb_comp); this.Name = "Form1"; this.Text = "Reseter2"; - this.toolStrip1.ResumeLayout(false); - this.toolStrip1.PerformLayout(); + + this.tabControl1.ResumeLayout(false); + this.tabPage1.ResumeLayout(false); + this.tabPage3.ResumeLayout(false); this.ResumeLayout(false); this.PerformLayout(); @@ -155,12 +182,14 @@ private System.Windows.Forms.TextBox tb_comp; private System.Windows.Forms.Label label1; private System.Windows.Forms.Button bt_reset; - private System.Windows.Forms.ToolStrip toolStrip1; - private System.Windows.Forms.ToolStripButton toolStripButton1; - private System.Windows.Forms.ToolStripButton toolStripButton2; - private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; private System.Windows.Forms.Timer timer1; - private System.Windows.Forms.ToolStripButton toolStripButton3; + private System.Windows.Forms.TabControl tabControl1; + private System.Windows.Forms.TabPage tabPage1; + private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; + private System.Windows.Forms.TabPage tabPage2; + private System.Windows.Forms.TabPage tabPage3; + private System.Windows.Forms.TabPage tabPage4; + private System.Windows.Forms.ListBox lb_history; } } diff --git a/Reseter2/Form1.cs b/Reseter2/Form1.cs index 9d4351c..6f01666 100644 --- a/Reseter2/Form1.cs +++ b/Reseter2/Form1.cs @@ -13,14 +13,20 @@ namespace Reseter2 { public partial class Form1 : Form { - private FormHistory formHistory; + //private FormHistory formHistory; + public bool Focus; public Form1() { + + InitializeComponent(); - flowLayoutPanel1.AutoScrollMinSize = new Size(0, 655) ; + flowLayoutPanel1.AutoScrollMinSize = new Size(0, 666) ; flowLayoutPanel1.VerticalScroll.Visible = true; Reseter.SetForm(flowLayoutPanel1); + HistoryList.Update += Update_lb; + lb_history.DataSource = HistoryList.Hitem; + lb_history.DisplayMember = "ToStr"; } private void label1_Click(object sender, EventArgs e) @@ -37,22 +43,12 @@ namespace Reseter2 { Reseter.Tick(); } - - private void toolStripButton2_Click(object sender, EventArgs e) + public void Update_lb() { - if (formHistory == null) - { - formHistory = new FormHistory(); - HistoryList.SetControl(formHistory); - formHistory.Show(); - } - else - { - - formHistory.Activate(); - } - - + lb_history.DataSource = null; + lb_history.DataSource = HistoryList.Hitem; + lb_history.DisplayMember = "ToStr"; } + } } diff --git a/Reseter2/Form1.resx b/Reseter2/Form1.resx index 64cda44..aeff474 100644 --- a/Reseter2/Form1.resx +++ b/Reseter2/Form1.resx @@ -117,58 +117,6 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 17, 17 - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG - YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9 - 0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw - bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc - VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9 - c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32 - Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo - mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+ - kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D - TgDQASA1MVpwzwAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG - YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9 - 0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw - bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc - VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9 - c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32 - Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo - mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+ - kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D - TgDQASA1MVpwzwAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG - YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9 - 0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw - bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc - VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9 - c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32 - Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo - mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+ - kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D - TgDQASA1MVpwzwAAAABJRU5ErkJggg== - - - - True - 122, 17 diff --git a/Reseter2/History/FormHistory.Designer.cs b/Reseter2/History/FormHistory.Designer.cs deleted file mode 100644 index 010ca8d..0000000 --- a/Reseter2/History/FormHistory.Designer.cs +++ /dev/null @@ -1,79 +0,0 @@ -namespace Reseter2 -{ - partial class FormHistory - { - /// - /// 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.button1 = new System.Windows.Forms.Button(); - this.TableHistory = new System.Windows.Forms.DataGridView(); - ((System.ComponentModel.ISupportInitialize)(this.TableHistory)).BeginInit(); - this.SuspendLayout(); - // - // button1 - // - this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.button1.Location = new System.Drawing.Point(316, 414); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(75, 23); - this.button1.TabIndex = 0; - this.button1.Text = "button1"; - this.button1.UseVisualStyleBackColor = true; - // - // TableHistory - // - this.TableHistory.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.TableHistory.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.TableHistory.Location = new System.Drawing.Point(0, 0); - this.TableHistory.Name = "TableHistory"; - this.TableHistory.RowHeadersVisible = false; - this.TableHistory.Size = new System.Drawing.Size(403, 409); - this.TableHistory.TabIndex = 1; - // - // FormHistory - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(403, 441); - this.Controls.Add(this.TableHistory); - this.Controls.Add(this.button1); - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "FormHistory"; - this.Text = "FormHistory"; - ((System.ComponentModel.ISupportInitialize)(this.TableHistory)).EndInit(); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.Button button1; - private System.Windows.Forms.DataGridView TableHistory; - } -} \ No newline at end of file diff --git a/Reseter2/History/FormHistory.cs b/Reseter2/History/FormHistory.cs deleted file mode 100644 index 38ed664..0000000 --- a/Reseter2/History/FormHistory.cs +++ /dev/null @@ -1,36 +0,0 @@ -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 Reseter2 -{ - public partial class FormHistory : Form - { - private DataTable dataTable; - private DataSet ds; - private DataRow row; - public FormHistory() - { - - InitializeComponent(); - ds = new DataSet(); - dataTable = new DataTable(); - TableHistory.DataSource = dataTable; - dataTable.Columns.Add("Время"); - dataTable.Columns.Add("Имя"); - dataTable.Columns.Add("Статус"); - ds.Tables.Add(dataTable); - row = dataTable.NewRow(); - row[0] = "12"; - row[1] = "123"; - row[2] = "12444"; - dataTable.Rows.Add(row); - } - } -} diff --git a/Reseter2/History/FormHistory.resx b/Reseter2/History/FormHistory.resx deleted file mode 100644 index 1af7de1..0000000 --- a/Reseter2/History/FormHistory.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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/Reseter2/History/HistoryItem.cs b/Reseter2/History/HistoryItem.cs index d1b1e36..576aa20 100644 --- a/Reseter2/History/HistoryItem.cs +++ b/Reseter2/History/HistoryItem.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Xml; namespace Reseter2.History { @@ -14,6 +15,7 @@ namespace Reseter2.History private ReseterTask task; private AStatusTask statusTask; private DateTime startTime; + private string statusName; public HistoryItem(IComp comp, AStatusTask statusTask, DateTime startTime) { this.comp = comp; @@ -32,5 +34,24 @@ namespace Reseter2.History return new SHistory(comp.GetName(), startTime.ToShortTimeString(), statusTask.GetName()); } + + public void ClearTask() + { + this.task = null; + this.statusTask = null; + } + public string ToStr + { + + get { + if (this.task != null) + { + this.statusTask = this.task.StatusTask; + this.statusName = this.statusTask.GetName(); + } + string output = string.Format("{0,5}|{1,10}|{2,10}", startTime.ToString(), comp.GetResetName(), this.statusName, startTime.ToString()); + return output; + } + } } } diff --git a/Reseter2/History/HistoryList.cs b/Reseter2/History/HistoryList.cs index 46f187d..20b6e05 100644 --- a/Reseter2/History/HistoryList.cs +++ b/Reseter2/History/HistoryList.cs @@ -1,30 +1,36 @@ using System; +using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Runtime.CompilerServices; using System.Text; using System.Threading.Tasks; +using System.Windows.Forms; namespace Reseter2.History { internal static class HistoryList { - static private List Hitem; - static private FormHistory formHistory; + static public List Hitem = new List(); + //static private FormHistory formHistory; + + public delegate void UpdateMethod(); + static public event UpdateMethod Update; static public HistoryItem Add(ReseterTask reseterTask) - { - HistoryItem historyItem = new HistoryItem(reseterTask); - Hitem.Add(historyItem); - return historyItem; - } - static public void SetControl(FormHistory formhistory) - { - formHistory = formhistory; - } - static public void Update() { + HistoryItem historyItem = new HistoryItem(reseterTask); + Hitem.Add(historyItem); + Update(); + + return historyItem; + } + static public void Updated() + { + Update(); + } + } } diff --git a/Reseter2/IStatusTask.cs b/Reseter2/IStatusTask.cs index 36c67c2..3d45be3 100644 --- a/Reseter2/IStatusTask.cs +++ b/Reseter2/IStatusTask.cs @@ -1,4 +1,5 @@ -using System; +using Reseter2.History; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -18,10 +19,14 @@ namespace Reseter2 public abstract string GetName(); public void Stop() { resetertask.StatusTask = new StatusRebootStop(resetertask); + HistoryList.Updated(); } public void RebootReturn() { + resetertask.historyItem.ClearTask(); resetertask.StatusTask = new StatusPreReboot(resetertask); + resetertask.historyItem = HistoryList.Add(resetertask); + HistoryList.Updated(); } } diff --git a/Reseter2/ReseteTask.cs b/Reseter2/ReseteTask.cs index f29e5b1..71bf687 100644 --- a/Reseter2/ReseteTask.cs +++ b/Reseter2/ReseteTask.cs @@ -1,4 +1,5 @@ -using System; +using Reseter2.History; +using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; @@ -18,6 +19,7 @@ namespace Reseter2 private Pinger Pingers; public Stopwatch sw = new Stopwatch(); public PingResult pingResult; + public HistoryItem historyItem; public ReseterTask(IComp comp, TaskControl taskCntrl) @@ -26,6 +28,7 @@ namespace Reseter2 taskControl = taskCntrl; StatusTask = new StatusPreReboot(this); Pingers = new Pinger(Comp.GetResetName()); + historyItem = HistoryList.Add(this); } public async Task Tick() diff --git a/Reseter2/Reseter2.csproj b/Reseter2/Reseter2.csproj index 39c273f..03106d2 100644 --- a/Reseter2/Reseter2.csproj +++ b/Reseter2/Reseter2.csproj @@ -53,12 +53,6 @@ Form1.cs - - Form - - - FormHistory.cs - @@ -85,9 +79,6 @@ Form1.cs - - FormHistory.cs - ResXFileCodeGenerator Resources.Designer.cs diff --git a/Reseter2/Shutdown.cs b/Reseter2/Shutdown.cs index cb61d79..4d0be46 100644 --- a/Reseter2/Shutdown.cs +++ b/Reseter2/Shutdown.cs @@ -18,7 +18,7 @@ namespace Reseter2 { if (param.Length > 0) { - MessageBox.Show(@"-r -m \\" + param + " -f -t 5"); + // MessageBox.Show(@"-r -m \\" + param + " -f -t 5"); StartShutDown(@"-r -m \\" + param + " -f -t 5"); } diff --git a/Reseter2/StatusReboot.cs b/Reseter2/StatusReboot.cs index 47539e8..ecb1bb9 100644 --- a/Reseter2/StatusReboot.cs +++ b/Reseter2/StatusReboot.cs @@ -1,4 +1,5 @@ -using System; +using Reseter2.History; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -14,7 +15,7 @@ namespace Reseter2 private PingResult PingResult = new PingResult(0, 0, null, false); public StatusReboot(ReseterTask reseterTask) : base(reseterTask) { - resetertask.SetNameStage("Отправляем команду перезагрузки"); + resetertask.SetNameStage("Отправка в перезагрузки"); Shutdown.RestartPC(reseterTask.Comp.GetResetName()); } @@ -32,11 +33,12 @@ namespace Reseter2 if (TimeCount > 3) { resetertask.StatusTask = new StatusRebooting(resetertask); + HistoryList.Updated(); } } public override string GetName() { - return "Отправляем команду перезагрузки"; + return "Отправка команды"; } } } diff --git a/Reseter2/StatusRebootStop.cs b/Reseter2/StatusRebootStop.cs index 3a62007..e9d9f42 100644 --- a/Reseter2/StatusRebootStop.cs +++ b/Reseter2/StatusRebootStop.cs @@ -11,7 +11,7 @@ namespace Reseter2 private PingResult PingResult; public StatusRebootStop(ReseterTask reseterTask) : base(reseterTask) { - resetertask.SetNameStage("Перезагрузка остановленна"); + resetertask.SetNameStage("Остановленно"); PingResult = resetertask.pingResult; reseterTask.sw.Stop(); } @@ -25,7 +25,7 @@ namespace Reseter2 } public override string GetName() { - return "Перезагрузка остановленна"; + return "Остановленно"; } } } diff --git a/Reseter2/StatusRebootSucces.cs b/Reseter2/StatusRebootSucces.cs index 0ebcb40..84a7210 100644 --- a/Reseter2/StatusRebootSucces.cs +++ b/Reseter2/StatusRebootSucces.cs @@ -25,7 +25,7 @@ namespace Reseter2 } public override string GetName() { - return "Успешно перезагруженно"; + return "Успешно"; } } } diff --git a/Reseter2/StatusRebooting.cs b/Reseter2/StatusRebooting.cs index afb13e0..5286d42 100644 --- a/Reseter2/StatusRebooting.cs +++ b/Reseter2/StatusRebooting.cs @@ -1,4 +1,5 @@ -using System; +using Reseter2.History; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -30,6 +31,7 @@ namespace Reseter2 if (TimeCount > 50) { resetertask.StatusTask = new StatusRebootSucces(resetertask); + HistoryList.Updated(); } } public override string GetName() diff --git a/Reseter2/StausPreReboot.cs b/Reseter2/StausPreReboot.cs index bb167a3..1d40e6c 100644 --- a/Reseter2/StausPreReboot.cs +++ b/Reseter2/StausPreReboot.cs @@ -1,4 +1,5 @@ -using System; +using Reseter2.History; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -26,10 +27,11 @@ namespace Reseter2 } public override void Next() { - if (!PingResult.TimedOut) + if (PingResult.TimedOut == false) { resetertask.StatusTask = new StatusReboot(resetertask); - } + HistoryList.Updated(); + } }