Проработали дополнительно статусы, настройки теперь сохраняються

This commit is contained in:
klavirshik 2024-08-22 19:10:34 +02:00
parent 54309d099a
commit 9385ec0ca0
27 changed files with 441 additions and 204 deletions

View File

@ -30,7 +30,6 @@
{ {
this.components = new System.ComponentModel.Container(); 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.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.bt_reset = new System.Windows.Forms.Button(); this.bt_reset = new System.Windows.Forms.Button();
this.timer1 = new System.Windows.Forms.Timer(this.components); this.timer1 = new System.Windows.Forms.Timer(this.components);
@ -40,8 +39,6 @@
this.tabPage2 = new System.Windows.Forms.TabPage(); this.tabPage2 = new System.Windows.Forms.TabPage();
this.label2 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label();
this.bt_resetAll = new System.Windows.Forms.Button(); this.bt_resetAll = new System.Windows.Forms.Button();
this.checkControl1 = new Reseter2.CheckControl();
this.treeView1 = new Reseter2.NewTreeView();
this.imageList1 = new System.Windows.Forms.ImageList(this.components); this.imageList1 = new System.Windows.Forms.ImageList(this.components);
this.imageList2 = new System.Windows.Forms.ImageList(this.components); this.imageList2 = new System.Windows.Forms.ImageList(this.components);
this.tabPage3 = new System.Windows.Forms.TabPage(); this.tabPage3 = new System.Windows.Forms.TabPage();
@ -55,13 +52,16 @@
this.sm_RebootItem = new System.Windows.Forms.ToolStripMenuItem(); this.sm_RebootItem = new System.Windows.Forms.ToolStripMenuItem();
this.sm_SaveItem = new System.Windows.Forms.ToolStripMenuItem(); this.sm_SaveItem = new System.Windows.Forms.ToolStripMenuItem();
this.tabPage4 = new System.Windows.Forms.TabPage(); this.tabPage4 = new System.Windows.Forms.TabPage();
this.settingRebootControl1 = new Reseter2.Setting.SettingRebootControl();
this.settingSCCMControl1 = new Reseter2.Setting.SettingSCCMControl();
this.settingWordsControl1 = new Reseter2.Setting.SettingWordsControl();
this.button4 = new System.Windows.Forms.Button(); this.button4 = new System.Windows.Forms.Button();
this.tabPage5 = new System.Windows.Forms.TabPage(); this.tabPage5 = new System.Windows.Forms.TabPage();
this.pictureBox1 = new System.Windows.Forms.PictureBox(); this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.label16 = new System.Windows.Forms.Label(); this.label16 = new System.Windows.Forms.Label();
this.cb_comp = new System.Windows.Forms.ComboBox();
this.checkControl1 = new Reseter2.CheckControl();
this.treeView1 = new Reseter2.NewTreeView();
this.settingRebootControl1 = new Reseter2.Setting.SettingRebootControl();
this.settingSCCMControl1 = new Reseter2.Setting.SettingSCCMControl();
this.settingWordsControl1 = new Reseter2.Setting.SettingWordsControl();
this.tabControl1.SuspendLayout(); this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout(); this.tabPage1.SuspendLayout();
this.tabPage2.SuspendLayout(); this.tabPage2.SuspendLayout();
@ -72,13 +72,6 @@
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
// tb_comp
//
this.tb_comp.Location = new System.Drawing.Point(67, 12);
this.tb_comp.Name = "tb_comp";
this.tb_comp.Size = new System.Drawing.Size(207, 20);
this.tb_comp.TabIndex = 0;
//
// label1 // label1
// //
this.label1.AutoSize = true; this.label1.AutoSize = true;
@ -123,6 +116,7 @@
this.tabControl1.SelectedIndex = 0; this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(410, 714); this.tabControl1.Size = new System.Drawing.Size(410, 714);
this.tabControl1.TabIndex = 4; this.tabControl1.TabIndex = 4;
this.tabControl1.SelectedIndexChanged += new System.EventHandler(this.tabControl1_SelectedIndexChanged);
// //
// tabPage1 // tabPage1
// //
@ -183,36 +177,6 @@
this.bt_resetAll.UseVisualStyleBackColor = false; this.bt_resetAll.UseVisualStyleBackColor = false;
this.bt_resetAll.Click += new System.EventHandler(this.bt_resetAll_Click); this.bt_resetAll.Click += new System.EventHandler(this.bt_resetAll_Click);
// //
// checkControl1
//
this.checkControl1.Location = new System.Drawing.Point(14, 7);
this.checkControl1.Name = "checkControl1";
this.checkControl1.Size = new System.Drawing.Size(18, 18);
this.checkControl1.TabIndex = 2;
//
// treeView1
//
this.treeView1.Dock = System.Windows.Forms.DockStyle.Bottom;
this.treeView1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.treeView1.HideSelection = false;
this.treeView1.ImageIndex = 0;
this.treeView1.ImageList = this.imageList1;
this.treeView1.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.treeView1.Indent = 27;
this.treeView1.ItemHeight = 24;
this.treeView1.Location = new System.Drawing.Point(3, 32);
this.treeView1.Name = "treeView1";
this.treeView1.SelectedImageIndex = 0;
this.treeView1.ShowLines = false;
this.treeView1.ShowNodeToolTips = true;
this.treeView1.Size = new System.Drawing.Size(396, 653);
this.treeView1.StateImageList = this.imageList2;
this.treeView1.TabIndex = 0;
this.treeView1.AfterCheck += new System.Windows.Forms.TreeViewEventHandler(this.treeView1_AfterCheck);
this.treeView1.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.treeView1_NodeMouseClick);
this.treeView1.NodeMouseDoubleClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.treeView1_NodeMouseDoubleClick);
this.treeView1.MouseCaptureChanged += new System.EventHandler(this.treeView1_MouseCaptureChanged);
//
// imageList1 // imageList1
// //
this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream"))); this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
@ -357,27 +321,6 @@
this.tabPage4.Text = "Настройки"; this.tabPage4.Text = "Настройки";
this.tabPage4.UseVisualStyleBackColor = true; this.tabPage4.UseVisualStyleBackColor = true;
// //
// settingRebootControl1
//
this.settingRebootControl1.Location = new System.Drawing.Point(6, 299);
this.settingRebootControl1.Name = "settingRebootControl1";
this.settingRebootControl1.Size = new System.Drawing.Size(391, 130);
this.settingRebootControl1.TabIndex = 7;
//
// settingSCCMControl1
//
this.settingSCCMControl1.Location = new System.Drawing.Point(6, 115);
this.settingSCCMControl1.Name = "settingSCCMControl1";
this.settingSCCMControl1.Size = new System.Drawing.Size(391, 178);
this.settingSCCMControl1.TabIndex = 6;
//
// settingWordsControl1
//
this.settingWordsControl1.Location = new System.Drawing.Point(6, 6);
this.settingWordsControl1.Name = "settingWordsControl1";
this.settingWordsControl1.Size = new System.Drawing.Size(391, 103);
this.settingWordsControl1.TabIndex = 5;
//
// button4 // button4
// //
this.button4.Location = new System.Drawing.Point(317, 435); this.button4.Location = new System.Drawing.Point(317, 435);
@ -417,15 +360,82 @@
this.label16.TabIndex = 0; this.label16.TabIndex = 0;
this.label16.Text = "Reseter2"; this.label16.Text = "Reseter2";
// //
// cb_comp
//
this.cb_comp.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.cb_comp.DropDownHeight = 1;
this.cb_comp.FormattingEnabled = true;
this.cb_comp.Items.AddRange(new object[] {
"889",
"fdfd"});
this.cb_comp.Location = new System.Drawing.Point(67, 11);
this.cb_comp.MaxDropDownItems = 1;
this.cb_comp.Name = "cb_comp";
this.cb_comp.Size = new System.Drawing.Size(210, 21);
this.cb_comp.Sorted = true;
this.cb_comp.TabIndex = 5;
//
// checkControl1
//
this.checkControl1.Location = new System.Drawing.Point(14, 7);
this.checkControl1.Name = "checkControl1";
this.checkControl1.Size = new System.Drawing.Size(18, 18);
this.checkControl1.TabIndex = 2;
//
// treeView1
//
this.treeView1.Dock = System.Windows.Forms.DockStyle.Bottom;
this.treeView1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.treeView1.HideSelection = false;
this.treeView1.ImageIndex = 0;
this.treeView1.ImageList = this.imageList1;
this.treeView1.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.treeView1.Indent = 27;
this.treeView1.ItemHeight = 24;
this.treeView1.Location = new System.Drawing.Point(3, 32);
this.treeView1.Name = "treeView1";
this.treeView1.SelectedImageIndex = 0;
this.treeView1.ShowLines = false;
this.treeView1.ShowNodeToolTips = true;
this.treeView1.Size = new System.Drawing.Size(396, 653);
this.treeView1.StateImageList = this.imageList2;
this.treeView1.TabIndex = 0;
this.treeView1.AfterCheck += new System.Windows.Forms.TreeViewEventHandler(this.treeView1_AfterCheck);
this.treeView1.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.treeView1_NodeMouseClick);
this.treeView1.NodeMouseDoubleClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.treeView1_NodeMouseDoubleClick);
this.treeView1.MouseCaptureChanged += new System.EventHandler(this.treeView1_MouseCaptureChanged);
//
// settingRebootControl1
//
this.settingRebootControl1.Location = new System.Drawing.Point(6, 299);
this.settingRebootControl1.Name = "settingRebootControl1";
this.settingRebootControl1.Size = new System.Drawing.Size(391, 130);
this.settingRebootControl1.TabIndex = 7;
//
// settingSCCMControl1
//
this.settingSCCMControl1.Location = new System.Drawing.Point(6, 115);
this.settingSCCMControl1.Name = "settingSCCMControl1";
this.settingSCCMControl1.Size = new System.Drawing.Size(391, 178);
this.settingSCCMControl1.TabIndex = 6;
//
// settingWordsControl1
//
this.settingWordsControl1.Location = new System.Drawing.Point(6, 6);
this.settingWordsControl1.Name = "settingWordsControl1";
this.settingWordsControl1.Size = new System.Drawing.Size(391, 103);
this.settingWordsControl1.TabIndex = 5;
//
// Form1 // Form1
// //
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.ClientSize = new System.Drawing.Size(410, 753); this.ClientSize = new System.Drawing.Size(410, 753);
this.Controls.Add(this.cb_comp);
this.Controls.Add(this.tabControl1); this.Controls.Add(this.tabControl1);
this.Controls.Add(this.bt_reset); this.Controls.Add(this.bt_reset);
this.Controls.Add(this.label1); this.Controls.Add(this.label1);
this.Controls.Add(this.tb_comp);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "Form1"; this.Name = "Form1";
this.Text = "Reseter2"; this.Text = "Reseter2";
@ -448,8 +458,6 @@
} }
#endregion #endregion
private System.Windows.Forms.TextBox tb_comp;
private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button bt_reset; private System.Windows.Forms.Button bt_reset;
private System.Windows.Forms.Timer timer1; private System.Windows.Forms.Timer timer1;
@ -481,6 +489,7 @@
private Setting.SettingWordsControl settingWordsControl1; private Setting.SettingWordsControl settingWordsControl1;
private Setting.SettingRebootControl settingRebootControl1; private Setting.SettingRebootControl settingRebootControl1;
private Setting.SettingSCCMControl settingSCCMControl1; private Setting.SettingSCCMControl settingSCCMControl1;
private System.Windows.Forms.ComboBox cb_comp;
} }
} }

View File

@ -24,7 +24,9 @@ namespace Reseter2
private bool FocusContext; private bool FocusContext;
private object selectItem; private object selectItem;
public delegate void saveSetting(); public delegate void saveSetting();
public event saveSetting Save; public event saveSetting Save;
public delegate void updateSetting();
public event updateSetting UpdateSetting;
public Form1() public Form1()
{ {
@ -55,7 +57,17 @@ namespace Reseter2
InitializeComponent(); InitializeComponent();
settingWordsControl1.treeView = treeView1; settingWordsControl1.treeView = treeView1;
this.Save += settingWordsControl1.Save; this.Save += settingWordsControl1.Save;
this.Save += settingSCCMControl1.Save;
this.Save += settingRebootControl1.Save;
this.UpdateSetting += settingWordsControl1.UpdateSetting;
this.UpdateSetting += settingSCCMControl1.UpdateSetting;
this.UpdateSetting += settingRebootControl1.UpdateSetting;
// cb_comp.DropDownStyle = ComboBoxStyle.DropDown;
checkControl1.updateCheck += CheckControl1_updateCheck; checkControl1.updateCheck += CheckControl1_updateCheck;
flowLayoutPanel1.AutoScrollMinSize = new Size(0, 683) ; flowLayoutPanel1.AutoScrollMinSize = new Size(0, 683) ;
flowLayoutPanel1.VerticalScroll.Visible = true; flowLayoutPanel1.VerticalScroll.Visible = true;
@ -80,7 +92,8 @@ namespace Reseter2
private void bt_reset_Click(object sender, EventArgs e) private void bt_reset_Click(object sender, EventArgs e)
{ {
Reseter.AddTask(tb_comp.Text) ; Reseter.AddTask(cb_comp.Text);
tabControl1.SelectedIndex = 0;
} }
private void timer1_Tick(object sender, EventArgs e) private void timer1_Tick(object sender, EventArgs e)
@ -112,6 +125,7 @@ namespace Reseter2
if(selectItem is HistoryItem historyItem) if(selectItem is HistoryItem historyItem)
{ {
Reseter.AddTask(historyItem.GetComp()); Reseter.AddTask(historyItem.GetComp());
tabControl1.SelectedIndex = 0;
} }
} }
@ -420,5 +434,14 @@ namespace Reseter2
treeView1.Nodes.AddRange(WordsList.ListNodes()); treeView1.Nodes.AddRange(WordsList.ListNodes());
SGlobalSetting.settingExpand.ExpendAll(treeView1.Nodes); SGlobalSetting.settingExpand.ExpendAll(treeView1.Nodes);
} }
private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
{
if (tabControl1.SelectedIndex == 3)
{
UpdateSetting();
}
}
} }
} }

