add_reboot #4
|
|
@ -11,6 +11,11 @@ namespace Reseter2
|
||||||
private string Name { get; set; }
|
private string Name { get; set; }
|
||||||
private string Description { get; set; }
|
private string Description { get; set; }
|
||||||
private string Ip { get; set; }
|
private string Ip { get; set; }
|
||||||
|
|
||||||
|
public CompId(string name)
|
||||||
|
{
|
||||||
|
this.Name = name;
|
||||||
|
}
|
||||||
public CompId(string name, string description)
|
public CompId(string name, string description)
|
||||||
{
|
{
|
||||||
this.Name = name;
|
this.Name = name;
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
|
this.components = new System.ComponentModel.Container();
|
||||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
|
||||||
this.tb_comp = new System.Windows.Forms.TextBox();
|
this.tb_comp = new System.Windows.Forms.TextBox();
|
||||||
this.label1 = new System.Windows.Forms.Label();
|
this.label1 = new System.Windows.Forms.Label();
|
||||||
|
|
@ -36,6 +37,7 @@
|
||||||
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.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
|
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
|
||||||
|
this.timer1 = new System.Windows.Forms.Timer(this.components);
|
||||||
this.toolStrip1.SuspendLayout();
|
this.toolStrip1.SuspendLayout();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
|
|
@ -64,6 +66,7 @@
|
||||||
this.bt_reset.TabIndex = 2;
|
this.bt_reset.TabIndex = 2;
|
||||||
this.bt_reset.Text = "Перезагрузить";
|
this.bt_reset.Text = "Перезагрузить";
|
||||||
this.bt_reset.UseVisualStyleBackColor = true;
|
this.bt_reset.UseVisualStyleBackColor = true;
|
||||||
|
this.bt_reset.Click += new System.EventHandler(this.bt_reset_Click);
|
||||||
//
|
//
|
||||||
// toolStrip1
|
// toolStrip1
|
||||||
//
|
//
|
||||||
|
|
@ -106,6 +109,13 @@
|
||||||
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
|
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
|
||||||
this.flowLayoutPanel1.Size = new System.Drawing.Size(394, 380);
|
this.flowLayoutPanel1.Size = new System.Drawing.Size(394, 380);
|
||||||
this.flowLayoutPanel1.TabIndex = 4;
|
this.flowLayoutPanel1.TabIndex = 4;
|
||||||
|
this.flowLayoutPanel1.WrapContents = false;
|
||||||
|
//
|
||||||
|
// timer1
|
||||||
|
//
|
||||||
|
this.timer1.Enabled = true;
|
||||||
|
this.timer1.Interval = 1000;
|
||||||
|
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
|
||||||
//
|
//
|
||||||
// Form1
|
// Form1
|
||||||
//
|
//
|
||||||
|
|
@ -134,6 +144,7 @@
|
||||||
private System.Windows.Forms.ToolStripButton toolStripButton1;
|
private System.Windows.Forms.ToolStripButton toolStripButton1;
|
||||||
private System.Windows.Forms.ToolStripButton toolStripButton2;
|
private System.Windows.Forms.ToolStripButton toolStripButton2;
|
||||||
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
|
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
|
||||||
|
private System.Windows.Forms.Timer timer1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,12 +14,24 @@ namespace Reseter2
|
||||||
{
|
{
|
||||||
public Form1()
|
public Form1()
|
||||||
{
|
{
|
||||||
|
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
Reseter.SetForm(flowLayoutPanel1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void label1_Click(object sender, EventArgs e)
|
private void label1_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void bt_reset_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Reseter.AddTask(tb_comp.Text) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void timer1_Tick(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Reseter.Tick();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -151,4 +151,7 @@
|
||||||
TgDQASA1MVpwzwAAAABJRU5ErkJggg==
|
TgDQASA1MVpwzwAAAABJRU5ErkJggg==
|
||||||
</value>
|
</value>
|
||||||
</data>
|
</data>
|
||||||
|
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>122, 17</value>
|
||||||
|
</metadata>
|
||||||
</root>
|
</root>
|
||||||
|
|
@ -13,6 +13,7 @@ namespace Reseter2
|
||||||
{
|
{
|
||||||
resetertask = reseterTask;
|
resetertask = reseterTask;
|
||||||
}
|
}
|
||||||
|
public abstract void Tick();
|
||||||
public abstract void Stop();
|
public abstract void Stop();
|
||||||
public abstract void Next();
|
public abstract void Next();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Reseter2
|
||||||
|
{
|
||||||
|
internal class Pinger
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -6,21 +6,37 @@ using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Reseter2
|
namespace Reseter2
|
||||||
{
|
{
|
||||||
internal class ReseterTask
|
class ReseterTask
|
||||||
{
|
{
|
||||||
private IComp Comp;
|
private IComp Comp;
|
||||||
private AStatusTask StatusTask;
|
private AStatusTask StatusTask;
|
||||||
|
private TaskControl taskControl;
|
||||||
|
|
||||||
|
public ReseterTask(IComp comp, TaskControl taskCntrl)
|
||||||
public ReseterTask(IComp comp)
|
|
||||||
{
|
{
|
||||||
Comp = comp;
|
Comp = comp;
|
||||||
|
taskControl = taskCntrl;
|
||||||
StatusTask = new StatusPreReboot(this);
|
StatusTask = new StatusPreReboot(this);
|
||||||
}
|
}
|
||||||
|
public string GetName()
|
||||||
|
{
|
||||||
|
return Comp.GetName();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Tick()
|
||||||
|
{
|
||||||
|
StatusTask.Tick();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DataContrl(string srt)
|
||||||
|
{
|
||||||
|
taskControl.DataContrl(srt);
|
||||||
|
}
|
||||||
private void Clear()
|
private void Clear()
|
||||||
{
|
{
|
||||||
Reseter.Clear(this);
|
Reseter.Clear(this, taskControl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,7 @@
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="IComp.cs" />
|
<Compile Include="IComp.cs" />
|
||||||
<Compile Include="IStatusTask.cs" />
|
<Compile Include="IStatusTask.cs" />
|
||||||
|
<Compile Include="Pinger.cs" />
|
||||||
<Compile Include="Program.cs" />
|
<Compile Include="Program.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="reseter.cs" />
|
<Compile Include="reseter.cs" />
|
||||||
|
|
|
||||||
|
|
@ -8,10 +8,16 @@ namespace Reseter2
|
||||||
{
|
{
|
||||||
internal class StatusPreReboot : AStatusTask
|
internal class StatusPreReboot : AStatusTask
|
||||||
{
|
{
|
||||||
|
private int time;
|
||||||
public StatusPreReboot(ReseterTask reseterTask) : base(reseterTask)
|
public StatusPreReboot(ReseterTask reseterTask) : base(reseterTask)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void Tick()
|
||||||
|
{
|
||||||
|
time++;
|
||||||
|
resetertask.DataContrl(time.ToString());
|
||||||
|
}
|
||||||
public override void Next()
|
public override void Next()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -133,6 +133,7 @@
|
||||||
this.button1.TabIndex = 9;
|
this.button1.TabIndex = 9;
|
||||||
this.button1.Text = "Остановить";
|
this.button1.Text = "Остановить";
|
||||||
this.button1.UseVisualStyleBackColor = true;
|
this.button1.UseVisualStyleBackColor = true;
|
||||||
|
this.button1.Click += new System.EventHandler(this.button1_Click);
|
||||||
//
|
//
|
||||||
// button2
|
// button2
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -11,16 +11,34 @@ using System.Windows.Forms;
|
||||||
namespace Reseter2
|
namespace Reseter2
|
||||||
{
|
{
|
||||||
[DefaultEvent(nameof(TaskControl))]
|
[DefaultEvent(nameof(TaskControl))]
|
||||||
public partial class TaskControl : UserControl
|
partial class TaskControl : UserControl
|
||||||
{
|
{
|
||||||
|
ReseterTask reseterTask;
|
||||||
public TaskControl()
|
public TaskControl()
|
||||||
{
|
{
|
||||||
|
reseterTask = null;
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Intit(ReseterTask res)
|
||||||
|
{
|
||||||
|
reseterTask = res;
|
||||||
|
lb_name.Text = reseterTask.GetName();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DataContrl(string ping)
|
||||||
|
{
|
||||||
|
label5.Text = ping;
|
||||||
|
|
||||||
|
}
|
||||||
private void label1_Click(object sender, EventArgs e)
|
private void label1_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void button1_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Reseter.Clear(reseterTask, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,24 +1,51 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Reflection.Emit;
|
||||||
|
using System.Runtime.Remoting.Metadata.W3cXsd2001;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace Reseter2
|
namespace Reseter2
|
||||||
{
|
{
|
||||||
internal static class Reseter
|
internal static class Reseter
|
||||||
{
|
{
|
||||||
private static List<ReseterTask> list_task;
|
private static List<ReseterTask> list_task = new List<ReseterTask>();
|
||||||
|
private static Panel flow_conteiner;
|
||||||
|
|
||||||
|
public static void SetForm(Panel flow_cntr)
|
||||||
|
{
|
||||||
|
flow_conteiner = flow_cntr;
|
||||||
|
}
|
||||||
|
public static void AddTask(String name)
|
||||||
|
{
|
||||||
|
CompId compid = new CompId(name);
|
||||||
|
AddTask(compid);
|
||||||
|
}
|
||||||
public static void AddTask(IComp compName)
|
public static void AddTask(IComp compName)
|
||||||
{
|
{
|
||||||
list_task.Add(new ReseterTask(compName));
|
|
||||||
|
TaskControl taskControl = new TaskControl();
|
||||||
|
ReseterTask reseterTask = new ReseterTask(compName, taskControl);
|
||||||
|
taskControl.Intit(reseterTask);
|
||||||
|
flow_conteiner.Controls.Add(taskControl);
|
||||||
|
list_task.Add(reseterTask);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Clear(ReseterTask reseterTask)
|
public static void Clear(ReseterTask reseterTask, TaskControl taskControl)
|
||||||
{
|
{
|
||||||
|
flow_conteiner.Controls.Remove(taskControl);
|
||||||
list_task.Remove(reseterTask);
|
list_task.Remove(reseterTask);
|
||||||
|
|
||||||
|
}
|
||||||
|
public static void Tick()
|
||||||
|
{
|
||||||
|
foreach (var item in list_task)
|
||||||
|
{
|
||||||
|
item.Tick();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue