This commit is contained in:
klavirshik 2024-08-30 02:41:46 +02:00
parent 38b5531fb0
commit cd24abb4ea
9 changed files with 236 additions and 155 deletions

View File

@ -44,6 +44,8 @@
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();
@ -57,6 +59,9 @@
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();
@ -64,11 +69,6 @@
this.cm_words = new System.Windows.Forms.ContextMenuStrip(this.components); this.cm_words = new System.Windows.Forms.ContextMenuStrip(this.components);
this.WordsReboot = new System.Windows.Forms.ToolStripMenuItem(); this.WordsReboot = new System.Windows.Forms.ToolStripMenuItem();
this.tb_comp = new System.Windows.Forms.TextBox(); this.tb_comp = new System.Windows.Forms.TextBox();
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.statusStrip1.SuspendLayout(); this.statusStrip1.SuspendLayout();
@ -195,7 +195,6 @@
this.flowLayoutPanel1.Size = new System.Drawing.Size(396, 657); this.flowLayoutPanel1.Size = new System.Drawing.Size(396, 657);
this.flowLayoutPanel1.TabIndex = 0; this.flowLayoutPanel1.TabIndex = 0;
this.flowLayoutPanel1.WrapContents = false; this.flowLayoutPanel1.WrapContents = false;
this.flowLayoutPanel1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.tabControl1_MouseClick);
// //
// tabPage2 // tabPage2
// //
@ -233,6 +232,35 @@
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);
//
// imageList1 // imageList1
// //
this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream"))); this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
@ -377,7 +405,27 @@
this.tabPage4.TabIndex = 3; this.tabPage4.TabIndex = 3;
this.tabPage4.Text = "Настройки"; this.tabPage4.Text = "Настройки";
this.tabPage4.UseVisualStyleBackColor = true; this.tabPage4.UseVisualStyleBackColor = true;
this.tabPage4.MouseClick += new System.Windows.Forms.MouseEventHandler(this.tabControl1_MouseClick); //
// 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
// //
@ -400,7 +448,6 @@
this.tabPage5.TabIndex = 4; this.tabPage5.TabIndex = 4;
this.tabPage5.Text = "О программе"; this.tabPage5.Text = "О программе";
this.tabPage5.UseVisualStyleBackColor = true; this.tabPage5.UseVisualStyleBackColor = true;
this.tabPage5.MouseClick += new System.Windows.Forms.MouseEventHandler(this.tabControl1_MouseClick);
// //
// pictureBox1 // pictureBox1
// //
@ -443,59 +490,6 @@
this.tb_comp.MouseClick += new System.Windows.Forms.MouseEventHandler(this.tb_comp_MouseClick); this.tb_comp.MouseClick += new System.Windows.Forms.MouseEventHandler(this.tb_comp_MouseClick);
this.tb_comp.TextChanged += new System.EventHandler(this.cb_comp_TextUpdate); this.tb_comp.TextChanged += new System.EventHandler(this.cb_comp_TextUpdate);
this.tb_comp.Enter += new System.EventHandler(this.tb_comp_Enter); this.tb_comp.Enter += new System.EventHandler(this.tb_comp_Enter);
this.tb_comp.Leave += new System.EventHandler(this.tb_comp_Leave);
this.tb_comp.MouseCaptureChanged += new System.EventHandler(this.control_MouseCaptureChanged);
//
// 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
// //

View File

@ -30,7 +30,7 @@ namespace Reseter2
public delegate void updateSetting(); public delegate void updateSetting();
public event updateSetting UpdateSetting; public event updateSetting UpdateSetting;
private ListBox ListComp; private ListBox ListComp;
private bool listFocus; private IComp CompSelected = null;
public Form1() public Form1()
{ {
@ -59,16 +59,9 @@ namespace Reseter2
WordsList.MainCategory = SGlobalSetting.LoadWords(); WordsList.MainCategory = SGlobalSetting.LoadWords();
ListComp = new ListBox(); ListComp = new ListBox();
this.Controls.Add(ListComp); this.Controls.Add(ListComp);
ListComp.LostFocus += tb_comp_Leave;
ListComp.GotFocus += tb_comp_Enter; ListComp.GotFocus += tb_comp_Enter;
// ListComp.Enter += tb_comp_Enter;
// ListComp.MouseClick += tb_comp_MouseClick;
InitializeComponent(); InitializeComponent();
this.Save += settingWordsControl1.Save; this.Save += settingWordsControl1.Save;
this.Save += settingSCCMControl1.Save; this.Save += settingSCCMControl1.Save;
@ -84,7 +77,10 @@ namespace Reseter2
ListComp.Location = new Point(tb_comp.Location.X, tb_comp.Location.Y + tb_comp.Height); ListComp.Location = new Point(tb_comp.Location.X, tb_comp.Location.Y + tb_comp.Height);
ListComp.Width = tb_comp.Width; ListComp.Width = tb_comp.Width;
ListComp.Visible = false; ListComp.Visible = false;
ListComp.Height = ListComp.ItemHeight * 2;
ListComp.Items.Add("Введите запрос");
ListComp.SelectedIndexChanged += ListComp_ChangeIndex;
ListComp.Enabled = false;
//tb_comp.Controls.Add(ListComp); //tb_comp.Controls.Add(ListComp);
@ -115,19 +111,31 @@ namespace Reseter2
private void bt_reset_Click(object sender, EventArgs e) private void bt_reset_Click(object sender, EventArgs e)
{ {
//if(cb_comp.SelectedIndex < 0) if (CompSelected == null)
//{ {
// Reseter.AddTask(cb_comp.Text); DialogResult result = MessageBox.Show("Перезагрузить ПК: " + tb_comp.Text, "Создание новой задачи", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
//} if (result == DialogResult.Yes)
//else {
//{ Reseter.AddTask(tb_comp.Text);
// Reseter.AddTask(SSeaher.seaherMetod.Result(cb_comp.SelectedIndex)); tabControl1.SelectedIndex = 0;
//} ListComp.SelectedIndex = -1;
//cb_comp.SelectedIndex = -1; tb_comp.Text = "";
//cb_comp.Text = ""; tabControl1.SelectedIndex = 0;
}
tabControl1.SelectedIndex = 0; }
else
{
DialogResult result = MessageBox.Show("Перезагрузить ПК: " + CompSelected.GetNetNameStr(), "Создание новой задачи", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
if (result == DialogResult.Yes)
{
Reseter.AddTask(CompSelected);
tabControl1.SelectedIndex = 0;
ListComp.SelectedIndex = -1;
tb_comp.Text = "";
tabControl1.SelectedIndex = 0;
}
}
} }
private void timer1_Tick(object sender, EventArgs e) private void timer1_Tick(object sender, EventArgs e)
@ -317,10 +325,6 @@ namespace Reseter2
} }
} }
private void treeView1_DoubleClick(object sender, EventArgs e)
{
}
private void treeView1_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e) private void treeView1_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
{ {
@ -385,17 +389,6 @@ namespace Reseter2
} }
private void treeView1_MouseCaptureChanged(object sender, EventArgs e)
{
// System.Diagnostics.Debug.WriteLine(sender.ToString());
//TreeView tree = (TreeView)sender;
//treeView1_treeViewChangeCheckBox(tree.Nodes[0]);
}
private List<IComp> treeViewCheckOn(TreeNode node) private List<IComp> treeViewCheckOn(TreeNode node)
{ {
List<IComp> comps = new List<IComp>(); List<IComp> comps = new List<IComp>();
@ -483,11 +476,6 @@ namespace Reseter2
} }
} }
private void label7_Click(object sender, EventArgs e)
{
}
private void button4_Click(object sender, EventArgs e) private void button4_Click(object sender, EventArgs e)
{ {
Save(); Save();
@ -556,62 +544,41 @@ namespace Reseter2
private void cb_comp_TextUpdate(object sender, EventArgs e) private void cb_comp_TextUpdate(object sender, EventArgs e)
{ {
Cursor.Current = Cursors.Default; Cursor.Current = Cursors.Default;
if (sender is ComboBox) if (sender is TextBox)
{ {
ComboBox comboBox = (ComboBox)sender; TextBox textBox = (TextBox)sender;
SSeaher.seaherMetod.Change(cb_comp_ResultUpdate, comboBox.Text); SSeaher.seaherMetod.Change(cb_comp_ResultUpdate, textBox.Text);
CompSelected = null;
} }
} }
public void cb_comp_ResultUpdate(List<string> Items) public void cb_comp_ResultUpdate(List<string> Items, bool enable)
{ {
// if(cb_comp.Items.Count != Items.Count) cb_comp.DroppedDown = false; if (ListComp.Items.Count != Items.Count) ListComp.Height = ListComp.ItemHeight * (Items.Count+1) ;
// cb_comp.Items.Clear(); ListComp.Items.Clear();
// cb_comp.Items.AddRange(Items.ToArray()); ListComp.Items.AddRange(Items.ToArray());
//// cb_comp.AutoCompleteCustomSource.Clear(); ListComp.Enabled = enable;
//// cb_comp.AutoCompleteCustomSource.AddRange(Items.ToArray()); // ListComp.Visible = true;
// // cb_comp.AutoCompleteMode = AutoCompleteMode.None;
// cb_comp.SelectionStart = cb_comp.Text.Length;
// cb_comp.DroppedDown = true;
// cb_comp.SelectedIndex = -1;
} }
private void tb_comp_Enter(object sender, EventArgs e) private void tb_comp_Enter(object sender, EventArgs e)
{ {
ListComp.Visible = true; // ListComp.Visible = true;
} }
private void tb_comp_MouseClick(object sender, MouseEventArgs e) private void tb_comp_MouseClick(object sender, MouseEventArgs e)
{ {
ListComp.Visible = true; ListComp.Visible = true;
System.Console.WriteLine("click");
} }
private void tb_comp_Leave(object sender, EventArgs e)
{
// System.Console.WriteLine("leav" + ListComp.Focused.ToString());
// if (!listFocus) ListComp.Visible = false;
//listFocus = false;
// if (!ListComp.Focused) ListComp.Visible = false; private void ListComp_ChangeIndex(object sender, EventArgs e)
}
private void tabControl1_MouseClick(object sender, MouseEventArgs e)
{ {
//ListComp.foc CompSelected = SSeaher.seaherMetod.Result(ListComp.SelectedIndex);
// ListComp.Visible = false; tb_comp.Text = ListComp.SelectedItem.ToString();
}
private void control_MouseCaptureChanged(object sender, EventArgs e)
{
Point clickPoint = ListComp.PointToClient(Cursor.Position);
if (!ListComp.Bounds.Contains(clickPoint))
{
// System.Console.WriteLine("out");
}
} }
protected override void WndProc(ref Message m) protected override void WndProc(ref Message m)
@ -623,7 +590,7 @@ namespace Reseter2
{ {
ListComp.Visible = false; ListComp.Visible = false;
} }
System.Console.WriteLine("clickers"); // System.Console.WriteLine("clickers");
} }
base.WndProc(ref m); base.WndProc(ref m);

View File

@ -131,7 +131,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3Jtcyw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 -102,6 +102,7 @@
<Compile Include="SCCMsearch\IAuthType.cs" /> <Compile Include="SCCMsearch\IAuthType.cs" />
<Compile Include="SCCMsearch\SQLconnector.cs" /> <Compile Include="SCCMsearch\SQLconnector.cs" />
<Compile Include="Seacher\ISeaherMetod.cs" /> <Compile Include="Seacher\ISeaherMetod.cs" />
<Compile Include="Seacher\SeachSCCM.cs" />
<Compile Include="Seacher\SeahcLocal.cs" /> <Compile Include="Seacher\SeahcLocal.cs" />
<Compile Include="Seacher\SSeaher.cs" /> <Compile Include="Seacher\SSeaher.cs" />
<Compile Include="Setting\SettingExpand.cs" /> <Compile Include="Setting\SettingExpand.cs" />

View File

@ -12,7 +12,7 @@ namespace Reseter2.SCCMsearch
{ {
private MySql.Data.MySqlClient.MySqlConnection Connection; private MySql.Data.MySqlClient.MySqlConnection Connection;
private IAuthType AuthType; private IAuthType AuthType;
SQLconnector() public SQLconnector()
{ {
if (SGlobalSetting.settingSCCM.windowsAuth) if (SGlobalSetting.settingSCCM.windowsAuth)
{ {

View File

@ -11,5 +11,8 @@ namespace Reseter2.Seacher
{ {
public void Change(ResultUpdate sender, string seach); public void Change(ResultUpdate sender, string seach);
public IComp Result(int index); public IComp Result(int index);
public void Activate();
public void Deactivate();
} }
} }

View File

@ -14,7 +14,7 @@ namespace Reseter2.Seacher
{ {
if(SGlobalSetting.settingSCCM.on) if(SGlobalSetting.settingSCCM.on)
{ {
seaherMetod = new SeachSCCM();
} }
else else
{ {

View File

@ -0,0 +1,99 @@
using MySql.Data.MySqlClient;
using MySqlX.XDevAPI.Relational;
using Reseter2.SCCMsearch;
using Reseter2.Setting;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using static Reseter2.Seacher.SeahcLocal;
namespace Reseter2.Seacher
{
internal class SeachSCCM : ISeaherMetod
{
private MySql.Data.MySqlClient.MySqlConnection Connection;
private IAuthType AuthType;
private ResultUpdate Update;
private bool enable;
public SeachSCCM()
{
if (SGlobalSetting.settingSCCM.windowsAuth)
{
AuthType = new AuthWin();
}
else
{
AuthType = new AuthLogin();
}
}
public void Change(ResultUpdate sender, string seach)
{
Activate();
Update = sender;
if (seach.Length > 2)
{
Update(ResultSeach(seach), enable);
}
else
{
List<string> result = new List<string>();
result.Add("Введите запрос");
Update(result, false);
}
}
public List<string> ResultSeach(string seach)
{
string sql = "SELECT * FROM " + SGlobalSetting.settingSCCM.dataBase + " WHERE pcname LIKE " + seach;
MySqlCommand sqlCom = new MySqlCommand(sql, Connection);
// Connection.Open();
sqlCom.ExecuteNonQuery();
MySqlDataAdapter dataAdapter = new MySqlDataAdapter(sqlCom);
DataTable dt = new DataTable();
dataAdapter.Fill(dt);
var myData = dt.Select();
//for (int i = 0; i < myData.Length; i++)
//{
// for (int j = 0; j < myData[i].ItemArray.Length; j++)
// richTextBox1.Text += myData[i].ItemArray[j] + " ";
// richTextBox1.Text += "\n";
//}
return null;
}
public void Activate()
{
if (Connection == null)
{
string stringConnect = "server=" + SGlobalSetting.settingSCCM.server + ";database=" + SGlobalSetting.settingSCCM.dataBase + ";" + AuthType.AuthString();
try
{
Connection = new MySql.Data.MySqlClient.MySqlConnection(stringConnect);
Connection.Open();
}
catch
{
Console.WriteLine("Повторное бы подключение");
}
}
}
public void Deactivate()
{
Connection.Close();
Connection = null;
}
public IComp Result(int Index)
{
return null;
}
}
}

View File

@ -9,22 +9,23 @@ namespace Reseter2.Seacher
{ {
internal class SeahcLocal : ISeaherMetod internal class SeahcLocal : ISeaherMetod
{ {
internal delegate void ResultUpdate(List<string> Item); internal delegate void ResultUpdate(List<string> Item, bool eneble);
private ResultUpdate Update; private ResultUpdate Update;
List<IComp> comps = new List<IComp>(); private List<IComp> comps = new List<IComp>();
private bool enable;
public void Change(ResultUpdate sender, string seach) public void Change(ResultUpdate sender, string seach)
{ {
Update = sender; Update = sender;
if (seach.Length > 2) if (seach.Length > 2)
{ {
Update(ResultSeach(seach)); Update(ResultSeach(seach), enable);
} }
else else
{ {
List<string> result = new List<string>(); List<string> result = new List<string>();
result.Add("Введите запрос"); result.Add("Введите запрос");
Update(result); Update(result,false);
} }
} }
@ -35,21 +36,37 @@ namespace Reseter2.Seacher
List<string> result = new List<string>(); List<string> result = new List<string>();
foreach(HistoryItem item in HistoryList.Hitem) foreach(HistoryItem item in HistoryList.Hitem)
{ {
if (item.NameNode().Contains(seach)) if (item.NameNode().ToUpper().Contains(seach.ToUpper()))
{ {
result.Add(item.NameNode()); int y = 0;
comps.Add(item.GetComp()); foreach(string itemOk in result)
++i; {
if (i>6) return result; if (itemOk.ToUpper() == item.NameNode().ToUpper()) ++y;
}
if(y == 0)
{
result.Add(item.NameNode());
comps.Add(item.GetComp());
++i;
enable = true;
if (i>6) return result;
}
} }
} }
if(i == 0) result.Add("Ничего не найдено"); if (i == 0)
{
enable = false;
result.Add("Ничего не найдено");
}
return result; return result;
} }
public IComp Result(int index) public IComp Result(int index)
{ {
return comps[index]; return comps[index];
} }
public void Activate() { }
public void Deactivate() { }
} }
} }