Exemplo n.º 1
0
        public static void HandleGetProcessesResponse(Client client, GetProcessesResponse packet)
        {
            if (client.Value == null || client.Value.FrmTm == null)
                return;

            client.Value.FrmTm.ClearListviewItems();

            // None of the arrays containing the process' information can be null.
            // The must also be the exact same length because each entry in the three
            // different arrays represents one process.
            if (packet.Processes == null || packet.IDs == null || packet.Titles == null ||
                packet.Processes.Length != packet.IDs.Length || packet.Processes.Length != packet.Titles.Length)
                return;

            new Thread(() =>
            {
                if (client.Value != null && client.Value.FrmTm != null)
                    client.Value.FrmTm.SetProcessesCount(packet.Processes.Length);

                for (int i = 0; i < packet.Processes.Length; i++)
                {
                    if (packet.IDs[i] == 0 || packet.Processes[i] == "System.exe")
                        continue;

                    if (client.Value == null || client.Value.FrmTm == null)
                        break;
                    
                    client.Value.FrmTm.AddProcessToListview(packet.Processes[i], packet.IDs[i], packet.Titles[i]);
                }
            }).Start();
        }
Exemplo n.º 2
0
        public static void HandleGetProcessesResponse(Client client, GetProcessesResponse packet)
        {
            if (client.Value.FrmTm == null)
                return;

            client.Value.FrmTm.ClearListview();

            // None of the arrays containing the process' information can be null.
            // The must also be the exact same length because each entry in the three
            // different arrays represents one process.
            if (packet.Processes == null || packet.IDs == null || packet.Titles == null ||
                packet.Processes.Length != packet.IDs.Length || packet.Processes.Length != packet.Titles.Length)
                return;

            new Thread(() =>
            {
                for (int i = 0; i < packet.Processes.Length; i++)
                {
                    if (packet.IDs[i] != 0 && packet.Processes[i] != "System.exe")
                    {
                        if (client.Value.FrmTm == null)
                            break;

                        ListViewItem lvi =
                            new ListViewItem(new string[] { packet.Processes[i], packet.IDs[i].ToString(), packet.Titles[i] });

                        client.Value.FrmTm.AddProcessToListview(lvi);
                    }
                }
            }).Start();
        }
Exemplo n.º 3
0
        public static void HandleGetProcessesResponse(Client client, GetProcessesResponse packet)
        {
            if (client.Value.FrmTm == null)
                return;

            client.Value.FrmTm.Invoke((MethodInvoker) delegate { client.Value.FrmTm.lstTasks.Items.Clear(); });

            new Thread(() =>
            {
                for (int i = 0; i < packet.Processes.Length; i++)
                {
                    if (packet.IDs[i] != 0 && packet.Processes[i] != "System.exe")
                    {
                        ListViewItem lvi =
                            new ListViewItem(new string[]
                            {packet.Processes[i], packet.IDs[i].ToString(), packet.Titles[i]});
                        try
                        {
                            client.Value.FrmTm.Invoke(
                                (MethodInvoker) delegate { client.Value.FrmTm.lstTasks.Items.Add(lvi); });
                        }
                        catch
                        {
                            break;
                        }
                    }
                }
            }).Start();
        }