예제 #1
0
        protected override void OnInitialized()
        {
            base.OnInitialized();

            if (!MonitorSettings.ContainsKey(TfsBuildProviderBase.ProjectCredentialsSettingKey))
            {
                MonitorSettings[TfsBuildProviderBase.ProjectCredentialsSettingKey] = CredentialCache.DefaultCredentials;
            }

            SetDisplayName(MonitorSettings.SelectedBuildDefinitions);

            UpdateSelectedCollection();

            // ReSharper disable once ExplicitCallerInfoArgument
            OnPropertyChanged(nameof(ProjectUrl));
            ConnectCommand?.RaiseCanExecuteChanged();

            if (!SupportsDefaultCredentials && SupportsPersonalAccessToken)
            {
                ShowPersonalAccessTokenInput = true;
                if (MonitorSettings.ContainsKey(TfsBuildProviderBase.PersonalAccessTokenSettingsKey))
                {
                    var token = MonitorSettings?.GetDefaultValueIfNotExists <String>(TfsBuildProviderBase.PersonalAccessTokenSettingsKey);
                    if (!String.IsNullOrWhiteSpace(token))
                    {
                        ShowPersonalAccessTokenInput = false;
                    }
                }
            }
        }
        private void RefreshCommandExecuteStatus()
        {
            ConnectCommand.RaiseCanExecuteChanged();

            ClearAlarmCommand.RaiseCanExecuteChanged();

            SendGCodeFileCommand.RaiseCanExecuteChanged();
            StartProbeCommand.RaiseCanExecuteChanged();
            StartProbeHeightMapCommand.RaiseCanExecuteChanged();
            StopCommand.RaiseCanExecuteChanged();
            PauseCommand.RaiseCanExecuteChanged();

            SoftResetCommand.RaiseCanExecuteChanged();
            HomingCycleCommand.RaiseCanExecuteChanged();
            FeedHoldCommand.RaiseCanExecuteChanged();
            CycleStartCommand.RaiseCanExecuteChanged();

            EmergencyStopCommand.RaiseCanExecuteChanged();

            LaserOnCommand.RaiseCanExecuteChanged();
            LaserOffCommand.RaiseCanExecuteChanged();
            SpindleOnCommand.RaiseCanExecuteChanged();
            SpindleOffCommand.RaiseCanExecuteChanged();

            GotoFavorite1Command.RaiseCanExecuteChanged();
            GotoFavorite2Command.RaiseCanExecuteChanged();
            SetFavorite1Command.RaiseCanExecuteChanged();
            SetFavorite2Command.RaiseCanExecuteChanged();
            GotoWorkspaceHomeCommand.RaiseCanExecuteChanged();
            SetWorkspaceHomeCommand.RaiseCanExecuteChanged();
        }
예제 #3
0
        public void Connect()
        {
            ConnectCommand._checkCanExecute = () => { return(false); };
            ConnectCommand.RaiseCanExecuteChanged();
            ConnectCommand._checkCanExecute = () => { return(!Connector.IsConnected); };
            IsLoadingAnimationVisible       = true;


            Thread connectThread = new Thread(() =>
            {
                try
                {
                    Connector.Connect();
                }
                catch
                {
                    Connector.Status = "Fail";
                }
                System.Windows.Threading.Dispatcher.CurrentDispatcher.Invoke(() =>
                {
                    IsLoadingAnimationVisible = false;
                });
                Application.Current.Dispatcher.Invoke(() =>
                {
                    ConnectCommand.RaiseCanExecuteChanged();
                    DisconnectCommand.RaiseCanExecuteChanged();
                });
            });

            connectThread.Start();
        }
예제 #4
0
        private async Task TimerCallbackAsync()
        {
            var rv = await CreateNewClientAsync(_settings.DeviceType, _settings.ApplicationID);

            if (rv.IsError())
            {
                Error error = ((HueObjectCollectionBase <Error>)rv).Dictionary["0"];

                if (error.Type == 101)
                {
                }
                else
                {
                    // some other error occured;
                    _messageHandler.HideMessageBox();
                }
            }
            else
            {
                _messageHandler.HideMessageBox();
                await LoginAsync(_settings.ApplicationID);

                _context.Post(o => ExecuteGetLightsAsync(), this);
                _context.Post(o => ExecuteGetGroupsAsync(), this);
                IsConnecting = false;
                RaisePropertyChanged("IsConnected");
                ConnectCommand.RaiseCanExecuteChanged();
            }
        }