View File

@ -128,7 +128,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAACk ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAACk
UQAAAk1TRnQBSQFMAgEBCQEAAYABAQGAAQEBGAEAARgBAAT/AREBAAj/AUIBTQE2BwABNgMAASgDAAFg UQAAAk1TRnQBSQFMAgEBCQEAAUABAgFAAQIBGAEAARgBAAT/AREBAAj/AUIBTQE2BwABNgMAASgDAAFg
AwABSAMAAQEBAAEQBgABNhIAAf8BfwH/AX8B/wF/Af8BfwH/AX8B/wF/Af8BfwH/AX8B/wF/Af8BfwH/ AwABSAMAAQEBAAEQBgABNhIAAf8BfwH/AX8B/wF/Af8BfwH/AX8B/wF/Af8BfwH/AX8B/wF/Af8BfwH/
AX8B/wF/Af8BfwH/AX8B/wF/Af8BfwH/AX8B/wF/Af8BfwH/AX8B/wF/Af8BfwH/AX8B/wF/kAAB/wF/ AX8B/wF/Af8BfwH/AX8B/wF/Af8BfwH/AX8B/wF/Af8BfwH/AX8B/wF/Af8BfwH/AX8B/wF/kAAB/wF/
Af8BfwH/AX8B/wF/Af8BfwH/AX8B/wF/Af8BfwH/AX8B/wF/Af8BfwH/AX8B/wF/Af8BfwH/AX8B/wF/ Af8BfwH/AX8B/wF/Af8BfwH/AX8B/wF/Af8BfwH/AX8B/wF/Af8BfwH/AX8B/wF/Af8BfwH/AX8B/wF/
@ -487,7 +487,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAABQ ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAABQ
CgAAAk1TRnQBSQFMAgEBAwEAASABAAEgAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo CgAAAk1TRnQBSQFMAgEBAwEAAeABAAHgAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA

View File

@ -1,4 +1,5 @@
using System; using Reseter2.Setting;
using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
@ -23,6 +24,7 @@ namespace Reseter2.History
HistoryItem historyItem = new HistoryItem(reseterTask); HistoryItem historyItem = new HistoryItem(reseterTask);
Hitem.Insert(0, historyItem); Hitem.Insert(0, historyItem);
ClearFirst();
Update(); Update();
return historyItem; return historyItem;
@ -36,5 +38,16 @@ namespace Reseter2.History
{ {
Hitem.Clear(); Hitem.Clear();
} }
static public void ClearFirst()
{
if(Hitem.Count > SGlobalSetting.settingReboot.sizeHistoryItem)
{
Hitem.RemoveAt(Hitem.Count() - 1);
ClearFirst();
}
}
} }
} }

View File

@ -49,7 +49,7 @@ namespace Reseter2
pinger.Dispose(); pinger.Dispose();
} }
} }
if (pingable) TimeoutCount++; if (!succes) TimeoutCount++;
return new PingResult(ping, TimeoutCount, Ip, pingable, succes); return new PingResult(ping, TimeoutCount, Ip, pingable, succes);
} }

View File

@ -20,7 +20,7 @@ namespace Reseter2
public Stopwatch sw = new Stopwatch(); public Stopwatch sw = new Stopwatch();
public PingResult pingResult; public PingResult pingResult;
public HistoryItem historyItem; public HistoryItem historyItem;
public ReseterTask(IComp comp, TaskControl taskCntrl) public ReseterTask(IComp comp, TaskControl taskCntrl)
@ -28,7 +28,6 @@ namespace Reseter2
Comp = comp; Comp = comp;
taskControl = taskCntrl; taskControl = taskCntrl;
System.Diagnostics.Debug.WriteLine(comp.GetResetName());
if (comp.GetResetName() == null || comp.GetResetName().Length == 0) if (comp.GetResetName() == null || comp.GetResetName().Length == 0)
{ {
//Pingers = new Pinger(""); //Pingers = new Pinger("");
@ -37,7 +36,7 @@ namespace Reseter2
Pingers = new Pinger(Comp.GetResetName()); Pingers = new Pinger(Comp.GetResetName());
StatusTask = new StatusPreReboot(this); StatusTask = new StatusPreReboot(this);
historyItem = HistoryList.Add(this); historyItem = HistoryList.Add(this);
StatusTask = new StatusRebootError(this); StatusTask = new StatusRebootError(this, "Uncorrect");
} }
else else
@ -97,9 +96,9 @@ namespace Reseter2
StatusTask.RebootReturn(); StatusTask.RebootReturn();
} }
public void SetNameStage(string nameStage, int indexImg) public void SetNameStage(string nameStage, int indexImg, bool pauseOn = true)
{ {
taskControl.SetNameStage(nameStage, indexImg); taskControl.SetNameStage(nameStage, indexImg, pauseOn);
} }
public PingResult Ping() public PingResult Ping()
{ {

View File

@ -94,6 +94,7 @@
<Compile Include="reseter.cs" /> <Compile Include="reseter.cs" />
<Compile Include="ReseteTask.cs" /> <Compile Include="ReseteTask.cs" />
<Compile Include="Setting\SettingExpand.cs" /> <Compile Include="Setting\SettingExpand.cs" />
<Compile Include="Setting\SettingReboot.cs" />
<Compile Include="Setting\SettingRebootControl.cs"> <Compile Include="Setting\SettingRebootControl.cs">
<SubType>UserControl</SubType> <SubType>UserControl</SubType>
</Compile> </Compile>

View File

@ -20,6 +20,8 @@ namespace Reseter2.Setting
public static SettingWords settingWords = new SettingWords(); public static SettingWords settingWords = new SettingWords();
public static SettingExpand settingExpand = new SettingExpand(); public static SettingExpand settingExpand = new SettingExpand();
public static SettingSCCM settingSCCM = new SettingSCCM();
public static SettingReboot settingReboot = new SettingReboot();
//public static void LoadSetting() //public static void LoadSetting()
// { // {
@ -36,6 +38,8 @@ namespace Reseter2.Setting
SSetting setting = (SSetting)output; SSetting setting = (SSetting)output;
if (setting.settingWords != null) settingWords = setting.settingWords; if (setting.settingWords != null) settingWords = setting.settingWords;
if (setting.settingExpand != null) settingExpand = setting.settingExpand; if (setting.settingExpand != null) settingExpand = setting.settingExpand;
if (setting.settingSCCM != null) settingSCCM = setting.settingSCCM;
if (setting.settingReboot != null) settingReboot = setting.settingReboot;
HistoryList.Hitem = setting.historyItems; HistoryList.Hitem = setting.historyItems;
// return output; // return output;
@ -47,7 +51,9 @@ namespace Reseter2.Setting
sSetting.settingWords = settingWords; sSetting.settingWords = settingWords;
sSetting.historyItems = HistoryList.Hitem; sSetting.historyItems = HistoryList.Hitem;
sSetting.settingExpand = settingExpand; sSetting.settingExpand = settingExpand;
if(Save("res.dat", sSetting)) sSetting.settingSCCM = settingSCCM;
sSetting.settingReboot = settingReboot;
if (Save("res.dat", sSetting))
{ {
return true; return true;
} }

View File

@ -13,6 +13,7 @@ namespace Reseter2.Setting
public SettingWords settingWords; public SettingWords settingWords;
public List<HistoryItem> historyItems; public List<HistoryItem> historyItems;
public SettingExpand settingExpand; public SettingExpand settingExpand;
public SettingSCCM settingSCCM;
public SettingReboot settingReboot;
} }
} }

View File

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Reseter2.Setting
{
[Serializable]
internal class SettingReboot
{
public int checkConnect;
public int timeOutReboot;
public int timeCheckBeforReboot;
public int sizeHistoryItem;
public SettingReboot()
{
this.checkConnect = 5;
this.timeOutReboot = 5;
this.timeCheckBeforReboot = 50;
this.sizeHistoryItem = 200;
}
}
}

View File

@ -30,26 +30,30 @@
{ {
this.groupBox3 = new System.Windows.Forms.GroupBox(); this.groupBox3 = new System.Windows.Forms.GroupBox();
this.label15 = new System.Windows.Forms.Label(); this.label15 = new System.Windows.Forms.Label();
this.textBox9 = new System.Windows.Forms.TextBox();
this.label14 = new System.Windows.Forms.Label(); this.label14 = new System.Windows.Forms.Label();
this.textBox8 = new System.Windows.Forms.TextBox();
this.label13 = new System.Windows.Forms.Label(); this.label13 = new System.Windows.Forms.Label();
this.textBox7 = new System.Windows.Forms.TextBox();
this.label12 = new System.Windows.Forms.Label(); this.label12 = new System.Windows.Forms.Label();
this.textBox6 = new System.Windows.Forms.TextBox(); this.nb_checkConnect = new System.Windows.Forms.NumericUpDown();
this.nb_timeOutReboot = new System.Windows.Forms.NumericUpDown();
this.nb_timeCheckBeforReboot = new System.Windows.Forms.NumericUpDown();
this.nb_sizeHistoryItem = new System.Windows.Forms.NumericUpDown();
this.groupBox3.SuspendLayout(); this.groupBox3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.nb_checkConnect)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nb_timeOutReboot)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nb_timeCheckBeforReboot)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nb_sizeHistoryItem)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
// groupBox3 // groupBox3
// //
this.groupBox3.Controls.Add(this.nb_sizeHistoryItem);
this.groupBox3.Controls.Add(this.nb_timeCheckBeforReboot);
this.groupBox3.Controls.Add(this.nb_timeOutReboot);
this.groupBox3.Controls.Add(this.nb_checkConnect);
this.groupBox3.Controls.Add(this.label15); this.groupBox3.Controls.Add(this.label15);
this.groupBox3.Controls.Add(this.textBox9);
this.groupBox3.Controls.Add(this.label14); this.groupBox3.Controls.Add(this.label14);
this.groupBox3.Controls.Add(this.textBox8);
this.groupBox3.Controls.Add(this.label13); this.groupBox3.Controls.Add(this.label13);
this.groupBox3.Controls.Add(this.textBox7);
this.groupBox3.Controls.Add(this.label12); this.groupBox3.Controls.Add(this.label12);
this.groupBox3.Controls.Add(this.textBox6);
this.groupBox3.Location = new System.Drawing.Point(3, 3); this.groupBox3.Location = new System.Drawing.Point(3, 3);
this.groupBox3.Name = "groupBox3"; this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(386, 124); this.groupBox3.Size = new System.Drawing.Size(386, 124);
@ -66,13 +70,6 @@
this.label15.TabIndex = 11; this.label15.TabIndex = 11;
this.label15.Text = "Кол-во записей истории"; this.label15.Text = "Кол-во записей истории";
// //
// textBox9
//
this.textBox9.Location = new System.Drawing.Point(184, 96);
this.textBox9.Name = "textBox9";
this.textBox9.Size = new System.Drawing.Size(182, 20);
this.textBox9.TabIndex = 10;
//
// label14 // label14
// //
this.label14.AutoSize = true; this.label14.AutoSize = true;
@ -82,13 +79,6 @@
this.label14.TabIndex = 9; this.label14.TabIndex = 9;
this.label14.Text = "Время контроля после перезагрузки"; this.label14.Text = "Время контроля после перезагрузки";
// //
// textBox8
//
this.textBox8.Location = new System.Drawing.Point(209, 70);
this.textBox8.Name = "textBox8";
this.textBox8.Size = new System.Drawing.Size(157, 20);
this.textBox8.TabIndex = 8;
//
// label13 // label13
// //
this.label13.AutoSize = true; this.label13.AutoSize = true;
@ -98,13 +88,6 @@
this.label13.TabIndex = 7; this.label13.TabIndex = 7;
this.label13.Text = "Время ожидание перезагрузки"; this.label13.Text = "Время ожидание перезагрузки";
// //
// textBox7
//
this.textBox7.Location = new System.Drawing.Point(184, 44);
this.textBox7.Name = "textBox7";
this.textBox7.Size = new System.Drawing.Size(182, 20);
this.textBox7.TabIndex = 6;
//
// label12 // label12
// //
this.label12.AutoSize = true; this.label12.AutoSize = true;
@ -114,12 +97,61 @@
this.label12.TabIndex = 5; this.label12.TabIndex = 5;
this.label12.Text = "Кол-во попыток проверки связи"; this.label12.Text = "Кол-во попыток проверки связи";
// //
// textBox6 // nb_checkConnect
// //
this.textBox6.Location = new System.Drawing.Point(184, 18); this.nb_checkConnect.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
this.textBox6.Name = "textBox6"; | System.Windows.Forms.AnchorStyles.Right)));
this.textBox6.Size = new System.Drawing.Size(182, 20); this.nb_checkConnect.Location = new System.Drawing.Point(184, 18);
this.textBox6.TabIndex = 4; this.nb_checkConnect.Maximum = new decimal(new int[] {
1000000,
0,
0,
0});
this.nb_checkConnect.Name = "nb_checkConnect";
this.nb_checkConnect.Size = new System.Drawing.Size(182, 20);
this.nb_checkConnect.TabIndex = 13;
//
// nb_timeOutReboot
//
this.nb_timeOutReboot.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.nb_timeOutReboot.Location = new System.Drawing.Point(184, 44);
this.nb_timeOutReboot.Maximum = new decimal(new int[] {
100000,
0,
0,
0});
this.nb_timeOutReboot.Name = "nb_timeOutReboot";
this.nb_timeOutReboot.Size = new System.Drawing.Size(182, 20);
this.nb_timeOutReboot.TabIndex = 14;
//
// nb_timeCheckBeforReboot
//
this.nb_timeCheckBeforReboot.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.nb_timeCheckBeforReboot.Location = new System.Drawing.Point(208, 70);
this.nb_timeCheckBeforReboot.Maximum = new decimal(new int[] {
100000,
0,
0,
0});
this.nb_timeCheckBeforReboot.Name = "nb_timeCheckBeforReboot";
this.nb_timeCheckBeforReboot.Size = new System.Drawing.Size(158, 20);
this.nb_timeCheckBeforReboot.TabIndex = 15;
//
// nb_sizeHistoryItem
//
this.nb_sizeHistoryItem.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.nb_sizeHistoryItem.Location = new System.Drawing.Point(184, 96);
this.nb_sizeHistoryItem.Maximum = new decimal(new int[] {
10000,
0,
0,
0});
this.nb_sizeHistoryItem.Name = "nb_sizeHistoryItem";
this.nb_sizeHistoryItem.Size = new System.Drawing.Size(182, 20);
this.nb_sizeHistoryItem.TabIndex = 16;
// //
// SettingRebootControl // SettingRebootControl
// //
@ -130,6 +162,10 @@
this.Size = new System.Drawing.Size(391, 130); this.Size = new System.Drawing.Size(391, 130);
this.groupBox3.ResumeLayout(false); this.groupBox3.ResumeLayout(false);
this.groupBox3.PerformLayout(); this.groupBox3.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.nb_checkConnect)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nb_timeOutReboot)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nb_timeCheckBeforReboot)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nb_sizeHistoryItem)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
} }
@ -138,12 +174,12 @@
private System.Windows.Forms.GroupBox groupBox3; private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.Label label15; private System.Windows.Forms.Label label15;
private System.Windows.Forms.TextBox textBox9;
private System.Windows.Forms.Label label14; private System.Windows.Forms.Label label14;
private System.Windows.Forms.TextBox textBox8;
private System.Windows.Forms.Label label13; private System.Windows.Forms.Label label13;
private System.Windows.Forms.TextBox textBox7;
private System.Windows.Forms.Label label12; private System.Windows.Forms.Label label12;
private System.Windows.Forms.TextBox textBox6; private System.Windows.Forms.NumericUpDown nb_timeOutReboot;
private System.Windows.Forms.NumericUpDown nb_checkConnect;
private System.Windows.Forms.NumericUpDown nb_sizeHistoryItem;
private System.Windows.Forms.NumericUpDown nb_timeCheckBeforReboot;
} }
} }

View File

@ -4,6 +4,7 @@ using System.ComponentModel;
using System.Data; using System.Data;
using System.Drawing; using System.Drawing;
using System.Linq; using System.Linq;
using System.Runtime;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
@ -15,6 +16,29 @@ namespace Reseter2.Setting
public SettingRebootControl() public SettingRebootControl()
{ {
InitializeComponent(); InitializeComponent();
UpdateSetting();
} }
public void UpdateSetting()
{
if (SGlobalSetting.settingReboot != null)
{
nb_checkConnect.Value = SGlobalSetting.settingReboot.checkConnect;
nb_timeOutReboot.Value = SGlobalSetting.settingReboot.timeOutReboot;
nb_timeCheckBeforReboot.Value = SGlobalSetting.settingReboot.timeCheckBeforReboot;
nb_sizeHistoryItem.Value = SGlobalSetting.settingReboot.sizeHistoryItem;
}
}
public void Save()
{
SGlobalSetting.settingReboot.checkConnect = (int)nb_checkConnect.Value;
SGlobalSetting.settingReboot.timeOutReboot = (int)nb_timeOutReboot.Value;
SGlobalSetting.settingReboot.timeCheckBeforReboot = (int)nb_timeCheckBeforReboot.Value;
SGlobalSetting.settingReboot.sizeHistoryItem = (int)nb_sizeHistoryItem.Value;
}
} }
} }

View File

@ -15,7 +15,16 @@ namespace Reseter2.Setting
public string password; public string password;
public bool on; public bool on;
public bool windowsAuth; public bool windowsAuth;
public SettingSCCM()
{
server = string.Empty;
dataBase = string.Empty;
username = string.Empty;
password = string.Empty;
on = false;
windowsAuth = false;
}
} }
} }

View File

@ -29,33 +29,33 @@
private void InitializeComponent() private void InitializeComponent()
{ {
this.groupBox2 = new System.Windows.Forms.GroupBox(); this.groupBox2 = new System.Windows.Forms.GroupBox();
this.button3 = new System.Windows.Forms.Button(); this.bt_checkConnect = new System.Windows.Forms.Button();
this.label10 = new System.Windows.Forms.Label(); this.label10 = new System.Windows.Forms.Label();
this.textBox4 = new System.Windows.Forms.TextBox(); this.ib_password = new System.Windows.Forms.TextBox();
this.label11 = new System.Windows.Forms.Label(); this.label11 = new System.Windows.Forms.Label();
this.textBox5 = new System.Windows.Forms.TextBox(); this.ib_username = new System.Windows.Forms.TextBox();
this.checkBox2 = new System.Windows.Forms.CheckBox(); this.cb_windowsAuth = new System.Windows.Forms.CheckBox();
this.label9 = new System.Windows.Forms.Label(); this.label9 = new System.Windows.Forms.Label();
this.textBox3 = new System.Windows.Forms.TextBox(); this.ib_dataBase = new System.Windows.Forms.TextBox();
this.label8 = new System.Windows.Forms.Label(); this.label8 = new System.Windows.Forms.Label();
this.textBox2 = new System.Windows.Forms.TextBox(); this.ib_server = new System.Windows.Forms.TextBox();
this.checkBox1 = new System.Windows.Forms.CheckBox(); this.cb_on = new System.Windows.Forms.CheckBox();
this.groupBox2.SuspendLayout(); this.groupBox2.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// groupBox2 // groupBox2
// //
this.groupBox2.Controls.Add(this.button3); this.groupBox2.Controls.Add(this.bt_checkConnect);
this.groupBox2.Controls.Add(this.label10); this.groupBox2.Controls.Add(this.label10);
this.groupBox2.Controls.Add(this.textBox4); this.groupBox2.Controls.Add(this.ib_password);
this.groupBox2.Controls.Add(this.label11); this.groupBox2.Controls.Add(this.label11);
this.groupBox2.Controls.Add(this.textBox5); this.groupBox2.Controls.Add(this.ib_username);
this.groupBox2.Controls.Add(this.checkBox2); this.groupBox2.Controls.Add(this.cb_windowsAuth);
this.groupBox2.Controls.Add(this.label9); this.groupBox2.Controls.Add(this.label9);
this.groupBox2.Controls.Add(this.textBox3); this.groupBox2.Controls.Add(this.ib_dataBase);
this.groupBox2.Controls.Add(this.label8); this.groupBox2.Controls.Add(this.label8);
this.groupBox2.Controls.Add(this.textBox2); this.groupBox2.Controls.Add(this.ib_server);
this.groupBox2.Controls.Add(this.checkBox1); this.groupBox2.Controls.Add(this.cb_on);
this.groupBox2.Location = new System.Drawing.Point(3, 3); this.groupBox2.Location = new System.Drawing.Point(3, 3);
this.groupBox2.Name = "groupBox2"; this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(386, 173); this.groupBox2.Size = new System.Drawing.Size(386, 173);
@ -63,14 +63,14 @@
this.groupBox2.TabStop = false; this.groupBox2.TabStop = false;
this.groupBox2.Text = "Параметры поиска"; this.groupBox2.Text = "Параметры поиска";
// //
// button3 // bt_checkConnect
// //
this.button3.Location = new System.Drawing.Point(263, 143); this.bt_checkConnect.Location = new System.Drawing.Point(263, 143);
this.button3.Name = "button3"; this.bt_checkConnect.Name = "bt_checkConnect";
this.button3.Size = new System.Drawing.Size(112, 23); this.bt_checkConnect.Size = new System.Drawing.Size(112, 23);
this.button3.TabIndex = 11; this.bt_checkConnect.TabIndex = 11;
this.button3.Text = "Проверить связь"; this.bt_checkConnect.Text = "Проверить связь";
this.button3.UseVisualStyleBackColor = true; this.bt_checkConnect.UseVisualStyleBackColor = true;
// //
// label10 // label10
// //
@ -81,12 +81,13 @@
this.label10.TabIndex = 10; this.label10.TabIndex = 10;
this.label10.Text = "Пароль"; this.label10.Text = "Пароль";
// //
// textBox4 // ib_password
// //
this.textBox4.Location = new System.Drawing.Point(193, 117); this.ib_password.Location = new System.Drawing.Point(193, 117);
this.textBox4.Name = "textBox4"; this.ib_password.Name = "ib_password";
this.textBox4.Size = new System.Drawing.Size(182, 20); this.ib_password.PasswordChar = '•';
this.textBox4.TabIndex = 9; this.ib_password.Size = new System.Drawing.Size(182, 20);
this.ib_password.TabIndex = 9;
// //
// label11 // label11
// //
@ -97,22 +98,23 @@
this.label11.TabIndex = 8; this.label11.TabIndex = 8;
this.label11.Text = "Логин"; this.label11.Text = "Логин";
// //
// textBox5 // ib_username
// //
this.textBox5.Location = new System.Drawing.Point(6, 117); this.ib_username.Location = new System.Drawing.Point(6, 117);
this.textBox5.Name = "textBox5"; this.ib_username.Name = "ib_username";
this.textBox5.Size = new System.Drawing.Size(181, 20); this.ib_username.Size = new System.Drawing.Size(181, 20);
this.textBox5.TabIndex = 7; this.ib_username.TabIndex = 7;
// //
// checkBox2 // cb_windowsAuth
// //
this.checkBox2.AutoSize = true; this.cb_windowsAuth.AutoSize = true;
this.checkBox2.Location = new System.Drawing.Point(10, 82); this.cb_windowsAuth.Location = new System.Drawing.Point(10, 82);
this.checkBox2.Name = "checkBox2"; this.cb_windowsAuth.Name = "cb_windowsAuth";
this.checkBox2.Size = new System.Drawing.Size(157, 17); this.cb_windowsAuth.Size = new System.Drawing.Size(157, 17);
this.checkBox2.TabIndex = 6; this.cb_windowsAuth.TabIndex = 6;
this.checkBox2.Text = "Аутентификация Windows"; this.cb_windowsAuth.Text = "Аутентификация Windows";
this.checkBox2.UseVisualStyleBackColor = true; this.cb_windowsAuth.UseVisualStyleBackColor = true;
this.cb_windowsAuth.CheckedChanged += new System.EventHandler(this.cb_windowsAuth_CheckedChanged);
// //
// label9 // label9
// //
@ -123,12 +125,12 @@
this.label9.TabIndex = 5; this.label9.TabIndex = 5;
this.label9.Text = "База данных"; this.label9.Text = "База данных";
// //
// textBox3 // ib_dataBase
// //
this.textBox3.Location = new System.Drawing.Point(193, 55); this.ib_dataBase.Location = new System.Drawing.Point(193, 55);
this.textBox3.Name = "textBox3"; this.ib_dataBase.Name = "ib_dataBase";
this.textBox3.Size = new System.Drawing.Size(182, 20); this.ib_dataBase.Size = new System.Drawing.Size(182, 20);
this.textBox3.TabIndex = 4; this.ib_dataBase.TabIndex = 4;
// //
// label8 // label8
// //
@ -139,22 +141,23 @@
this.label8.TabIndex = 3; this.label8.TabIndex = 3;
this.label8.Text = "Сервер базы данных"; this.label8.Text = "Сервер базы данных";
// //
// textBox2 // ib_server
// //
this.textBox2.Location = new System.Drawing.Point(6, 55); this.ib_server.Location = new System.Drawing.Point(6, 55);
this.textBox2.Name = "textBox2"; this.ib_server.Name = "ib_server";
this.textBox2.Size = new System.Drawing.Size(181, 20); this.ib_server.Size = new System.Drawing.Size(181, 20);
this.textBox2.TabIndex = 1; this.ib_server.TabIndex = 1;
// //
// checkBox1 // cb_on
// //
this.checkBox1.AutoSize = true; this.cb_on.AutoSize = true;
this.checkBox1.Location = new System.Drawing.Point(10, 20); this.cb_on.Location = new System.Drawing.Point(10, 20);
this.checkBox1.Name = "checkBox1"; this.cb_on.Name = "cb_on";
this.checkBox1.Size = new System.Drawing.Size(215, 17); this.cb_on.Size = new System.Drawing.Size(215, 17);
this.checkBox1.TabIndex = 0; this.cb_on.TabIndex = 0;
this.checkBox1.Text = "Связь с SCCM (помощь в поиске ПК)"; this.cb_on.Text = "Связь с SCCM (помощь в поиске ПК)";
this.checkBox1.UseVisualStyleBackColor = true; this.cb_on.UseVisualStyleBackColor = true;
this.cb_on.CheckedChanged += new System.EventHandler(this.cb_on_CheckedChanged);
// //
// SettingSCCMControl // SettingSCCMControl
// //
@ -172,16 +175,16 @@
#endregion #endregion
private System.Windows.Forms.GroupBox groupBox2; private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.Button button3; private System.Windows.Forms.Button bt_checkConnect;
private System.Windows.Forms.Label label10; private System.Windows.Forms.Label label10;
private System.Windows.Forms.TextBox textBox4; private System.Windows.Forms.TextBox ib_password;
private System.Windows.Forms.Label label11; private System.Windows.Forms.Label label11;
private System.Windows.Forms.TextBox textBox5; private System.Windows.Forms.TextBox ib_username;
private System.Windows.Forms.CheckBox checkBox2; private System.Windows.Forms.CheckBox cb_windowsAuth;
private System.Windows.Forms.Label label9; private System.Windows.Forms.Label label9;
private System.Windows.Forms.TextBox textBox3; private System.Windows.Forms.TextBox ib_dataBase;
private System.Windows.Forms.Label label8; private System.Windows.Forms.Label label8;
private System.Windows.Forms.TextBox textBox2; private System.Windows.Forms.TextBox ib_server;
private System.Windows.Forms.CheckBox checkBox1; private System.Windows.Forms.CheckBox cb_on;
} }
} }

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Data; using System.Data;
using System.Drawing; using System.Drawing;
using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -15,6 +16,55 @@ namespace Reseter2.Setting
public SettingSCCMControl() public SettingSCCMControl()
{ {
InitializeComponent(); InitializeComponent();
UpdateSetting();
}
public void UpdateSetting()
{
if (SGlobalSetting.settingSCCM != null)
{
ib_server.Text = SGlobalSetting.settingSCCM.server;
ib_dataBase.Text = SGlobalSetting.settingSCCM.dataBase;
ib_username.Text = SGlobalSetting.settingSCCM.username;
ib_password.Text = SGlobalSetting.settingSCCM.password;
cb_on.Checked = SGlobalSetting.settingSCCM.on;
cb_windowsAuth.Checked = SGlobalSetting.settingSCCM.windowsAuth;
SearchControl(cb_on.Checked);
}
}
private void AuthControl(bool enable)
{
ib_username.Enabled = enable;
ib_password.Enabled = enable;
}
private void SearchControl(bool enable)
{
ib_server.Enabled = enable;
ib_dataBase.Enabled = enable;
cb_windowsAuth.Enabled = enable;
bt_checkConnect.Enabled = enable;
AuthControl(!cb_windowsAuth.Checked && enable);
}
private void cb_on_CheckedChanged(object sender, EventArgs e)
{
SearchControl(cb_on.Checked);
}
private void cb_windowsAuth_CheckedChanged(object sender, EventArgs e)
{
AuthControl(!cb_windowsAuth.Checked);
}
public void Save()
{
SGlobalSetting.settingSCCM.server = ib_server.Text;
SGlobalSetting.settingSCCM.dataBase = ib_dataBase.Text;
SGlobalSetting.settingSCCM.username = ib_username.Text;
SGlobalSetting.settingSCCM.password = ib_password.Text;
SGlobalSetting.settingSCCM.on = cb_on.Checked;
SGlobalSetting.settingSCCM.windowsAuth = cb_windowsAuth.Checked;
} }
} }
} }

View File

@ -20,7 +20,12 @@ namespace Reseter2.Setting
public SettingWordsControl() public SettingWordsControl()
{ {
InitializeComponent(); InitializeComponent();
if(SGlobalSetting.settingWords != null) UpdateSetting();
}
public void UpdateSetting()
{
if (SGlobalSetting.settingWords != null)
{ {
path.Text = SGlobalSetting.settingWords.PathBase; path.Text = SGlobalSetting.settingWords.PathBase;
} }

View File

@ -26,7 +26,7 @@ namespace Reseter2
} }
public override string GetName() public override string GetName()
{ {
return "Отмененно"; return "Canceled";
} }
} }
} }

View File

@ -1,4 +1,5 @@
using Reseter2.History; using Reseter2.History;
using Reseter2.Setting;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -11,6 +12,7 @@ namespace Reseter2
internal class StatusReboot : AStatusTask internal class StatusReboot : AStatusTask
{ {
private int TimeCount; private int TimeCount;
private int Timeout;
private PingResult PingResult = new PingResult(0, 0, null, false); private PingResult PingResult = new PingResult(0, 0, null, false);
public StatusReboot(ReseterTask reseterTask) : base(reseterTask) public StatusReboot(ReseterTask reseterTask) : base(reseterTask)
@ -30,11 +32,19 @@ namespace Reseter2
{ {
TimeCount++; TimeCount++;
} }
if (TimeCount > 3) if (TimeCount > 2)
{ {
resetertask.StatusTask = new StatusRebooting(resetertask); resetertask.StatusTask = new StatusRebooting(resetertask, Timeout);
HistoryList.Updated(); HistoryList.Updated();
} }
if (Timeout > SGlobalSetting.settingReboot.timeOutReboot)
{
resetertask.StatusTask = new StatusRebootError(resetertask, "Error RST");
HistoryList.Updated();
}
Timeout++;
} }
public override string GetName() public override string GetName()
{ {

View File

@ -8,10 +8,14 @@ namespace Reseter2
{ {
internal class StatusRebootError : AStatusTask internal class StatusRebootError : AStatusTask
{ {
private string _error;
private PingResult PingResult = new PingResult(0, 0, null, false); private PingResult PingResult = new PingResult(0, 0, null, false);
public StatusRebootError(ReseterTask reseterTask) : base(reseterTask) public StatusRebootError(ReseterTask reseterTask, string error = "Error") : base(reseterTask)
{ {
resetertask.SetNameStage("Ошибка перезагрузки", 5); _error = error;
string messges = "Ошибка перезагрузки";
if (error != "Error") messges = messges + "(" + error + ")";
resetertask.SetNameStage(messges, 5, false);
resetertask.historyItem.SetEndTime(DateTime.Now); resetertask.historyItem.SetEndTime(DateTime.Now);
reseterTask.sw.Stop(); reseterTask.sw.Stop();
} }
@ -26,7 +30,7 @@ namespace Reseter2
public override string GetName() public override string GetName()
{ {
return "Error"; return _error;
} }
} }
} }

View File

@ -11,7 +11,7 @@ namespace Reseter2
private PingResult PingResult; private PingResult PingResult;
public StatusRebootStop(ReseterTask reseterTask) : base(reseterTask) public StatusRebootStop(ReseterTask reseterTask) : base(reseterTask)
{ {
resetertask.SetNameStage("Остановленно", 6); resetertask.SetNameStage("Остановленно", 6, false);
PingResult = resetertask.pingResult; PingResult = resetertask.pingResult;
resetertask.historyItem.SetEndTime(DateTime.Now); resetertask.historyItem.SetEndTime(DateTime.Now);
reseterTask.sw.Stop(); reseterTask.sw.Stop();

View File

@ -11,7 +11,7 @@ namespace Reseter2
private PingResult PingResult; private PingResult PingResult;
public StatusRebootSucces(ReseterTask reseterTask) : base(reseterTask) public StatusRebootSucces(ReseterTask reseterTask) : base(reseterTask)
{ {
resetertask.SetNameStage("Успешно перезагруженно", 7); resetertask.SetNameStage("Успешно перезагруженно", 7, false);
resetertask.historyItem.SetEndTime(DateTime.Now); resetertask.historyItem.SetEndTime(DateTime.Now);
PingResult = resetertask.Ping(); PingResult = resetertask.Ping();
resetertask.Comp.SetIP(PingResult.Ip); resetertask.Comp.SetIP(PingResult.Ip);

View File

@ -1,4 +1,5 @@
using Reseter2.History; using Reseter2.History;
using Reseter2.Setting;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -10,11 +11,12 @@ namespace Reseter2
internal class StatusRebooting : AStatusTask internal class StatusRebooting : AStatusTask
{ {
private int TimeCount; private int TimeCount;
private int Timeout;
private PingResult PingResult = new PingResult(0, 0, null, false); private PingResult PingResult = new PingResult(0, 0, null, false);
public StatusRebooting(ReseterTask reseterTask) : base(reseterTask) public StatusRebooting(ReseterTask reseterTask, int timeout = 0) : base(reseterTask)
{ {
resetertask.SetNameStage("Перезагрузка", 2); resetertask.SetNameStage("Перезагрузка", 2);
Timeout = timeout;
} }
public override Task<PingResult> Tick() public override Task<PingResult> Tick()
@ -28,11 +30,21 @@ namespace Reseter2
{ {
TimeCount++; TimeCount++;
} }
if (TimeCount > 50) if (TimeCount > SGlobalSetting.settingReboot.timeCheckBeforReboot)
{ {
resetertask.StatusTask = new StatusRebootSucces(resetertask); resetertask.StatusTask = new StatusRebootSucces(resetertask);
HistoryList.Updated(); HistoryList.Updated();
} }
if (PingResult.TimedOut == true)
{
Timeout++;
}
if (Timeout > SGlobalSetting.settingReboot.timeOutReboot)
{
resetertask.StatusTask = new StatusRebootError(resetertask, "Error UP");
HistoryList.Updated();
}
} }
public override string GetName() public override string GetName()
{ {

View File

@ -1,4 +1,5 @@
using Reseter2.History; using Reseter2.History;
using Reseter2.Setting;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -37,16 +38,16 @@ namespace Reseter2
{ {
timeOut++; timeOut++;
} }
if(timeOut > 2) if(timeOut > SGlobalSetting.settingReboot.checkConnect)
{ {
resetertask.StatusTask = new StatusRebootError(resetertask); resetertask.StatusTask = new StatusRebootError(resetertask, "Error NET");
HistoryList.Updated(); HistoryList.Updated();
} }
} }
public override string GetName() public override string GetName()
{ {
return "Check net"; return "Check NET";
} }
} }

View File

@ -162,7 +162,7 @@
this.button3.Name = "button3"; this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(96, 23); this.button3.Size = new System.Drawing.Size(96, 23);
this.button3.TabIndex = 12; this.button3.TabIndex = 12;
this.button3.Text = "Пауза"; this.button3.Text = "Остановить";
this.button3.UseVisualStyleBackColor = true; this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.button3_Click); this.button3.Click += new System.EventHandler(this.button3_Click);
// //

View File

@ -51,10 +51,11 @@ namespace Reseter2
lb_time.Text = time.ToString(@"mm\:ss"); lb_time.Text = time.ToString(@"mm\:ss");
} }
public void SetNameStage(string nameStage, int indexImg) public void SetNameStage(string nameStage, int indexImg, bool pauseOn)
{ {
lb_stage.Text = nameStage; lb_stage.Text = nameStage;
pictureBox1.Image = imageList1.Images[indexImg]; pictureBox1.Image = imageList1.Images[indexImg];
button3.Enabled=pauseOn;
} }
private void label1_Click(object sender, EventArgs e) private void label1_Click(object sender, EventArgs e)
{ {

View File

@ -125,7 +125,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAABk ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAABk
lAIAAk1TRnQBSQFMAgEBCAEAASABAAEgAQABQAEAAUABAAT/ARkBAAj/AUIBTQE2BwABNgMAASgEAAEB lAIAAk1TRnQBSQFMAgEBCAEAASgBAAEoAQABQAEAAUABAAT/ARkBAAj/AUIBTQE2BwABNgMAASgEAAEB
AgABwAMAAQEBAAEYBgABQAEC/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A AgABwAMAAQEBAAEYBgABQAEC/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A
/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A /wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A
/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A /wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A

View File

@ -60,8 +60,14 @@ namespace Reseter2
public static async void Clear(ReseterTask reseterTask, TaskControl taskControl) public static async void Clear(ReseterTask reseterTask, TaskControl taskControl)
{ {
reseterTask.StatusTask = new StatusCanceled(reseterTask); if(!(reseterTask.StatusTask is StatusRebootError ||
reseterTask.historyItem.SetEndTime(DateTime.Now); reseterTask.StatusTask is StatusRebootStop ||
reseterTask.StatusTask is StatusRebootSucces))
{
reseterTask.StatusTask = new StatusCanceled(reseterTask);
reseterTask.historyItem.SetEndTime(DateTime.Now);
}
HistoryList.Updated(); HistoryList.Updated();
flow_conteiner.Controls.Remove(taskControl); flow_conteiner.Controls.Remove(taskControl);
list_task.Remove(reseterTask); list_task.Remove(reseterTask);