//远程控制操作 private void UserManage_Button_Click(object sender, RoutedEventArgs e) { //获取选中的用户 UserInfo userInfo = GetSelectedItem(e); //控制窗口 ControlUserWindow controlUserWindow = new ControlUserWindow(); //读取敏感进程 button controlUserWindow.ReadSProsseses_Button.Click += delegate { //清空以前的记录 SensitiveProcesses.Clear(); superClientSocket.Send("2"); superClientSocket.Send("SProcesses|" + userInfo.UserMac); }; //结束选中进程 button controlUserWindow.KillProcess_Button.Click += delegate { if (controlUserWindow.SProcess_ListView.SelectedItems.Count != 0) { if (MessageBox.Show("确定关闭选中的进程", "提醒", MessageBoxButton.OKCancel, MessageBoxImage.Warning) == MessageBoxResult.OK) { SensitiveProcess sp = (SensitiveProcess)controlUserWindow.SProcess_ListView.SelectedItem; if (sp.State == "已关闭") { MessageBox.Show("已关闭"); return; } superClientSocket.Send("2"); superClientSocket.Send("KSProcess|" + userInfo.UserMac + "|" + sp.ProcessName); } } else { MessageBox.Show("无选中项!", "提醒", MessageBoxButton.OK, MessageBoxImage.Warning); } }; //定时关闭 controlUserWindow.orderTime_Button.Click += delegate { if (controlUserWindow.SProcess_ListView.SelectedIndex < 0) { MessageBox.Show("无选中项!", "提醒", MessageBoxButton.OK, MessageBoxImage.Warning); return; } SensitiveProcess sp = (SensitiveProcess)controlUserWindow.SProcess_ListView.SelectedItem; if (TimeSpan.Parse(sp.UsingTime) > TimeSpan.Parse(controlUserWindow.orderTime_ComboBox.SelectionBoxItem.ToString())) { MessageBox.Show("此进程已经使用超过设定时间!"); return; } superClientSocket.Send("2"); superClientSocket.Send("KOSProcess|" + userInfo.UserMac + "|" + sp.ProcessName + "-" + controlUserWindow.orderTime_ComboBox.SelectionBoxItem.ToString()); }; controlUserWindow.Closed += delegate { SensitiveProcesses.Clear(); }; //listview controlUserWindow.SensitiveProcesses = SensitiveProcesses; controlUserWindow.Title = userInfo.UserName + " " + userInfo.UserMac; controlUserWindow.ShowDialog(); }
//远程控制操作 private void UserManage_Button_Click(object sender, RoutedEventArgs e) { //获取选中的用户 UserInfo userInfo = GetSelectedItem(e); //控制窗口 ControlUserWindow controlUserWindow = new ControlUserWindow(); //读取敏感进程 button controlUserWindow.ReadSProsseses_Button.Click += delegate { //清空以前的记录 SensitiveProcesses.Clear(); superClientSocket.Send("2"); superClientSocket.Send("SProcesses|" + userInfo.UserMac); }; //结束选中进程 button controlUserWindow.KillProcess_Button.Click += delegate { if (controlUserWindow.SProcess_ListView.SelectedItems.Count != 0) { if (MessageBox.Show("确定关闭选中的进程", "提醒", MessageBoxButton.OKCancel, MessageBoxImage.Warning) == MessageBoxResult.OK) { SensitiveProcess sp=(SensitiveProcess)controlUserWindow.SProcess_ListView.SelectedItem; if (sp.State == "已关闭") { MessageBox.Show("已关闭"); return; } superClientSocket.Send("2"); superClientSocket.Send("KSProcess|" + userInfo.UserMac + "|" + sp.ProcessName); } } else { MessageBox.Show("无选中项!", "提醒", MessageBoxButton.OK, MessageBoxImage.Warning); } }; //定时关闭 controlUserWindow.orderTime_Button.Click += delegate { if (controlUserWindow.SProcess_ListView.SelectedIndex < 0) { MessageBox.Show("无选中项!","提醒",MessageBoxButton.OK,MessageBoxImage.Warning); return; } SensitiveProcess sp=(SensitiveProcess)controlUserWindow.SProcess_ListView.SelectedItem; if (TimeSpan.Parse(sp.UsingTime) > TimeSpan.Parse(controlUserWindow.orderTime_ComboBox.SelectionBoxItem.ToString())) { MessageBox.Show("此进程已经使用超过设定时间!"); return; } superClientSocket.Send("2"); superClientSocket.Send("KOSProcess|"+userInfo.UserMac+"|"+sp.ProcessName+"-"+ controlUserWindow.orderTime_ComboBox.SelectionBoxItem.ToString()); }; controlUserWindow.Closed+=delegate { SensitiveProcesses.Clear(); }; //listview controlUserWindow.SensitiveProcesses = SensitiveProcesses; controlUserWindow.Title = userInfo.UserName + " " + userInfo.UserMac; controlUserWindow.ShowDialog(); }