diff --git a/Reseter2/Form1.Designer.cs b/Reseter2/Form1.Designer.cs index 8ac2359..fbbf84d 100644 --- a/Reseter2/Form1.Designer.cs +++ b/Reseter2/Form1.Designer.cs @@ -44,8 +44,6 @@ this.tabPage2 = new System.Windows.Forms.TabPage(); this.label2 = new System.Windows.Forms.Label(); 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.imageList2 = new System.Windows.Forms.ImageList(this.components); this.tabPage3 = new System.Windows.Forms.TabPage(); @@ -59,9 +57,6 @@ this.sm_RebootItem = new System.Windows.Forms.ToolStripMenuItem(); this.sm_SaveItem = new System.Windows.Forms.ToolStripMenuItem(); 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.tabPage5 = new System.Windows.Forms.TabPage(); this.pictureBox1 = new System.Windows.Forms.PictureBox(); @@ -69,6 +64,11 @@ this.cm_words = new System.Windows.Forms.ContextMenuStrip(this.components); this.WordsReboot = new System.Windows.Forms.ToolStripMenuItem(); 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.tabPage1.SuspendLayout(); this.statusStrip1.SuspendLayout(); @@ -232,36 +232,6 @@ this.bt_resetAll.UseVisualStyleBackColor = false; 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 // this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream"))); @@ -407,27 +377,6 @@ this.tabPage4.Text = "Настройки"; 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 // this.button4.Location = new System.Drawing.Point(317, 435); @@ -486,20 +435,70 @@ // 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.DropDownHeight = 100; this.cb_comp.FormattingEnabled = true; - this.cb_comp.IntegralHeight = false; + this.cb_comp.ImeMode = System.Windows.Forms.ImeMode.NoControl; 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.MaxDropDownItems = 7; + this.cb_comp.MaxLength = 100; 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; this.cb_comp.TextUpdate += new System.EventHandler(this.cb_comp_TextUpdate); // + // 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 // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; diff --git a/Reseter2/Form1.cs b/Reseter2/Form1.cs index 42c80ea..acafd07 100644 --- a/Reseter2/Form1.cs +++ b/Reseter2/Form1.cs @@ -29,6 +29,7 @@ namespace Reseter2 public event saveSetting Save; public delegate void updateSetting(); public event updateSetting UpdateSetting; + public Form1() { @@ -96,7 +97,18 @@ namespace Reseter2 private void bt_reset_Click(object sender, EventArgs e) { - Reseter.AddTask(cb_comp.Text); + if(cb_comp.SelectedIndex < 0) + { + Reseter.AddTask(cb_comp.Text); + } + else + { + Reseter.AddTask(SSeaher.seaherMetod.Result(cb_comp.SelectedIndex)); + } + cb_comp.SelectedIndex = -1; + cb_comp.Text = ""; + + tabControl1.SelectedIndex = 0; } @@ -137,10 +149,7 @@ namespace Reseter2 lb_history.DisplayMember = "ToStr"; } - private void RebootItem_Click(object sender, EventArgs e) - { - - } + private void sm_RebootItem_Click(object sender, EventArgs e) { @@ -527,14 +536,28 @@ namespace Reseter2 private void cb_comp_TextUpdate(object sender, EventArgs e) { + Cursor.Current = Cursors.Default; if(sender is ComboBox) { - ComboBox comboBox = sender as ComboBox; - SSeaher.seaherMetod.Change(comboBox.Text); + ComboBox comboBox = (ComboBox)sender; + SSeaher.seaherMetod.Change(cb_comp_ResultUpdate, comboBox.Text); } - } + public void cb_comp_ResultUpdate(List Items) + { + if(cb_comp.Items.Count != Items.Count) cb_comp.DroppedDown = false; + cb_comp.Items.Clear(); + cb_comp.Items.AddRange(Items.ToArray()); + // cb_comp.AutoCompleteCustomSource.Clear(); + // cb_comp.AutoCompleteCustomSource.AddRange(Items.ToArray()); + + // cb_comp.AutoCompleteMode = AutoCompleteMode.None; + cb_comp.SelectionStart = cb_comp.Text.Length; + cb_comp.DroppedDown = true; + cb_comp.SelectedIndex = -1; + + } } } diff --git a/Reseter2/Form1.resx b/Reseter2/Form1.resx index 1dce32e..ff5d5fb 100644 --- a/Reseter2/Form1.resx +++ b/Reseter2/Form1.resx @@ -131,7 +131,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlY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WAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA diff --git a/Reseter2/Reseter2.csproj b/Reseter2/Reseter2.csproj index 568ac04..4800d65 100644 --- a/Reseter2/Reseter2.csproj +++ b/Reseter2/Reseter2.csproj @@ -56,7 +56,7 @@ False - bin\Debug\MySql.Data.dll + .\MySql.Data.dll diff --git a/Reseter2/SCCMsearch/SQLconnector.cs b/Reseter2/SCCMsearch/SQLconnector.cs index 55e822a..ca9d02f 100644 --- a/Reseter2/SCCMsearch/SQLconnector.cs +++ b/Reseter2/SCCMsearch/SQLconnector.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using MySql.Data; namespace Reseter2.SCCMsearch { diff --git a/Reseter2/Seacher/ISeaherMetod.cs b/Reseter2/Seacher/ISeaherMetod.cs index 68e05ea..3897436 100644 --- a/Reseter2/Seacher/ISeaherMetod.cs +++ b/Reseter2/Seacher/ISeaherMetod.cs @@ -3,13 +3,13 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using static Reseter2.Seacher.SeahcLocal; namespace Reseter2.Seacher { internal interface ISeaherMetod { - public void Change(string seach); - public List ResultSeach(); + public void Change(ResultUpdate sender, string seach); public IComp Result(int index); } } diff --git a/Reseter2/Seacher/SeahcLocal.cs b/Reseter2/Seacher/SeahcLocal.cs index 357153c..b574d40 100644 --- a/Reseter2/Seacher/SeahcLocal.cs +++ b/Reseter2/Seacher/SeahcLocal.cs @@ -1,4 +1,5 @@ -using System; +using Reseter2.History; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -8,17 +9,47 @@ namespace Reseter2.Seacher { internal class SeahcLocal : ISeaherMetod { - public void Change(string seach) + internal delegate void ResultUpdate(List Item); + private ResultUpdate Update; + List comps = new List(); + public void Change(ResultUpdate sender, string seach) { + Update = sender; + if (seach.Length > 2) + { + + Update(ResultSeach(seach)); + } + else + { + List result = new List(); + result.Add("Введите запрос"); + Update(result); + } } - public List ResultSeach() + public List ResultSeach(string seach) { - return null; + int i = 0; + comps.Clear(); + List result = new List(); + foreach(HistoryItem item in HistoryList.Hitem) + { + if (item.NameNode().Contains(seach)) + { + result.Add(item.NameNode()); + comps.Add(item.GetComp()); + ++i; + if (i>6) return result; + } + + } + if(i == 0) result.Add("Ничего не найдено"); + return result; } public IComp Result(int index) { - return null; + return comps[index]; } } } diff --git a/Reseter2/Setting/SGlobalSetting.cs b/Reseter2/Setting/SGlobalSetting.cs index 6aca581..89f7397 100644 --- a/Reseter2/Setting/SGlobalSetting.cs +++ b/Reseter2/Setting/SGlobalSetting.cs @@ -1,4 +1,5 @@ using Reseter2.History; +using Reseter2.Seacher; using Reseter2.Words; using System; using System.Collections.Generic; @@ -41,7 +42,7 @@ namespace Reseter2.Setting if (setting.settingSCCM != null) settingSCCM = setting.settingSCCM; if (setting.settingReboot != null) settingReboot = setting.settingReboot; HistoryList.Hitem = setting.historyItems; - + SSeaher.LoadSetting(); // return output; }