Beispiel #1
0
 void HandleFoundEvent(object sender, NetworkWatcherEventArgs e)
 {
     if (this.checkBox_showVirtual.IsChecked == true)
     {
         this.listView_controllerInfo.Items.Add(e.Controller);
     }
     else
     {
         if (!e.Controller.IsVirtual)
         {
             this.listView_controllerInfo.Items.Add(e.Controller);
         }
     }
 }
        private void AddControllerToListView(object sender, NetworkWatcherEventArgs e)
        {
            ControllerInfo controllerInfo = e.Controller;
            ListViewItem   item           = new ListViewItem(controllerInfo.IPAddress.ToString());

            item.SubItems.Add(controllerInfo.SystemName);
            item.SubItems.Add(controllerInfo.ControllerName);
            item.SubItems.Add(controllerInfo.Availability.ToString());
            item.SubItems.Add(controllerInfo.Id);
            item.SubItems.Add(controllerInfo.IsVirtual.ToString());
            item.SubItems.Add(controllerInfo.VersionName);
            this.listView1.Items.Add(item);
            item.Tag = controllerInfo;
        }
        private void DeleteControllerToListView(object sender, NetworkWatcherEventArgs e)
        {
            //ControllerInfo controllerInfo = e.Controller;
            ////Get the IP adress of the lost controler
            //string sSysteName = controllerInfo.SystemName;

            ////Search the controler in the list
            //foreach (ListViewItem item in Network_View.Items)
            //{
            //    if (item.SubItems[3].Text.Contains(sSysteName))
            //    {
            //        Network_View.Items.Remove(item);
            //    }
            //}
        }
Beispiel #4
0
        private void SubtractControllerFromListView(object sender, NetworkWatcherEventArgs e)
        {
            this.scanner = new NetworkScanner();
            this.scanner.Scan();
            ControllerInfoCollection controllers = scanner.Controllers;
            ListViewItem             item        = null;

            this.listView1.Items.Clear();
            foreach (ControllerInfo controllerInfo in controllers)
            {
                item = new ListViewItem(controllerInfo.IPAddress.ToString());
                item.SubItems.Add(controllerInfo.Id);
                item.SubItems.Add(controllerInfo.Availability.ToString());
                item.SubItems.Add(controllerInfo.IsVirtual.ToString());
                item.SubItems.Add(controllerInfo.SystemName);
                item.SubItems.Add(controllerInfo.Version.ToString());
                item.SubItems.Add(controllerInfo.ControllerName);
                this.listView1.Items.Add(item);
                item.Tag = controllerInfo;
            }
        }
Beispiel #5
0
 void HandleLostEvent(object sender, NetworkWatcherEventArgs e)
 {
     this.listView_controllerInfo.Items.Remove(e.Controller);
 }
Beispiel #6
0
 private void RemoveControllerToListView(object sender, NetworkWatcherEventArgs e)
 {
     ScanControllerToListView();
 }
Beispiel #7
0
 void HandleLostEvent(object sender, NetworkWatcherEventArgs e)
 {
     this.Invoke(new EventHandler <NetworkWatcherEventArgs>(RemoveControllerToListView), new Object[] { this, e });
 }
 private void AbbnetworkWatcher_Found(object sender, NetworkWatcherEventArgs e)
 {
     this.Invoke(new EventHandler <NetworkWatcherEventArgs>(AddControllerToListView), new Object[] { this, e });
 }
 private void AbbnetworkWatcher_Lost(object sender, NetworkWatcherEventArgs e)
 {
     Data.LogString = "设备连接丢失" + e.Controller.IPAddress.ToString();
 }
 // If new controler found add it to the list
 void HandleFoundEvent(object sender, NetworkWatcherEventArgs e)
 {
     // this.Invoke(new EventHandler<NetworkWatcherEventArgs>(AddControllerToListView), new Object[] { this, e });
 }
Beispiel #11
0
 void HandleLostEvent(object sender, NetworkWatcherEventArgs e)
 {
     this.Invoke(new EventHandler <NetworkWatcherEventArgs>(SubtractControllerFromListView), new Object[] { this, e });
 }
Beispiel #12
0
 private void Watcher_Found(object sender, NetworkWatcherEventArgs e)
 {
     Console.WriteLine("找到新的实例");
 }
Beispiel #13
0
 private void Watcher_Lost(object sender, NetworkWatcherEventArgs e)
 {
     Console.WriteLine("有实例下线");
 }