public async void Drop(object data, int?index = null, double?x = null, double?y = null) { if (!IsEditable) { await _messageHandler.GetResponseAsync("Error", "Lights cannot be added to this group", MessageBoxButtons.OK); return; } if (data is LightViewModel) { var light = data as LightViewModel; var rv = await LightSourceModel.AddLightByID(light.ID); if (rv.IsError()) { await _messageHandler.GetResponseAsync("Error", ((Error)rv).Description, MessageBoxButtons.OK); } else { RaisePropertyChanged("Lights"); } } if (data is GroupViewModel) { var group = data as GroupViewModel; RaisePropertyChanged("Lights"); } }
private async void SetAlertAsync() { _isSettingAlert = true; SetAlertCommand.RaiseCanExecuteChanged(); HueObjectBase rv = await LightSourceModel.SetAlertAsync(); if (!rv.IsError()) { bool refreshed = await LightSourceModel.RefreshAttributesAsync(); if (refreshed) { IsAlerting = LightSourceModel.State.Alert != "none"; } } _isSettingAlert = false; SetAlertCommand.RaiseCanExecuteChanged(); }
private async void ExecuteSaveAsync() { if (!_isSaving) { _isSaving = true; SaveCommand.RaiseCanExecuteChanged(); if (string.IsNullOrEmpty(ID)) { await _bridge.CreateGroup(EditableName, _groupLightIDs); } else { LightSourceModel.Name = EditableName; LightSourceModel.LightsIDs = _groupLightIDs; await LightSourceModel.SetAttributesAsync(); } _isSaving = false; SaveCommand.RaiseCanExecuteChanged(); } }
public async Task <HueObjectBase> CancelAlertAsync() { return(await LightSourceModel.CancelAlertAsync()); }