140 lines
4.3 KiB
C#
140 lines
4.3 KiB
C#
using Remontor.Picter;
|
|
using Remontor.Pinger;
|
|
using Remontor.Seacher;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Drawing.Text;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
|
|
namespace Remontor
|
|
{
|
|
internal partial class SessionItemControl : UserControl
|
|
{
|
|
private bool PreActive = false;
|
|
private IComp Comp;
|
|
public delegate void SelectDelegat(SessionItemControl sessionItem);
|
|
event SelectDelegat Select;
|
|
private int Index;
|
|
public ISeacherResult seacherResult;
|
|
public SessionItemControl()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public SessionItemControl(ISeacherResult seacherResult, SelectDelegat UpdateAct, int index)
|
|
{
|
|
InitializeComponent();
|
|
this.seacherResult = seacherResult;
|
|
if (seacherResult is NoResult)
|
|
{
|
|
NoResult result = (NoResult) seacherResult;
|
|
this.Dock = DockStyle.Top;
|
|
LbName.Location = this.Location;
|
|
LbName.Text = result.toString();
|
|
|
|
PbPerson.Visible = false;
|
|
LbData.Visible = false;
|
|
LbNetName.Visible = false;
|
|
LbNetNameStatic.Visible = false;
|
|
PPingStat.Visible = false;
|
|
LbLogin.Visible = false;
|
|
LbLoginStatic.Visible = false;
|
|
|
|
|
|
}
|
|
else if(seacherResult is HistoryResult)
|
|
{
|
|
HistoryResult result = (HistoryResult) seacherResult;
|
|
LbName.Text = result.GetComp().GetDescription();
|
|
LbLogin.Text = result.GetComp().GetName();
|
|
LbNetName.Text = result.GetComp().GetNetName();
|
|
LbData.Text = "last connect:" + result.GetLastConnect();
|
|
Select += UpdateAct;
|
|
Index = index;
|
|
|
|
SPicManager.PictureSet(PbPerson, result.GetComp());
|
|
|
|
|
|
}
|
|
else if (seacherResult is SCCMResult)
|
|
{
|
|
SCCMResult result = (SCCMResult)seacherResult;
|
|
LbName.Text = result.GetComp().GetDescription();
|
|
LbNetName.Text = result.GetComp().GetNetName();
|
|
LbLogin.Text = result.GetComp().GetName();
|
|
LbData.Text = "last login:" + result.GetLastConnect();
|
|
Select += UpdateAct;
|
|
Index = index;
|
|
|
|
|
|
}
|
|
}
|
|
public void SelectPreActiv(SessionItemControl control)
|
|
{
|
|
if (control == this)
|
|
{
|
|
PreActive = true;
|
|
this.BackColor = SystemColors.Control;
|
|
// this.BackColor = SystemColors.GradientInactiveCaption;
|
|
}
|
|
else
|
|
{
|
|
PreActive = false;
|
|
this.BackColor = SystemColors.Window;
|
|
}
|
|
}
|
|
|
|
public int SelectActiv(SessionItemControl control)
|
|
{
|
|
if (control == this)
|
|
{
|
|
PreActive = true;
|
|
// this.BackColor = SystemColors.Control;
|
|
this.BackColor = SystemColors.GradientInactiveCaption;
|
|
}
|
|
else
|
|
{
|
|
PreActive = false;
|
|
this.BackColor = SystemColors.Window;
|
|
}
|
|
return Index;
|
|
}
|
|
|
|
private void SessionItemControl_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
|
|
System.Console.WriteLine("click");
|
|
}
|
|
|
|
private void SessionItemControl_Click(object sender, EventArgs e)
|
|
{
|
|
if (!(seacherResult is NoResult))
|
|
{
|
|
Select(this);
|
|
}
|
|
|
|
|
|
}
|
|
|
|
private void SessionItemControl_Load(object sender, EventArgs e)
|
|
{
|
|
if (seacherResult is HistoryResult)
|
|
{
|
|
HistoryResult result = (HistoryResult)seacherResult;
|
|
PingManager.NewTaskPing(PPingStat, result.GetComp());
|
|
}else if (seacherResult is SCCMResult)
|
|
{
|
|
SCCMResult result = (SCCMResult)seacherResult;
|
|
PingManager.NewTaskPing(PPingStat, result.GetComp());
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|