예제 #5
0
        public async Task <bool> ConnectAsync()
        {
            IsConnecting = true;
            ConnectCommand.RaiseCanExecuteChanged();

            _bridge.Connect();

            HueObjectBase rv = await LoginAsync(_settings.ApplicationID.Value);

            if (rv.IsError())
            {
                EventHandler eventHandler = async(s, e) => await TimerCallbackAsync();

                await _messageHandler.GetResponseAsync("Information", string.Format("Please press the Link button on your bridge."), 500, 30000, MessageBoxButtons.None, eventHandler);

                return(false);
            }

            ExecuteGetLightsAsync();
            ExecuteGetGroupsAsync();
            IsConnecting = false;
            RaisePropertyChanged("IsConnected");
            ConnectCommand.RaiseCanExecuteChanged();
            return(true);
        }
예제 #6
0
        public void ExecuteConnect()
        {
            if (!IsConnected)
            {
                _serialPort.PortName  = ComPort;
                _serialPort.BaudRate  = 9600;
                _serialPort.Parity    = Parity.None;
                _serialPort.StopBits  = StopBits.One;
                _serialPort.DataBits  = 8;
                _serialPort.Handshake = Handshake.None;

                _serialPort.DataReceived          += SerialPortDataReceivedHandler;
                _serialPort.ReceivedBytesThreshold = Vallox.TelegramLength;
                _serialPort.ReadBufferSize         = 1024;

                _serialPort.Open();

                ConnectCommand.RaiseCanExecuteChanged();
                DisconnectCommand.RaiseCanExecuteChanged();
                SetFanSpeedCommand.RaiseCanExecuteChanged();
                ReadVariableCommand.RaiseCanExecuteChanged();
                WriteVariableCommand.RaiseCanExecuteChanged();

                RaisePropertyChanged("IsConnected");
            }
        }
예제 #7
0
        private async void Connect_Execute(string arg)
        {
            try
            {
                AddUserCommand.RaiseCanExecuteChanged();
                _isConnected = true;
                Operation    = OperProgress.Connecting.ToString();
                ConnectCommand.RaiseCanExecuteChanged();

                _model.CreateFirebaseApp(arg);
                Users = new ObservableCollection <UserRecord>(await _model.GetUsers());
                Users.CollectionChanged += Users_CollectionChanged;
            }
            catch (Exception e)
            {
                _isConnected = false;
                MessageBox.Show(e.Message);
            }
            finally
            {
                ConnectCommand.RaiseCanExecuteChanged();
                AddUserCommand.RaiseCanExecuteChanged();
                Operation = OperProgress.Connect.ToString();
            }
        }
예제 #8
0
 public void Disconnect()
 {
     //Connector.Stream = null;
     Connector.Status      = "Disconnected";
     Connector.IsConnected = false;
     ConnectCommand.RaiseCanExecuteChanged();
     DisconnectCommand.RaiseCanExecuteChanged();
 }
예제 #9
0
 private void InvalidateCommands()
 {
     RaisePropertyChanged(() => IsSessionActive);
     CloseCommand.RaiseCanExecuteChanged();
     ExportCommand.RaiseCanExecuteChanged();
     ConnectCommand.RaiseCanExecuteChanged();
     DisconnectCommand.RaiseCanExecuteChanged();
 }
예제 #10
0
 private void OnCasparCgConnectionStatusChanged(object sender, ConnectionEventArgs e)
 {
     RaisePropertyChanged(nameof(IsConnected));
     ConnectCommand?.RaiseCanExecuteChanged();
     DisconnectCommand?.RaiseCanExecuteChanged();
     PlayCommand?.RaiseCanExecuteChanged();
     VersionCommand?.RaiseCanExecuteChanged();
 }
        private void UpdateStatus()
        {
            if (!_connection.IsConnected && !_isConnecting)
            {
                Status = "Failed to connect to the server. Check your settings and try again.";
            }
            else if (!_isConnecting)
            {
                Status = "Registering with the server...";
            }

            ConnectCommand.RaiseCanExecuteChanged();
        }
예제 #12
0
 private void OnRegistrationStatusUpdated()
 {
     if (SignalingStatus.IsRegistered)
     {
         OnRegistered?.Invoke();
     }
     else
     {
         OnRegistrationFailed?.Invoke();
         Status = "Connection to the server has been terminated.";
         ConnectCommand.RaiseCanExecuteChanged();
     }
 }
예제 #13
0
        public void ExecuteDisconnect()
        {
            if (IsConnected)
            {
                _serialPort.Close();

                ConnectCommand.RaiseCanExecuteChanged();
                DisconnectCommand.RaiseCanExecuteChanged();
                SetFanSpeedCommand.RaiseCanExecuteChanged();
                ReadVariableCommand.RaiseCanExecuteChanged();
                WriteVariableCommand.RaiseCanExecuteChanged();
            }
        }
        /// <summary>
        /// toggles between the states of enable/disable of the connect/disconnect command buttons, with a slight delay to prevent connection spamming
        /// </summary>
        /// <param name="delay"></param>
        private async void ToggleBlockConnectionCommands(bool delay)
        {
            if (delay)
            {
                await Task.Factory.StartNew(() => Thread.Sleep(1000));
            }

            BlockConnectionCommands = !BlockConnectionCommands;

            ConnectCommand.RaiseCanExecuteChanged();
            DisconnectCommand.RaiseCanExecuteChanged();
            SendTextCommand.RaiseCanExecuteChanged();
            RollDiceCommand.RaiseCanExecuteChanged();
        }
예제 #15
0
        private async Task UpdateStatusAsync()
        {
            var isConnected = await _connection.GetIsConnectedAsync();

            if (!isConnected && !_isConnecting)
            {
                Status = "Failed to connect to the server. Check your settings and try again.";
            }
            else if (!_isConnecting)
            {
                Status = "Registering with the server...";
            }

            ConnectCommand.RaiseCanExecuteChanged();
        }
 private void OnCmdConnect()
 {
     try
     {
         LogEntryView.ConnectionTest();
         IsDbConnect = true;
         AddCommand.RaiseCanExecuteChanged();
         LoadCommand.RaiseCanExecuteChanged();
         ConnectCommand.RaiseCanExecuteChanged();
         CustomerCommand.RaiseCanExecuteChanged();
         LocationTreeCommand.RaiseCanExecuteChanged();
     }
     catch (Exception ex)
     {
         MessageBox.Show(
             ex.Message);
     }
 }
예제 #17
0
 private void ClientModelChanged(object sender, PropertyChangedEventArgs e)
 {
     if (e.PropertyName.Equals("Connected"))
     {
         NotifyPropertyChanged("Connected");
         ConnectCommand.RaiseCanExecuteChanged();
         SendCommand.RaiseCanExecuteChanged();
         China2.RaiseCanExecuteChanged();
         BingBong.RaiseCanExecuteChanged();
         Wrong.RaiseCanExecuteChanged();
         GreatWall.RaiseCanExecuteChanged();
         ReallyRich.RaiseCanExecuteChanged();
         FakeNews.RaiseCanExecuteChanged();
         BuildWall.RaiseCanExecuteChanged();
     }
     else if (e.PropertyName.Equals("MessageBoard"))
     {
         NotifyPropertyChanged("MessageBoard");
     }
 }
예제 #18
0
 private void Connect()
 {
     ArmService.Default.Connect(SelectedPort, "direct.xml");
     ConnectCommand.RaiseCanExecuteChanged();
 }
