コード例 #1
0
        private void DeviceModelOnDeviceDetached(object sender, EventArgs eventArgs)
        {
            DeviceModel.ForceDisconnect();


            OnPropertyChanged("IsConnected");

            var stopCommand = _stopCommand as RoutableCommand;

            if (stopCommand != null)
            {
                stopCommand.RaiseCanExecuteChanged();
            }

            var autoCommand = _autoCommand as RoutableCommand;

            if (autoCommand != null)
            {
                autoCommand.RaiseCanExecuteChanged();
            }

            var connectCommand = _connectCommand as RoutableCommand;

            if (connectCommand != null)
            {
                connectCommand.RaiseCanExecuteChanged();
            }

            //OnPropertyChanged("StopCommand");
            //OnPropertyChanged("AutoCommand");
            //OnPropertyChanged("ConnectCommand");
        }
コード例 #2
0
        public void OnDeviceChange(IntPtr wParam, IntPtr lParam)
        {
            var eventType = wParam.ToInt32();

            if (eventType == DeviceManagement.DBT_DEVICEARRIVAL)
            {
                // we have an arrival event
                ConnectClicked();
            }
            else if (eventType == DeviceManagement.DBT_DEVICEREMOVECOMPLETE)
            {
                // we have a disconnect event
                DeviceModel.ForceDisconnect();
                ScopeData.Clear();
                OnPropertyChanged("ScopeData");

                OnUpdateScopeView(true);
            }
        }