コード例 #1
0
 public Watcher()
 {
     this.listViewProcesses = new Dictionary<string, ListViewItem>();
     this.processes = new Dictionary<string, ProcessToWatch>();
     this.myDelegateUpdateListView = new UpdateListView(UpdateListViewMethod);
     this.myDelegateAddNewProcess = new ListViewUse(AddNewProcessMethod);
 }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: b-kaf/MachineLearning
 //Thread safe call on the ListView
 //If the calling thread is different from the thread that created
 //the ListView control, this method creates a callback and calls itself
 //asynchronously using the Invole method
 //
 //If the calling thread is the same as the the one that created the control
 //it updates the data directly
 private void UpdateStatisticsListView(Double[,] statistics)
 {
     // InvokeRequired required compares the thread ID of the
     // calling thread to the thread ID of the creating thread.
     // If these threads are different, it returns true.
     if (this.statisticsView.InvokeRequired)
     {
         UpdateListView d = new UpdateListView(UpdateStatisticsListView);
         this.Invoke(d, new object[] { statistics });
     }
     else
     {
         String[] algorithms = { "KNN", "Perceptron", "Least Squares", "Neural Network" };
         ListViewItem[] lvi = new ListViewItem[5];
         for (int i = 0; i < algorithms.Length; i++)
         {
             lvi[i] = new ListViewItem(algorithms[i]);
             for (int j = 0; j < 5; j++)
             {
                 lvi[i].SubItems.Add(statistics[i, j].ToString());
             }
             statisticsView.Items.Add(lvi[i]);
         }
     }
 }