Пилим поиск по cssm
This commit is contained in:
parent
ca9409a95e
commit
1b05d2ed0d
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -35,7 +35,7 @@ namespace Remontor.Connector
|
|||
SConnector.FormMain.Width = 3840;
|
||||
SConnector.FormMain.Height = 1040;
|
||||
SConnector.FormMain.Location = new System.Drawing.Point(0, 0);
|
||||
MoveWindow(Proc.MainWindowHandle, View.Bounds.X, View.Bounds.Y - 0, View.Bounds.Width, View.Bounds.Height, true);
|
||||
MoveWindow(Proc.MainWindowHandle, View.Bounds.X, View.Bounds.Y + 9, View.Bounds.Width, View.Bounds.Height - 9, true);
|
||||
}
|
||||
|
||||
public override IModeMon Change(IModeMon Mode)
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ namespace Remontor.Connector
|
|||
public DobleMonOne() { }
|
||||
public override void Resize(Process Proc, Control View)
|
||||
{
|
||||
MoveWindow(Proc.MainWindowHandle, View.Bounds.X, View.Bounds.Y - 4, View.Bounds.Width * 2, View.Bounds.Height, true);
|
||||
MoveWindow(Proc.MainWindowHandle, View.Bounds.X, View.Bounds.Y + 9, View.Bounds.Width * 2, View.Bounds.Height - 9, true);
|
||||
}
|
||||
public override IModeMon Change(IModeMon Mode)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ namespace Remontor.Connector
|
|||
public DobleMonTwo() { }
|
||||
public override void Resize(Process Proc, Control View)
|
||||
{
|
||||
MoveWindow(Proc.MainWindowHandle, View.Bounds.X - View.Bounds.Width, View.Bounds.Y - 4, View.Bounds.Width * 2, View.Bounds.Height, true);
|
||||
MoveWindow(Proc.MainWindowHandle, View.Bounds.X - View.Bounds.Width, View.Bounds.Y + 9, View.Bounds.Width * 2, View.Bounds.Height - 9, true);
|
||||
}
|
||||
public override IModeMon Change(IModeMon Mode)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ namespace Remontor.Connector
|
|||
public OneMon() { }
|
||||
public override void Resize(Process Proc, Control View)
|
||||
{
|
||||
MoveWindow(Proc.MainWindowHandle, View.Bounds.X, View.Bounds.Y + 9, View.Bounds.Width, View.Bounds.Height, true);
|
||||
MoveWindow(Proc.MainWindowHandle, View.Bounds.X, View.Bounds.Y + 9, View.Bounds.Width, View.Bounds.Height - 9, true);
|
||||
}
|
||||
public override IModeMon Change(IModeMon Mode)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -24,7 +24,15 @@ namespace Remontor.Finder
|
|||
|
||||
private void ConnectBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
SConnector.NewConnect(new CompId(CompNameLB.Text));
|
||||
|
||||
if(SelectedItem != null)
|
||||
{
|
||||
SConnector.NewConnect(SelectedItem.seacherResult.Result());
|
||||
}
|
||||
else
|
||||
{
|
||||
SConnector.NewConnect(new CompId(CompNameLB.Text));
|
||||
}
|
||||
this.Close();
|
||||
}
|
||||
|
||||
|
|
@ -59,6 +67,12 @@ namespace Remontor.Finder
|
|||
|
||||
private void UpdateActiv(SessionItemControl sessionItem)
|
||||
{
|
||||
if(SelectedItem == sessionItem)
|
||||
{
|
||||
SConnector.NewConnect(SelectedItem.seacherResult.Result());
|
||||
this.Close();
|
||||
return;
|
||||
}
|
||||
if(SelectedItem != null) SelectedItem.SelectActiv(null);
|
||||
if(PreSelected > -1)((SessionItemControl)SeaherPanel.Controls[PreSelected]).SelectPreActiv(null);
|
||||
SelectedItem = sessionItem;
|
||||
|
|
@ -72,54 +86,66 @@ namespace Remontor.Finder
|
|||
|
||||
private void CompNameLB_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
switch (e.KeyValue)
|
||||
if (SeaherPanel.Controls[0] is SessionItemControl)
|
||||
{
|
||||
case 40:
|
||||
if (PreSelected < SeaherPanel.Controls.Count - 1)
|
||||
if (!(((SessionItemControl)SeaherPanel.Controls[0]).seacherResult is NoResult))
|
||||
{
|
||||
switch (e.KeyValue)
|
||||
{
|
||||
SelectedItem = null;
|
||||
if (PreSelected > -1) ((SessionItemControl)SeaherPanel.Controls[PreSelected]).SelectPreActiv(null);
|
||||
++PreSelected;
|
||||
SeaherPanel.ScrollControlIntoView(SeaherPanel.Controls[PreSelected]);
|
||||
((SessionItemControl)SeaherPanel.Controls[PreSelected]).SelectPreActiv((SessionItemControl)SeaherPanel.Controls[PreSelected]);
|
||||
}
|
||||
e.SuppressKeyPress = true;
|
||||
break;
|
||||
case 38:
|
||||
if (PreSelected > 0)
|
||||
{
|
||||
SelectedItem = null;
|
||||
if (PreSelected > -1) ((SessionItemControl)SeaherPanel.Controls[PreSelected]).SelectPreActiv(null);
|
||||
--PreSelected;
|
||||
SeaherPanel.ScrollControlIntoView(SeaherPanel.Controls[PreSelected]);
|
||||
((SessionItemControl)SeaherPanel.Controls[PreSelected]).SelectPreActiv((SessionItemControl)SeaherPanel.Controls[PreSelected]);
|
||||
}
|
||||
case 40:
|
||||
if (PreSelected < SeaherPanel.Controls.Count - 1)
|
||||
{
|
||||
SelectedItem = null;
|
||||
if (PreSelected > -1) ((SessionItemControl)SeaherPanel.Controls[PreSelected]).SelectPreActiv(null);
|
||||
++PreSelected;
|
||||
SeaherPanel.ScrollControlIntoView(SeaherPanel.Controls[PreSelected]);
|
||||
((SessionItemControl)SeaherPanel.Controls[PreSelected]).SelectPreActiv((SessionItemControl)SeaherPanel.Controls[PreSelected]);
|
||||
}
|
||||
e.SuppressKeyPress = true;
|
||||
break;
|
||||
case 38:
|
||||
if (PreSelected > 0)
|
||||
{
|
||||
SelectedItem = null;
|
||||
if (PreSelected > -1) ((SessionItemControl)SeaherPanel.Controls[PreSelected]).SelectPreActiv(null);
|
||||
--PreSelected;
|
||||
SeaherPanel.ScrollControlIntoView(SeaherPanel.Controls[PreSelected]);
|
||||
((SessionItemControl)SeaherPanel.Controls[PreSelected]).SelectPreActiv((SessionItemControl)SeaherPanel.Controls[PreSelected]);
|
||||
}
|
||||
|
||||
e.SuppressKeyPress = true;
|
||||
//ListComp.Refresh();
|
||||
break;
|
||||
case 13:
|
||||
if ((SessionItemControl)SeaherPanel.Controls[PreSelected] == SelectedItem)
|
||||
{
|
||||
|
||||
//bt_reset_Click(null, null);
|
||||
break;
|
||||
}
|
||||
if (PreSelected >= 0)
|
||||
{
|
||||
if (SelectedItem != null) SelectedItem.SelectActiv(null);
|
||||
SelectedItem = (SessionItemControl)SeaherPanel.Controls[PreSelected];
|
||||
((SessionItemControl)SeaherPanel.Controls[PreSelected]).SelectActiv((SessionItemControl)SeaherPanel.Controls[PreSelected]);
|
||||
StopRefreshSeacher = true;
|
||||
CompNameLB.Focus();
|
||||
CompNameLB.Text = ((SessionItemControl)SeaherPanel.Controls[PreSelected]).seacherResult.ResultString();
|
||||
CompNameLB.Select(CompNameLB.Text.Length, 0);
|
||||
StopRefreshSeacher = false;
|
||||
e.SuppressKeyPress = true;
|
||||
//ListComp.Refresh();
|
||||
break;
|
||||
case 13:
|
||||
if (PreSelected > -1)
|
||||
{
|
||||
if ((SessionItemControl)SeaherPanel.Controls[PreSelected] == SelectedItem)
|
||||
{
|
||||
|
||||
e.SuppressKeyPress = true;
|
||||
//bt_reset_Click(null, null);
|
||||
SConnector.NewConnect(SelectedItem.seacherResult.Result());
|
||||
this.Close();
|
||||
break;
|
||||
}
|
||||
if (PreSelected >= 0)
|
||||
{
|
||||
if (SelectedItem != null) SelectedItem.SelectActiv(null);
|
||||
SelectedItem = (SessionItemControl)SeaherPanel.Controls[PreSelected];
|
||||
((SessionItemControl)SeaherPanel.Controls[PreSelected]).SelectActiv((SessionItemControl)SeaherPanel.Controls[PreSelected]);
|
||||
StopRefreshSeacher = true;
|
||||
CompNameLB.Focus();
|
||||
CompNameLB.Text = ((SessionItemControl)SeaherPanel.Controls[PreSelected]).seacherResult.ResultString();
|
||||
CompNameLB.Select(CompNameLB.Text.Length, 0);
|
||||
StopRefreshSeacher = false;
|
||||
|
||||
e.SuppressKeyPress = true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -116,6 +116,7 @@
|
|||
<Compile Include="Seacher\ISeaherMetod.cs" />
|
||||
<Compile Include="Seacher\HistoryResult.cs" />
|
||||
<Compile Include="Seacher\NoResult.cs" />
|
||||
<Compile Include="Seacher\SCCMResult.cs" />
|
||||
<Compile Include="Seacher\SeachSCCM.cs" />
|
||||
<Compile Include="Seacher\SeahcLocal.cs" />
|
||||
<Compile Include="Seacher\SSeaher.cs" />
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ namespace Remontor.Seacher
|
|||
{
|
||||
private IComp Comp;
|
||||
private DateTime LastConnect;
|
||||
private string StrQuestion;
|
||||
public HistoryResult()
|
||||
{
|
||||
|
||||
|
|
@ -20,6 +21,13 @@ namespace Remontor.Seacher
|
|||
LastConnect = lastConnect;
|
||||
}
|
||||
|
||||
public HistoryResult(IComp comp, string lastConnect, string strQuestion)
|
||||
{
|
||||
Comp = comp;
|
||||
LastConnect = DateTime.Parse(lastConnect);
|
||||
StrQuestion = strQuestion;
|
||||
}
|
||||
|
||||
public IComp GetComp() {
|
||||
return Comp;
|
||||
}
|
||||
|
|
@ -32,7 +40,10 @@ namespace Remontor.Seacher
|
|||
{
|
||||
return Comp.GetNetNameStr();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// //////////////////
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public IComp Result()
|
||||
{
|
||||
return Comp;
|
||||
|
|
|
|||
|
|
@ -10,8 +10,7 @@ namespace Remontor.Seacher
|
|||
internal interface ISeaherMetod
|
||||
{
|
||||
void Change(ResultUpdate sender, string seach);
|
||||
IComp Result(int index);
|
||||
string ResultString(int index);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,58 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Remontor.Seacher
|
||||
{
|
||||
internal class SCCMResult : ISeacherResult
|
||||
{
|
||||
private IComp Comp;
|
||||
private DateTime LastConnect;
|
||||
private string StrQuestion;
|
||||
public SCCMResult()
|
||||
{
|
||||
|
||||
}
|
||||
public SCCMResult(IComp comp, DateTime lastConnect)
|
||||
{
|
||||
Comp = comp;
|
||||
LastConnect = lastConnect;
|
||||
}
|
||||
|
||||
public SCCMResult(IComp comp, string lastConnect, string strQuestion)
|
||||
{
|
||||
Comp = comp;
|
||||
LastConnect = DateTime.Parse(lastConnect);
|
||||
StrQuestion = strQuestion;
|
||||
}
|
||||
|
||||
public IComp GetComp()
|
||||
{
|
||||
return Comp;
|
||||
}
|
||||
|
||||
public DateTime GetLastConnect()
|
||||
{
|
||||
return LastConnect;
|
||||
}
|
||||
public string toString()
|
||||
{
|
||||
return Comp.GetNetNameStr();
|
||||
}
|
||||
/// <summary>
|
||||
/// //////////////////
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public IComp Result()
|
||||
{
|
||||
return Comp;
|
||||
}
|
||||
|
||||
public string ResultString()
|
||||
{
|
||||
return StrQuestion;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -20,7 +20,7 @@ namespace Remontor.Seacher
|
|||
{
|
||||
private SqlConnection Connection;
|
||||
private IAuthType AuthType;
|
||||
private List<IComp> comps = new List<IComp>();
|
||||
//private List<IComp> comps = new List<IComp>();
|
||||
private ResultUpdate Update;
|
||||
private bool enable;
|
||||
private string error;
|
||||
|
|
@ -119,11 +119,60 @@ namespace Remontor.Seacher
|
|||
}
|
||||
return result;
|
||||
}
|
||||
public List<string> ResultSeach(string seach)
|
||||
//public List<string> ResultSeach(string seach)
|
||||
//{
|
||||
// int y = 0;
|
||||
// comps.Clear();
|
||||
// List<string> result = new List<string>();
|
||||
// if (Connection.State == ConnectionState.Open && Connection != null)
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// string sql = QueryBilder(seach);
|
||||
// SqlCommand sqlCom = new SqlCommand(sql, Connection);
|
||||
// // Connection.Open();
|
||||
// sqlCom.ExecuteNonQuery();
|
||||
// SqlDataAdapter dataAdapter = new SqlDataAdapter(sqlCom);
|
||||
// DataTable dt = new DataTable();
|
||||
// dataAdapter.Fill(dt);
|
||||
|
||||
// DataRow[] myData = dt.Select();
|
||||
// for (int i = 0; i < myData.Length; i++)
|
||||
// {
|
||||
// HistoryResult itemResult = new HistoryResult(item.GetComp(), item.GetStart());
|
||||
// result.Add(itemResult);
|
||||
// IComp comp = new CompId(myData[i].ItemArray[0].ToString());
|
||||
// comp.SetName(myData[i].ItemArray[1].ToString());
|
||||
// comp.SetDescription(myData[i].ItemArray[2].ToString());
|
||||
// comps.Add(comp);
|
||||
// result.Add("ПК:"+ comp.GetNetNameStr() + " Логин:" + comp.GetName() + "\r\n" + comp.GetDescription() + "\r\nLastLogin:" + myData[i].ItemArray[3].ToString());
|
||||
// ++y;
|
||||
// }
|
||||
// enable = true;
|
||||
// }
|
||||
// catch
|
||||
// {
|
||||
// y = 1;
|
||||
// enable = false;
|
||||
// result.Clear();
|
||||
// result.Add("Ошибка выполнения запроса");
|
||||
// }
|
||||
|
||||
// }
|
||||
// if (y == 0)
|
||||
// {
|
||||
// enable = false;
|
||||
// result.Add("Ничего не найдено");
|
||||
// }
|
||||
// TimerDisconnect.Change(90000, 90000);
|
||||
// return result;
|
||||
//}
|
||||
|
||||
public List<ISeacherResult> ResultSeach(string seach)
|
||||
{
|
||||
int y = 0;
|
||||
comps.Clear();
|
||||
List<string> result = new List<string>();
|
||||
// comps.Clear();
|
||||
List<ISeacherResult> result = new List<ISeacherResult>();
|
||||
if (Connection.State == ConnectionState.Open && Connection != null)
|
||||
{
|
||||
try
|
||||
|
|
@ -139,11 +188,27 @@ namespace Remontor.Seacher
|
|||
DataRow[] myData = dt.Select();
|
||||
for (int i = 0; i < myData.Length; i++)
|
||||
{
|
||||
|
||||
// result.Add(itemResult);
|
||||
IComp comp = new CompId(myData[i].ItemArray[0].ToString());
|
||||
comp.SetName(myData[i].ItemArray[1].ToString());
|
||||
comp.SetDescription(myData[i].ItemArray[2].ToString());
|
||||
comps.Add(comp);
|
||||
result.Add("ПК:"+ comp.GetNetNameStr() + " Логин:" + comp.GetName() + "\r\n" + comp.GetDescription() + "\r\nLastLogin:" + myData[i].ItemArray[3].ToString());
|
||||
// comps.Add(comp);
|
||||
string quest = "";
|
||||
switch (mode)
|
||||
{
|
||||
case Mode.Login:
|
||||
quest = comp.GetName();
|
||||
break;
|
||||
case Mode.Username:
|
||||
quest = comp.GetDescription();
|
||||
break;
|
||||
case Mode.PCname:
|
||||
quest = comp.GetNetNameStr();
|
||||
break;
|
||||
}
|
||||
SCCMResult itemResult = new SCCMResult(comp, myData[i].ItemArray[3].ToString(), quest);
|
||||
result.Add(itemResult);
|
||||
++y;
|
||||
}
|
||||
enable = true;
|
||||
|
|
@ -153,14 +218,14 @@ namespace Remontor.Seacher
|
|||
y = 1;
|
||||
enable = false;
|
||||
result.Clear();
|
||||
result.Add("Ошибка выполнения запроса");
|
||||
result.Add(new NoResult("Ничего не найдено"));
|
||||
}
|
||||
|
||||
}
|
||||
if (y == 0)
|
||||
{
|
||||
enable = false;
|
||||
result.Add("Ничего не найдено");
|
||||
result.Add(new NoResult("Ничего не найдено"));
|
||||
}
|
||||
TimerDisconnect.Change(90000, 90000);
|
||||
return result;
|
||||
|
|
@ -199,23 +264,23 @@ namespace Remontor.Seacher
|
|||
Update(result);
|
||||
}
|
||||
|
||||
public IComp Result(int index)
|
||||
{
|
||||
return comps[index];
|
||||
}
|
||||
public string ResultString(int index)
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
case Mode.Login:
|
||||
return comps[index].GetName();
|
||||
case Mode.Username:
|
||||
return comps[index].GetDescription();
|
||||
case Mode.PCname:
|
||||
return comps[index].GetNetNameStr();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
//public IComp Result(int index)
|
||||
//{
|
||||
// return comps[index];
|
||||
//}
|
||||
//public string ResultString(int index)
|
||||
//{
|
||||
// switch (mode)
|
||||
// {
|
||||
// case Mode.Login:
|
||||
// return comps[index].GetName();
|
||||
// case Mode.Username:
|
||||
// return comps[index].GetDescription();
|
||||
// case Mode.PCname:
|
||||
// return comps[index].GetNetNameStr();
|
||||
// }
|
||||
// return "";
|
||||
//}
|
||||
public string CheckConnect(string server, string basa)
|
||||
{
|
||||
if (Connection == null)
|
||||
|
|
|
|||
|
|
@ -99,25 +99,25 @@ namespace Remontor.Seacher
|
|||
return result;
|
||||
}
|
||||
|
||||
public IComp Result(int index)
|
||||
{
|
||||
return comps[index];
|
||||
}
|
||||
//public IComp Result(int index)
|
||||
//{
|
||||
// return comps[index];
|
||||
//}
|
||||
|
||||
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() + ")";
|
||||
//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 buf;
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,6 +53,17 @@ namespace Remontor
|
|||
Index = index;
|
||||
|
||||
|
||||
}
|
||||
else if (seacherResult is SCCMResult)
|
||||
{
|
||||
SCCMResult result = (SCCMResult)seacherResult;
|
||||
LbName.Text = result.GetComp().GetName();
|
||||
LbNetName.Text = result.GetComp().GetNetName();
|
||||
LbData.Text = "last login:" + result.GetLastConnect();
|
||||
Select += UpdateAct;
|
||||
Index = index;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
public void SelectPreActiv(SessionItemControl control)
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue