Exemplo n.º 1
0
        private void HideRestoreForm_Load(object sender, EventArgs e)
        {
            ProcessView.BeginUpdate();
            ProcessView.Columns.Add("进程ID", 80, HorizontalAlignment.Center);
            ProcessView.Columns.Add("路径", 160, HorizontalAlignment.Left);
            ProcessView.Columns.Add("命令行", 120, HorizontalAlignment.Left);
            ProcessView.Columns.Add("状态", 60, HorizontalAlignment.Left);

            LoadAllProgramToList();

            ProcessView.EndUpdate();
            RefreshListTimer.Enabled = true;
        }
        private void ProcessSelectWindow_Load(object sender, EventArgs e)
        {
            ProcessView.BeginUpdate();
            ProcessView.Columns.Add("进程名", 100, HorizontalAlignment.Left);
            ProcessView.Columns.Add("进程ID", 60, HorizontalAlignment.Left);
            ProcessView.Columns.Add("路径", 260, HorizontalAlignment.Left);
            ProcessView.Columns.Add("命令行", 200, HorizontalAlignment.Left);
            ProcessView.EndUpdate();

            ParseProcessList ownerInfo = new ParseProcessList();

            ownerInfo.processImageList    = processImageList;
            ownerInfo.processView         = ProcessView;
            ownerInfo.statusLabel         = statusLabel;
            ownerInfo.loadProgressBar     = loadProgressBar;
            ownerInfo.processSelectWindow = this;

            Thread processParser = new Thread(ownerInfo.Run);

            processParser.Start();
        }
Exemplo n.º 3
0
 private void RefreshProcessListButton_Click(object sender, EventArgs e)
 {
     ProcessView.BeginUpdate();
     LoadAllProgramToList();
     ProcessView.EndUpdate();
 }
Exemplo n.º 4
0
 private void HideProcessButton_Click(object sender, EventArgs e)
 {
     if (!GlobalVariable.Authorized)
     {
         return;                             //授权验证
     }
     if (ProcessView.SelectedItems.Count > 0 || ManualPIDCheckBox.Checked)
     {
         if (!ManualPIDCheckBox.Checked)
         {
             foreach (ListViewItem item in ProcessView.SelectedItems)
             {
                 if (item.SubItems[3].Text.Equals("正常"))
                 {
                     HideProcessWindow(Convert.ToInt32(item.Text));
                     item.SubItems[3].Text = "隐藏";
                 }
             }
         }
         else
         {
             //进入手动操作模式
             if (!ManualPIDTextBox.Text.Equals(""))
             {
                 if (ManualPIDTextBox.Text.Contains(','))
                 {
                     string[] listed_processes = ManualPIDTextBox.Text.Split(',');
                     foreach (string str in listed_processes)
                     {
                         //如果是已记录的启动程序
                         if (GlobalVariable.Started_PID.Contains(Convert.ToInt32(str)))
                         {
                             //在ListView中对相应的项设置“隐藏”标签
                             foreach (ListViewItem item in ProcessView.Items)
                             {
                                 if (item.Text.Equals(ManualPIDTextBox.Text) && item.SubItems[3].Text.Equals("正常"))
                                 {
                                     HideProcessWindow(Convert.ToInt32(str));
                                     item.SubItems[3].Text = "隐藏";
                                 }
                             }
                         }
                         else
                         {
                             //未记录则强制发送指令
                             HideProcessWindow(Convert.ToInt32(str));
                         }
                     }
                 }
                 else
                 {
                     int userInputNumber = Convert.ToInt32(ManualPIDTextBox.Text);
                     //如果是已记录的启动程序
                     if (GlobalVariable.Started_PID.Contains(userInputNumber))
                     {
                         //在ListView中对相应的项设置“隐藏”标签
                         foreach (ListViewItem item in ProcessView.Items)
                         {
                             if (item.Text.Equals(ManualPIDTextBox.Text) && item.SubItems[3].Text.Equals("正常"))
                             {
                                 HideProcessWindow(userInputNumber);
                                 item.SubItems[3].Text = "隐藏";
                             }
                         }
                     }
                     else
                     {
                         //未记录则强制发送指令
                         HideProcessWindow(userInputNumber);
                     }
                 }
             }
             else
             {
                 MessageBox.Show("请输入进程ID!", "未输入PID", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             }
         }
         ProcessView.BeginUpdate();
         LoadAllProgramToList();
         ProcessView.EndUpdate();
     }
     else
     {
         MessageBox.Show("请选择需要操作的进程!", "未选中进程", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }