Beispiel #1
0
        void timer_Tick(object sender, EventArgs e)
        {
            String value = "";

            if (lastButton == btnGetProcessInfo)
            {
                String result = client.GetProcessInfo("");
                value = result;
            }
            else if (lastButton == btnGetTerminalInfo)
            {
                //value = client.GetTerminalInfo();
            }
            textBox1.Text = value;
        }
Beispiel #2
0
        public void LoadProcessInfo()
        {
            try
            {
                XElement root = XElement.Parse(client.GetProcessInfo(""));

                List <Process> processList = new List <Process>();

                foreach (XElement info in root.Elements())
                {
                    Process process = new Process()
                    {
                        Pid          = Convert.ToInt32(info.Element("pid").Value),
                        Name         = info.Element("name").Value,
                        Priority     = info.Element("priority").Value,
                        ThreadCount  = Convert.ToInt32(info.Element("threadCount").Value),
                        Cpu          = Convert.ToDouble(info.Element("cpu").Value.TrimEnd('%')),
                        Memory       = Convert.ToInt32(info.Element("mem").Value.TrimEnd('K', 'B')),
                        SendSpeed    = Convert.ToInt32(info.Element("send").Value.TrimEnd('B', 'p', 's')),
                        ReceiveSpeed = Convert.ToInt32(info.Element("receive").Value.TrimEnd('B', 'p', 's'))
                    };

                    processList.Add(process);
                }

                this.Dispatcher.Invoke(new Action(() => uiProcessList.ItemsSource = processList));
            }
            catch (Exception) { }
        }