private void HomePosition_Cmd_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (HomePosition_Cmd.SelectedItem != null) { var settings = ApplicationData.Current.LocalSettings; Jeedom.Model.Command ObjectsSelect = HomePosition_Cmd.SelectedItem as Jeedom.Model.Command; settings.Values["HomeObjectId"] = ObjectsSelect.Id; } }
private async Task ExecCommand(Command cmd) { if (cmd != null) { this.Updating = true; await RequestViewModel.Instance.ExecuteCommand(cmd); //await Task.Delay(TimeSpan.FromSeconds(3)); await RequestViewModel.Instance.UpdateEqLogic(this); NotifyPropertyChanged("cmds"); this.Updating = false; } }
public async Task ExecuteCommand(Command cmd, Parameters parameters = null) { cmd.Updating = true; if (parameters == null) { parameters = new Parameters(); parameters.id = cmd.id; parameters.name = cmd.name; } var jsonrpc = new JsonRpcClient(parameters); if (await jsonrpc.SendRequest("cmd::execCmd")) { var response = jsonrpc.GetRequestResponseDeserialized<Response<CommandResult>>(); cmd.Value = response.result.value; } else { cmd.Value = "N/A"; } cmd.Updating = false; }