예제 #19
0
        private void ClientModelChanged(object sender, PropertyChangedEventArgs e)
        {
            // This our UI of any changes in the following values, without it, our UI is blind to change.
            if (e.PropertyName.Equals("Connected"))
            {
                NotifyPropertyChanged("Connected");

                // Command execute changes
                ConnectCommand.RaiseCanExecuteChanged();
                SendCommand.RaiseCanExecuteChanged();
            }
            else if (e.PropertyName.Equals("MessageBoard"))
            {
                NotifyPropertyChanged("MessageBoard");
            }
            else if (e.PropertyName.Equals("Game_Board"))
            {
                NotifyPropertyChanged("Game_Board");
            }
            else if (e.PropertyName.Equals("UserList"))
            {
                NotifyPropertyChanged("UserList");
            }
            else if (e.PropertyName.Equals("TTTg"))
            {
                NotifyPropertyChanged("TTTg");
                NotifyPropertyChanged("TTTBoard");

                /* Command execute changes
                 * TTTMove_1.RaiseCanExecuteChanged();
                 * TTTMove_2.RaiseCanExecuteChanged();
                 * TTTMove_3.RaiseCanExecuteChanged();
                 * TTTMove_4.RaiseCanExecuteChanged();
                 * TTTMove_5.RaiseCanExecuteChanged();
                 * TTTMove_6.RaiseCanExecuteChanged();
                 * TTTMove_7.RaiseCanExecuteChanged();
                 * TTTMove_8.RaiseCanExecuteChanged();
                 * TTTMove_9.RaiseCanExecuteChanged();
                 */
            }
            else if (e.PropertyName.Equals("TTT_msg"))
            {
                NotifyPropertyChanged("TTT_msg");
            }
            else if (e.PropertyName.Equals("HMBoard"))
            {
                NotifyPropertyChanged("HMBoard");
            }
            else if (e.PropertyName.Equals("HMFigure"))
            {
                NotifyPropertyChanged("HMFigure");
            }
            else if (e.PropertyName.Equals("HgmText"))
            {
                NotifyPropertyChanged("HgmText");
            }
            else if (e.PropertyName.Equals("HGM_OpenL"))
            {
                NotifyPropertyChanged("HGM_OpenL");
            }
            else if (e.PropertyName.Equals("HGM_ClosedL"))
            {
                NotifyPropertyChanged("HGM_ClosedL");
            }
            else if (e.PropertyName.Equals("Message"))
            {
                NotifyPropertyChanged("Message");
            }
            else if (e.PropertyName.Equals("TTT1"))
            {
                NotifyPropertyChanged("TTT1");
            }
            else if (e.PropertyName.Equals("TTT2"))
            {
                NotifyPropertyChanged("TTT2");
            }
            else if (e.PropertyName.Equals("TTT3"))
            {
                NotifyPropertyChanged("TTT3");
            }
            else if (e.PropertyName.Equals("TTT4"))
            {
                NotifyPropertyChanged("TTT4");
            }
            else if (e.PropertyName.Equals("TTT5"))
            {
                NotifyPropertyChanged("TTT5");
            }
            else if (e.PropertyName.Equals("TTT6"))
            {
                NotifyPropertyChanged("TTT6");
            }
            else if (e.PropertyName.Equals("TTT7"))
            {
                NotifyPropertyChanged("TTT7");
            }
            else if (e.PropertyName.Equals("TTT8"))
            {
                NotifyPropertyChanged("TTT8");
            }
            else if (e.PropertyName.Equals("TTT9"))
            {
                NotifyPropertyChanged("TTT9");
            }
        }
예제 #20
0
 private void ClientModelChanged(object sender, PropertyChangedEventArgs e)
 {
     if (e.PropertyName.Equals("Connected"))
     {
         NotifyPropertyChanged("Connected");
         ConnectCommand.RaiseCanExecuteChanged();
         SendCommand.RaiseCanExecuteChanged();
         China2.RaiseCanExecuteChanged();
         BingBong2.RaiseCanExecuteChanged();
         Wrong2.RaiseCanExecuteChanged();
         GreatWall2.RaiseCanExecuteChanged();
         ReallyRich2.RaiseCanExecuteChanged();
         FakeNews2.RaiseCanExecuteChanged();
         BuildWall.RaiseCanExecuteChanged();
         Fired2.RaiseCanExecuteChanged();
         Havana.RaiseCanExecuteChanged();
         Random.RaiseCanExecuteChanged();
     }
     else if (e.PropertyName.Equals("MessageBoard"))
     {
         NotifyPropertyChanged("MessageBoard");
     }
     else if (e.PropertyName.Equals("China"))
     {
         NotifyPropertyChanged("China");
     }
     else if (e.PropertyName.Equals("BingBong"))
     {
         NotifyPropertyChanged("BingBong");
     }
     else if (e.PropertyName.Equals("Wrong"))
     {
         NotifyPropertyChanged("Wrong");
     }
     else if (e.PropertyName.Equals("GreatWall"))
     {
         NotifyPropertyChanged("GreatWall");
     }
     else if (e.PropertyName.Equals("ReallyRich"))
     {
         NotifyPropertyChanged("ReallyRich");
     }
     else if (e.PropertyName.Equals("FakeNews"))
     {
         NotifyPropertyChanged("FakeNews");
     }
     else if (e.PropertyName.Equals("Fired"))
     {
         NotifyPropertyChanged("Fired");
     }
     else if (e.PropertyName.Equals("RandomNoise"))
     {
         NotifyPropertyChanged("RandomNoise");
     }
     else if (e.PropertyName.Equals("Havanas"))
     {
         NotifyPropertyChanged("Havanas");
     }
     else if (e.PropertyName.Equals("BuildWalls"))
     {
         NotifyPropertyChanged("BuildWalls");
     }
 }