Beispiel #1
0
        private void ProcessChecking(object comp)
        {
            if (TPcastRemoteDevices.GetTPcastDevStatus(ref this.devcount, ref this.devstatus) && this.DevStsChgEvent != null)
            {
                TPcastDeviceStatus tPcastDeviceStatus = new TPcastDeviceStatus();
                tPcastDeviceStatus.Count  = this.devcount;
                tPcastDeviceStatus.Status = this.devstatus;
                this.DevStsChgEvent(comp, tPcastDeviceStatus);
                Console.WriteLine("run event handler!");
            }
            EventWaitHandle[] waitHandles = new EventWaitHandle[]
            {
                this.ewh_devstatus,
                this.ewh_stopthread
            };
            while (true)
            {
                Console.WriteLine("waiting for events!");
                TPcastEventType tPcastEventType = (TPcastEventType)WaitHandle.WaitAny(waitHandles);
                if (tPcastEventType != TPcastEventType.DeviceStatus)
                {
                    if (tPcastEventType == TPcastEventType.StopThread)
                    {
                        break;
                    }
                }
                else
                {
                    this.ewh_devstatus.Reset();
                    Console.WriteLine("TPcastEventType.DeviceStatus triggered!");
                    if (TPcastRemoteDevices.GetTPcastDevStatus(ref this.devcount, ref this.devstatus) && this.DevStsChgEvent != null)
                    {
                        TPcastDeviceStatus tPcastDeviceStatus2 = new TPcastDeviceStatus();
                        tPcastDeviceStatus2.Count  = this.devcount;
                        tPcastDeviceStatus2.Status = this.devstatus;
                        this.DevStsChgEvent(comp, tPcastDeviceStatus2);
                        Console.WriteLine("run event handler!");
                    }
                }
                if (this.StopThread)
                {
                    goto Block_7;
                }
            }
            Console.WriteLine("TPcastEventType.StopThread triggered!");
            TPcastRemoteDevices.ThreadIsRunning = false;
            return;

Block_7:
            TPcastRemoteDevices.ThreadIsRunning = false;
            Console.WriteLine("checking exist");
        }
Beispiel #2
0
 public void StartRemoteDevice()
 {
     TPcastRemoteDevices.ConnectToRemote();
 }