Container class for passing Hue bridge and lights from the initializer page to MainPage.
Exemplo n.º 1
0
        /// <summary>
        /// Fires when the page is navigated to, which occurs after the extended
        /// splash screen has finished loading all Hue resources.
        /// </summary>
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            HuePayload args = e.Parameter as HuePayload;

            if (null != args)
            {
                _bridge = args.Bridge;
                Lights  = new ObservableCollection <Light>(args.Lights);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Fires when the page is navigated to, which occurs after the Initalizer extended
        /// splash screen has finished loading all Hue resources.
        /// </summary>
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            HuePayload args = e.Parameter as HuePayload;

            if (null != args)
            {
                _bridge = args.Bridge;
                Lights  = new ObservableCollection <Light>(args.Lights);
            }
            _taskRegistration = BackgroundTaskRegistration.AllTasks.Values
                                .FirstOrDefault(x => x.Name == _taskName);
            BluetoothWatcherToggle.IsChecked = null != _taskRegistration;

            var radios = await Radio.GetRadiosAsync();

            BluetoothWatcherToggle.IsEnabled = radios.Any(radio =>
                                                          radio.Kind == RadioKind.Bluetooth && radio.State == RadioState.On);
            base.OnNavigatedTo(e);
        }