private void ApplyNetworkSettings() { BridgeSettings brs = new BridgeSettings(); if (BridgeDHCPEnable) { brs.ipaddress = null; brs.gateway = null; brs.proxyport = null; brs.proxyaddress = null; brs.netmask = null; brs.dhcp = true; } else { brs.ipaddress = _brs.ipaddress; brs.gateway = _brs.gateway; brs.proxyport = _brs.proxyport; brs.proxyaddress = _brs.proxyaddress; brs.netmask = _brs.netmask; brs.dhcp = false; } if (_br.SetBridgeSettings(brs).FailureCount <= 0) { return; } MessageBoxError.ShowLastErrorMessages(_br); }
private void btnCreateGroup_Click(object sender, RoutedEventArgs e) { if (gcvm.Group.Id == null) { CommandResult bresult = BridgeStore.SelectedBridge.CreateObject <Group>(gcvm.Group); if (bresult.Success) { DialogResult = true; log.Info(bresult.resultobject); _id = ((MessageCollection)bresult.resultobject)[0].ToString(); Close(); } else { MessageBoxError.ShowLastErrorMessages(BridgeStore.SelectedBridge); } } else { CommandResult bresult = BridgeStore.SelectedBridge.ModifyObject <Group>(gcvm.Group, gcvm.Group.Id); if (bresult.Success) { DialogResult = true; _id = gcvm.Group.Id; Close(); } else { MessageBoxError.ShowLastErrorMessages(BridgeStore.SelectedBridge); } } }
private void ApplyNetworkSettings() { BridgeSettings brs = new BridgeSettings(); if (BridgeDHCPEnable) { brs.ipaddress = null; brs.gateway = null; brs.proxyport = null; brs.proxyaddress = null; brs.netmask = null; brs.dhcp = true; } else { brs.ipaddress = _brs.ipaddress; brs.gateway = _brs.gateway; brs.proxyport = _brs.proxyport; brs.proxyaddress = _brs.proxyaddress; brs.netmask = _brs.netmask; brs.dhcp = false; } CommandResult comres = BridgeStore.SelectedBridge.SetBridgeSettings(brs); if (!comres.Success) { MessageBoxError.ShowLastErrorMessages(BridgeStore.SelectedBridge); } }
private void btnCreateGroup_Click(object sender, RoutedEventArgs e) { Group grp = gcv.GetGroup(); string result = "0"; if (grp.Id == null) { string @group = _bridge.CreateGroup(grp); if (@group != null) { result = @group; } } else { _bridge.ChangeGroup(grp); if (_bridge.lastMessages.SuccessCount >= 1) { result = grp.Id; } } if (result != "0") { DialogResult = true; _id = result; Close(); } else { MessageBoxError.ShowLastErrorMessages(_bridge); } }
private void btnCreate_Click(object sender, RoutedEventArgs e) { Sensor sensor = _scv.GetSensor(); CommandResult comres; if (modifiedsensor == null) { comres = _br.CreateObject <Sensor>(sensor); MessageCollection mc = (MessageCollection)comres.resultobject; modifiedsensor = new Sensor() { Id = ((Success)mc[0]).id }; } else { comres = _br.ModifyObject(modifiedsensor, modifiedsensor.Id); } if (comres.Success) { DialogResult = true; Close(); } else { MessageBoxError.ShowLastErrorMessages(_br); } }
private void btnSet_Click(object sender, RoutedEventArgs e) { CommandResult bresult = br.ChangeSensorConfig(id, daylightView.GetSensor().config); if (bresult.Success) { this.Close(); } else { MessageBoxError.ShowLastErrorMessages(br); } }
private void ApplyGeneralSettings() { BridgeSettings brs = new BridgeSettings() { name = _brs.name, timezone = _brs.timezone }; WinHueSettings.settings.BridgeInfo[_brs.mac].name = _brs.name; WinHueSettings.Save(); if (_br.SetBridgeSettings(brs).FailureCount <= 0) { return; } MessageBoxError.ShowLastErrorMessages(_br); }
private void btnRename_Click(object sender, RoutedEventArgs e) { MethodInfo mi = typeof(Bridge).GetMethod("RenameObject"); MethodInfo generic = mi.MakeGenericMethod(_obj.GetType()); CommandResult comres = (CommandResult)generic.Invoke(_bridge, new object[] { _obj.Id, tbNewName.Text }); if (comres.Success) { DialogResult = true; Close(); } else { MessageBoxError.ShowLastErrorMessages(_bridge); } }
private void ApplyGeneralSettings() { BridgeSettings brs = new BridgeSettings() { name = _brs.name, timezone = _brs.timezone }; WinHueSettings.settings.BridgeInfo[_brs.mac].name = _brs.name; WinHueSettings.Save(); CommandResult comres = BridgeStore.SelectedBridge.SetBridgeSettings(brs); if (!comres.Success) { MessageBoxError.ShowLastErrorMessages(BridgeStore.SelectedBridge); } }
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"); } }
public SceneCreatorView(List <HueObject> listlights, string sceneid, Bridge bridge) { _bridge = bridge; CommandResult cr = _bridge.GetObject <Scene>(sceneid); if (cr.Success) { _scene = (Scene)cr.resultobject; _listAvailableLights = new ObservableCollection <HueObject>(listlights); _listSceneLights = new ObservableCollection <HueObject>(); _cansavescene = true; _canpreviewscene = true; OnPropertyChanged("CanSaveSecene"); OnPropertyChanged("CanPreviewScene"); foreach (string s in _scene.lights) { int index = _listAvailableLights.FindIndex(x => x.Id == s); if (index == -1) { continue; } if (!_scene.lightstates.ContainsKey(s)) { continue; } ((Light)_listAvailableLights[index]).state = _scene.lightstates[s]; _listSceneLights.Add(_listAvailableLights[index]); _listAvailableLights.RemoveAt(index); } foreach (HueObject light in _listAvailableLights) { ((Light)light).state = new State(); } _newstate = new State { @on = true }; } else { MessageBoxError.ShowLastErrorMessages(_bridge); } }
public Form_GroupCreator(Bridge bridge, HueObject selectedGroup) { InitializeComponent(); _bridge = bridge; HelperResult hr = HueObjectHelper.GetBridgeLights(_bridge); if (hr.Success) { gcv = new GroupCreatorView((List <HueObject>)hr.Hrobject, (Group)selectedGroup); Title = string.Format(GUI.GroupCreatorForm_ModifyingGroup_Title, ((Group)selectedGroup).name); btnCreateGroup.Content = GUI.GroupCreatorForm_ModifyGroupButton; DataContext = gcv; } else { MessageBoxError.ShowLastErrorMessages(_bridge); this.Close(); } }
private void btnSet_Click(object sender, RoutedEventArgs e) { DaylightSensorConfig config = new DaylightSensorConfig { @long = dvm.Daylight.Longitude, lat = dvm.Daylight.Latitude, sunriseoffset = Convert.ToSByte(dvm.Daylight.SunriseOffset), sunsetoffset = Convert.ToSByte(dvm.Daylight.SunsetOffset) }; CommandResult bresult = BridgeStore.SelectedBridge.ChangeSensorConfig(id, config); if (bresult.Success) { this.Close(); } else { MessageBoxError.ShowLastErrorMessages(BridgeStore.SelectedBridge); } }
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); } }
private void btnCreate_Click(object sender, RoutedEventArgs e) { Sensor sensor = _scv.GetSensor(); if (sensor.Id == null) { _id = _br.CreateSensor(sensor); } else { _br.UpdateSensor(_id, sensor); } if (_id != "") { DialogResult = true; Close(); } else { MessageBoxError.ShowLastErrorMessages(_br); } }
private void btnCreateGroup_Click(object sender, RoutedEventArgs e) { Group grp = gcv.GetGroup(); if (grp.Id == null) { CommandResult bresult = _bridge.CreateObject <Group>(grp); if (bresult.Success) { DialogResult = true; _id = ((MessageCollection)bresult.resultobject)[0].ToString(); Close(); } else { MessageBoxError.ShowLastErrorMessages(_bridge); } } else { CommandResult bresult = _bridge.ModifyObject <Group>(new Group() { name = grp.name, lights = grp.lights, @class = grp.@class }, grp.Id); if (bresult.Success) { DialogResult = true; _id = grp.Id; Close(); } else { MessageBoxError.ShowLastErrorMessages(_bridge); } } }