Exemple #1
0
        private void Button4_Click(object sender, EventArgs e)
        {
            var pd = new ProcessData(Process.Start(textBox1.Text));

            pd.Hide();
            pd.Suspend();
            access.Add(pd);
        }
Exemple #2
0
        public void Add(ProcessData data)
        {
            ListViewItem entry = new ListViewItem(new string[] {
                $"{data.Id}",
                data.Name,
                $"{data.IsSuspend}",
                $"{data.IsHidden}",
                data.StartBy,
            });

            table.Items.Add(entry);
            dict.Add(data.Id, data);
        }
Exemple #3
0
        public void RefreshData(bool withWnd)
        {
            int         lastpid    = selectedPID;
            bool        isselected = (lastpid >= 0);
            ProcessData pd         = null;

            if (isselected)
            {
                pd = dict[lastpid];
            }
            dict.Clear();
            table.Items.Clear();
            IEnumerable <Process> allproc;

            if (withWnd)
            {
                allproc = Process.GetProcesses().Where(p => !string.IsNullOrEmpty(p.ProcessName) && p.MainWindowHandle != IntPtr.Zero);
            }
            else
            {
                allproc = Process.GetProcesses().Where(p => !string.IsNullOrEmpty(p.ProcessName));
            }
            foreach (var proc in allproc)
            {
                if (isselected && proc.Id == selectedPID)
                {
                    Add(pd);
                    table.Items[table.Items.Count - 1].Selected = true;
                }
                else
                {
                    Add(new ProcessData(proc));
                }
            }
            selectedPID = lastpid;
        }