Пример #1
0
 public void PopulateThreadListView(ProcessThreadCollection threads, ThreadsPopUp threadsPopUp)
 {
     if (threads != null)
     {
         foreach (ProcessThread thread in threads)
         {
             threadsPopUp.ThreadList.Items.Add(thread);
         }
     }
 }
Пример #2
0
        /*        private void ProcessList_MouseDoubleClick(object sender, MouseButtonEventArgs e)
         * {
         *  processAttributes.Clear();
         *
         *  foreach (Process process in processData.processes)
         *  {
         *      DataGathering.ProcessItem currentProcess = new DataGathering.ProcessItem
         *      {
         *          Id = process.Id,
         *          Name = process.ProcessName,
         *          Process = process
         *      };
         *      this.ProcessList.Items.Add(currentProcess);
         *      currentProcess.SetCPUUsage();
         *      currentProcess.SetRunningtTime();
         *      currentProcess.SetMemory();
         *      processAttributes.Add(currentProcess);
         *  }
         * }*/


        public void CreateButton(ProcessThreadCollection threads)
        {
            Button button = new Button();

            button.Content = "Show threads";
            button.Name    = "ThreadsButton";
            Grid.SetRow(button, 2);
            Grid.SetColumn(button, 2);
            button.Width = 100;
            button.HorizontalAlignment = HorizontalAlignment.Center;
            MainGrid.Children.Add(button);
            button.AddHandler(Button.ClickEvent, new RoutedEventHandler(button_Click));
            button.Click += delegate
            {
                ThreadsPopUp threadsPopUp = new ThreadsPopUp();
                threadsPopUp.Owner = this;
                PopulateThreadListView(threads, threadsPopUp);
                threadsPopUp.ShowDialog();
            };
        }