add_reboot #4
|
|
@ -36,9 +36,9 @@
|
||||||
this.toolStrip1 = new System.Windows.Forms.ToolStrip();
|
this.toolStrip1 = new System.Windows.Forms.ToolStrip();
|
||||||
this.toolStripButton1 = new System.Windows.Forms.ToolStripButton();
|
this.toolStripButton1 = new System.Windows.Forms.ToolStripButton();
|
||||||
this.toolStripButton2 = 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.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
|
||||||
this.timer1 = new System.Windows.Forms.Timer(this.components);
|
this.timer1 = new System.Windows.Forms.Timer(this.components);
|
||||||
this.toolStripButton3 = new System.Windows.Forms.ToolStripButton();
|
|
||||||
this.toolStrip1.SuspendLayout();
|
this.toolStrip1.SuspendLayout();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
|
|
@ -98,6 +98,17 @@
|
||||||
this.toolStripButton2.Name = "toolStripButton2";
|
this.toolStripButton2.Name = "toolStripButton2";
|
||||||
this.toolStripButton2.Size = new System.Drawing.Size(58, 22);
|
this.toolStripButton2.Size = new System.Drawing.Size(58, 22);
|
||||||
this.toolStripButton2.Text = "История";
|
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 = "О программе";
|
||||||
//
|
//
|
||||||
// flowLayoutPanel1
|
// flowLayoutPanel1
|
||||||
//
|
//
|
||||||
|
|
@ -120,16 +131,6 @@
|
||||||
this.timer1.Interval = 1000;
|
this.timer1.Interval = 1000;
|
||||||
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
|
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
|
||||||
//
|
//
|
||||||
// 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 = "О программе";
|
|
||||||
//
|
|
||||||
// Form1
|
// Form1
|
||||||
//
|
//
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using Reseter2.History;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
|
|
@ -12,6 +13,7 @@ namespace Reseter2
|
||||||
{
|
{
|
||||||
public partial class Form1 : Form
|
public partial class Form1 : Form
|
||||||
{
|
{
|
||||||
|
private FormHistory formHistory;
|
||||||
public Form1()
|
public Form1()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
@ -35,5 +37,22 @@ namespace Reseter2
|
||||||
{
|
{
|
||||||
Reseter.Tick();
|
Reseter.Tick();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void toolStripButton2_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (formHistory == null)
|
||||||
|
{
|
||||||
|
formHistory = new FormHistory();
|
||||||
|
HistoryList.SetControl(formHistory);
|
||||||
|
formHistory.Show();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
formHistory.Activate();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,46 +0,0 @@
|
||||||
namespace Reseter2
|
|
||||||
{
|
|
||||||
partial class FormHistory
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Required designer variable.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clean up any resources being used.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Required method for Designer support - do not modify
|
|
||||||
/// the contents of this method with the code editor.
|
|
||||||
/// </summary>
|
|
||||||
private void InitializeComponent()
|
|
||||||
{
|
|
||||||
this.SuspendLayout();
|
|
||||||
//
|
|
||||||
// FormHistory
|
|
||||||
//
|
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.ClientSize = new System.Drawing.Size(403, 450);
|
|
||||||
this.Name = "FormHistory";
|
|
||||||
this.Text = "FormHistory";
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,20 +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
|
|
||||||
{
|
|
||||||
public FormHistory()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -0,0 +1,79 @@
|
||||||
|
namespace Reseter2
|
||||||
|
{
|
||||||
|
partial class FormHistory
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Reseter2.History
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
internal class HistoryItem
|
||||||
|
{
|
||||||
|
private IComp comp;
|
||||||
|
private ReseterTask task;
|
||||||
|
private AStatusTask statusTask;
|
||||||
|
private DateTime startTime;
|
||||||
|
public HistoryItem(IComp comp, AStatusTask statusTask, DateTime startTime)
|
||||||
|
{
|
||||||
|
this.comp = comp;
|
||||||
|
this.statusTask = statusTask;
|
||||||
|
this.startTime = startTime;
|
||||||
|
}
|
||||||
|
public HistoryItem(ReseterTask task)
|
||||||
|
{
|
||||||
|
this.comp = task.Comp;
|
||||||
|
this.task = task;
|
||||||
|
this.statusTask = task.StatusTask;
|
||||||
|
this.startTime = task.StartTime;
|
||||||
|
}
|
||||||
|
public SHistory GetData()
|
||||||
|
{
|
||||||
|
return new SHistory(comp.GetName(), startTime.ToShortTimeString(), statusTask.GetName());
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Reseter2.History
|
||||||
|
{
|
||||||
|
internal static class HistoryList
|
||||||
|
{
|
||||||
|
static private List<HistoryItem> Hitem;
|
||||||
|
static private FormHistory formHistory;
|
||||||
|
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()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Reseter2.History
|
||||||
|
{
|
||||||
|
internal struct SHistory
|
||||||
|
{
|
||||||
|
public string Name;
|
||||||
|
public string StartTime;
|
||||||
|
public string StatusTask;
|
||||||
|
public SHistory(string name, string startTime, string statusTask)
|
||||||
|
{
|
||||||
|
Name = name;
|
||||||
|
StartTime = startTime;
|
||||||
|
StatusTask = statusTask;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -15,6 +15,7 @@ namespace Reseter2
|
||||||
}
|
}
|
||||||
public abstract Task<PingResult> Tick();
|
public abstract Task<PingResult> Tick();
|
||||||
public abstract void Next();
|
public abstract void Next();
|
||||||
|
public abstract string GetName();
|
||||||
public void Stop() {
|
public void Stop() {
|
||||||
resetertask.StatusTask = new StatusRebootStop(resetertask);
|
resetertask.StatusTask = new StatusRebootStop(resetertask);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ namespace Reseter2
|
||||||
class ReseterTask
|
class ReseterTask
|
||||||
{
|
{
|
||||||
private Task<PingResult> task;
|
private Task<PingResult> task;
|
||||||
|
public DateTime StartTime = DateTime.Now;
|
||||||
public IComp Comp { get; }
|
public IComp Comp { get; }
|
||||||
public AStatusTask StatusTask { get; set; }
|
public AStatusTask StatusTask { get; set; }
|
||||||
private TaskControl taskControl;
|
private TaskControl taskControl;
|
||||||
|
|
|
||||||
|
|
@ -53,12 +53,15 @@
|
||||||
<Compile Include="Form1.Designer.cs">
|
<Compile Include="Form1.Designer.cs">
|
||||||
<DependentUpon>Form1.cs</DependentUpon>
|
<DependentUpon>Form1.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="FormHistory.cs">
|
<Compile Include="History\FormHistory.cs">
|
||||||
<SubType>Form</SubType>
|
<SubType>Form</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="FormHistory.Designer.cs">
|
<Compile Include="History\FormHistory.Designer.cs">
|
||||||
<DependentUpon>FormHistory.cs</DependentUpon>
|
<DependentUpon>FormHistory.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="History\HistoryItem.cs" />
|
||||||
|
<Compile Include="History\HistoryList.cs" />
|
||||||
|
<Compile Include="History\SHistory.cs" />
|
||||||
<Compile Include="IComp.cs" />
|
<Compile Include="IComp.cs" />
|
||||||
<Compile Include="IStatusTask.cs" />
|
<Compile Include="IStatusTask.cs" />
|
||||||
<Compile Include="Pinger.cs" />
|
<Compile Include="Pinger.cs" />
|
||||||
|
|
@ -82,7 +85,7 @@
|
||||||
<EmbeddedResource Include="Form1.resx">
|
<EmbeddedResource Include="Form1.resx">
|
||||||
<DependentUpon>Form1.cs</DependentUpon>
|
<DependentUpon>Form1.cs</DependentUpon>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
<EmbeddedResource Include="FormHistory.resx">
|
<EmbeddedResource Include="History\FormHistory.resx">
|
||||||
<DependentUpon>FormHistory.cs</DependentUpon>
|
<DependentUpon>FormHistory.cs</DependentUpon>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
<EmbeddedResource Include="Properties\Resources.resx">
|
<EmbeddedResource Include="Properties\Resources.resx">
|
||||||
|
|
@ -110,8 +113,6 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="App.config" />
|
<None Include="App.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup />
|
||||||
<Folder Include="NewFolder1\" />
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
</Project>
|
</Project>
|
||||||
|
|
@ -34,5 +34,9 @@ namespace Reseter2
|
||||||
resetertask.StatusTask = new StatusRebooting(resetertask);
|
resetertask.StatusTask = new StatusRebooting(resetertask);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public override string GetName()
|
||||||
|
{
|
||||||
|
return "Отправляем команду перезагрузки";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,5 +23,9 @@ namespace Reseter2
|
||||||
public override void Next()
|
public override void Next()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
public override string GetName()
|
||||||
|
{
|
||||||
|
return "Перезагрузка остановленна";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,5 +23,9 @@ namespace Reseter2
|
||||||
public override void Next()
|
public override void Next()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
public override string GetName()
|
||||||
|
{
|
||||||
|
return "Успешно перезагруженно";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,5 +32,9 @@ namespace Reseter2
|
||||||
resetertask.StatusTask = new StatusRebootSucces(resetertask);
|
resetertask.StatusTask = new StatusRebootSucces(resetertask);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public override string GetName()
|
||||||
|
{
|
||||||
|
return "Перезагрузка";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,10 @@ namespace Reseter2
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
public override string GetName()
|
||||||
|
{
|
||||||
|
return "Проверка связи";
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue