diff --git a/Reseter2/Form1.cs b/Reseter2/Form1.cs index 32cf963..a841968 100644 --- a/Reseter2/Form1.cs +++ b/Reseter2/Form1.cs @@ -108,9 +108,9 @@ namespace Reseter2 { Reseter.AddTask(tb_comp.Text.Trim()); tabControl1.SelectedIndex = 0; - ListComp.SelectedIndex = -1; StopRefreshSeacher = true; tb_comp.Text = ""; + ListComp.SelectedIndex = -1; ListComp.Items.Clear(); ListComp.Items.Add("Введите запрос"); ListComp.Enabled = false; @@ -133,9 +133,9 @@ namespace Reseter2 { Reseter.AddTask(CompSelected); tabControl1.SelectedIndex = 0; - ListComp.SelectedIndex = -1; StopRefreshSeacher = true; tb_comp.Text = ""; + ListComp.SelectedIndex = -1; ListComp.Items.Clear(); ListComp.Items.Add("Введите запрос"); ListComp.ItemHeight = 14; @@ -597,7 +597,16 @@ namespace Reseter2 private void ListComp_ChangeIndex(object sender, EventArgs e) { - + if(ListComp.SelectedIndex > -1) + { + StopRefreshSeacher = true; + CompSelected = SSeaher.seaherMetod.Result(ListComp.SelectedIndex); + tb_comp.Text = SSeaher.seaherMetod.ResultString(ListComp.SelectedIndex); + PreSelected = ListComp.SelectedIndex; + ListComp.Refresh(); + StopRefreshSeacher = false; + } + } @@ -674,10 +683,14 @@ namespace Reseter2 bt_reset_Click(null, null); break; } - if (PreSelected >= 0) + else if (PreSelected >= 0) { ListComp.SelectedIndex = PreSelected; e.SuppressKeyPress = true; + StopRefreshSeacher = true; + CompSelected = SSeaher.seaherMetod.Result(ListComp.SelectedIndex); + tb_comp.Text = SSeaher.seaherMetod.ResultString(ListComp.SelectedIndex); + StopRefreshSeacher = false; ListComp.Refresh(); } diff --git a/Reseter2/Reseter2.csproj b/Reseter2/Reseter2.csproj index 4653778..dc7d5cd 100644 --- a/Reseter2/Reseter2.csproj +++ b/Reseter2/Reseter2.csproj @@ -70,10 +70,11 @@ Properties\app.manifest - true + false - Klavirshik.pfx + + 9A04F507AAE2666E7DAF9DC3357A574132BA2697 @@ -249,7 +250,6 @@ WordsItemControl.cs - SettingsSingleFileGenerator diff --git a/Reseter2/Seacher/SeachSCCM.cs b/Reseter2/Seacher/SeachSCCM.cs index 525f01b..69c5ea3 100644 --- a/Reseter2/Seacher/SeachSCCM.cs +++ b/Reseter2/Seacher/SeachSCCM.cs @@ -27,7 +27,7 @@ namespace Reseter2.Seacher private Mode mode; private Timer TimerDisconnect; - private enum Mode{ + public enum Mode{ PCname, Login, Username diff --git a/Reseter2/Seacher/SeahcLocal.cs b/Reseter2/Seacher/SeahcLocal.cs index c6c62f5..72aa9ae 100644 --- a/Reseter2/Seacher/SeahcLocal.cs +++ b/Reseter2/Seacher/SeahcLocal.cs @@ -12,6 +12,7 @@ namespace Reseter2.Seacher internal delegate void ResultUpdate(List Item, bool eneble, int itemHeight); private ResultUpdate Update; private List comps = new List(); + private List ResultStr = new List(); private bool enable; public void Change(ResultUpdate sender, string seach) { @@ -33,6 +34,7 @@ namespace Reseter2.Seacher { int i = 0; comps.Clear(); + ResultStr.Clear(); List result = new List(); foreach(HistoryItem item in HistoryList.Hitem) { @@ -47,6 +49,23 @@ namespace Reseter2.Seacher { result.Add(item.NameNode()); comps.Add(item.GetComp()); + int razdelitel = item.NameNode().IndexOf('('); + if (razdelitel != -1) + { + int beginString = item.NameNode().ToUpper().IndexOf(seach.ToUpper()); + if (razdelitel < beginString) + { + ResultStr.Add(item.NameNode().Substring(razdelitel + 1, item.NameNode().Length - razdelitel - 2)); + } + else + { + ResultStr.Add(item.NameNode().Substring(0, razdelitel)); + } + } + else + { + ResultStr.Add(item.NameNode()); + } ++i; enable = true; if (i>6) return result; @@ -69,18 +88,20 @@ namespace Reseter2.Seacher public string ResultString(int index) { - string buf; - if (comps[index].GetName() == null) - { - buf = comps[index].GetNetNameStr(); - } - else - { - buf = comps[index].GetName(); - if (comps[index].GetNetNameStr() != null) buf += "(" + comps[index].GetNetNameStr() + ")"; - } - return buf; + return ResultStr[index]; + //string buf; + //if (comps[index].GetName() == null) + //{ + // buf = comps[index].GetNetNameStr(); + //} + //else + //{ + // buf = comps[index].GetName(); + // if (comps[index].GetNetNameStr() != null) buf += "(" + comps[index].GetNetNameStr() + ")"; + + //} + //return buf; } } }