Пример #1
0
        public BridgeSettingsView(Bridge selectedbridge)
        {
            _br            = selectedbridge;
            _brs           = _br.GetBridgeSettings();
            _listtimezones = _br.GetTimeZones();
            _listusers     = new ObservableCollection <Whitelist>(HueObjectHelper.GetBridgeUsers(_br));
            int winhue = _listusers.FindIndex(x => x.id == selectedbridge.ApiKey);

            _listusers.RemoveAt(winhue);
        }
Пример #2
0
        private void CreateUser()
        {
            string result = _br.CreateUser($"{_appname}#{_devicename}");

            if (result == string.Empty)
            {
                MessageBoxError.ShowLastErrorMessages(_br);
            }
            else
            {
                BridgeWhiteListAppName      = string.Empty;
                BridgeWhiteListDevName      = string.Empty;
                BridgeListUsersSelectedUser = null;
                _listusers = new ObservableCollection <Whitelist>(HueObjectHelper.GetBridgeUsers(_br));
                OnPropertyChanged("BridgeListUsers");
            }
        }
Пример #3
0
        private void CreateUser()
        {
            CommandResult comres = BridgeStore.SelectedBridge.CreateUser($"{_appname}#{_devicename}");

            if (comres.Success)
            {
                BridgeWhiteListAppName      = string.Empty;
                BridgeWhiteListDevName      = string.Empty;
                BridgeListUsersSelectedUser = null;
                HelperResult hr = HueObjectHelper.GetBridgeUsers(BridgeStore.SelectedBridge);
                if (hr.Success)
                {
                    _listusers = new ObservableCollection <Whitelist>((List <Whitelist>)hr.Hrobject);
                    OnPropertyChanged("BridgeListUsers");
                }
            }
            else
            {
                MessageBoxError.ShowLastErrorMessages(BridgeStore.SelectedBridge);
            }
        }
Пример #4
0
        public BridgeSettingsView(BridgeSettings brs)
        {
            _brs = brs;
            CommandResult comres2 = BridgeStore.SelectedBridge.GetTimeZones();

            if (!comres2.Success)
            {
                return;
            }
            _listtimezones = (List <string>)comres2.resultobject;
            HelperResult hr = HueObjectHelper.GetBridgeUsers(BridgeStore.SelectedBridge);

            if (!hr.Success)
            {
                return;
            }
            _listusers = new ObservableCollection <Whitelist>((List <Whitelist>)hr.Hrobject);
            int winhue = _listusers.FindIndex(x => x.id == BridgeStore.SelectedBridge.ApiKey);

            _listusers.RemoveAt(winhue);
        }