Esempio n. 1
0
        public BridgeDetectionPairingView()
        {
            _pairTimer.Interval          = new TimeSpan(0, 0, 0, 2);
            _pairTimer.Tick             += _pairTimer_Tick;
            _timeoutTimer.Interval       = new TimeSpan(0, 0, 1, 0);
            _timeoutTimer.Tick          += _timeoutTimer_Tick;
            Hue.OnDetectionComplete     += Hue_OnDetectionComplete;
            Hue.OnBridgeDetectionFailed += Hue_OnBridgeDetectionFailed;
            Hue.OnIpScanComplete        += Hue_OnIpScanComplete;
            Hue.OnIpScanProgressReport  += Hue_OnIpScanProgressReport;

            if (BridgeStore.ListBridges.Count == 0)
            {
                Cursor_Tools.ShowWaitCursor();
                CanAddManualIp  = false;
                CanScan         = false;
                CanDetectBridge = false;
                log.Info("Starting bridge detection.");
                Hue.DetectBridge();
            }
            else
            {
                _defaultset = BridgeStore.ListBridges.Any(x => x.IsDefault);
            }
        }
Esempio n. 2
0
 private void Hue_OnBridgeDetectionFailed(object sender, DetectionErrorEventArgs e)
 {
     Cursor_Tools.ShowNormalCursor();
     CanScan         = true;
     CanAddManualIp  = true;
     CanDetectBridge = true;
     MessageBox.Show("Error detecting bridge. Try manual scan.", GlobalStrings.Error, MessageBoxButton.OK, MessageBoxImage.Error);
     //log.Error("Error detecting bridge.", e.Error.ToString());
 }
Esempio n. 3
0
 private void DetectBridge()
 {
     CanDetectBridge = false;
     CanScan         = false;
     CanAddManualIp  = false;
     OnPropertyChanged("CanDetectBridge");
     Cursor_Tools.ShowWaitCursor();
     Hue.DetectBridge();
 }
Esempio n. 4
0
 private void Hue_OnDetectionComplete(object sender, RunWorkerCompletedEventArgs e)
 {
     ListViewSource = AssociateApiKey((ObservableCollection <Bridge>)e.Result);
     Cursor_Tools.ShowNormalCursor();
     _canscan = true;
     OnPropertyChanged("CanScan");
     CanAddManualIp = true;
     log.Info("Bridge detection complete.");
     log.Debug(ListViewSource);
 }
Esempio n. 5
0
        private void Hue_OnDetectionComplete(object sender, RunWorkerCompletedEventArgs e)
        {
            Dictionary <string, Bridge> brlist = (Dictionary <string, Bridge>)e.Result;

            UpdateBridgeList(brlist);

            Cursor_Tools.ShowNormalCursor();
            CanScan         = true;
            CanAddManualIp  = true;
            CanDetectBridge = true;
            log.Info("Bridge detection complete.");
            log.Debug(ListViewSource);
        }
Esempio n. 6
0
        public BridgeDetectionPairingView()
        {
            _pairTimer.Interval    = new TimeSpan(0, 0, 0, 2);
            _pairTimer.Tick       += _pairTimer_Tick;
            _timeoutTimer.Interval = new TimeSpan(0, 0, 1, 0);
            _timeoutTimer.Tick    += _timeoutTimer_Tick;
            _listBridge            = new ObservableCollection <Bridge>();

            if (_listBridge.Count == 0)
            {
                CanAddManualIp = false;
                Cursor_Tools.ShowWaitCursor();
                Hue.OnDetectionComplete     += Hue_OnDetectionComplete;
                Hue.OnBridgeDetectionFailed += Hue_OnBridgeDetectionFailed;
                log.Info("Starting bridge detection.");
                Hue.DetectBridge();

                _canscan = false;
            }
            else
            {
                AssociateApiKey(_listBridge);
            }
        }