void btnNewScript_Click(object sender, RoutedEventArgs e) { try { DialogText dlg = new DialogText(); dlg.Init(JMMClient.Properties.Resources.Rename_EnterScriptName, ""); dlg.Owner = Window.GetWindow(this); bool?res = dlg.ShowDialog(); if (res.HasValue && res.Value) { if (string.IsNullOrEmpty(dlg.EnteredText)) { Utils.ShowErrorMessage(JMMClient.Properties.Resources.Rename_BlankScript); return; } JMMServerBinary.Contract_RenameScript script = new JMMServerBinary.Contract_RenameScript(); script.IsEnabledOnImport = 0; script.Script = ""; script.ScriptName = dlg.EnteredText; JMMServerBinary.Contract_RenameScript_SaveResponse resp = JMMServerVM.Instance.clientBinaryHTTP.SaveRenameScript(script); if (!string.IsNullOrEmpty(resp.ErrorMessage)) { Utils.ShowErrorMessage(resp.ErrorMessage); return; } RenameScriptVM plRet = new RenameScriptVM(resp.RenameScript); defaultScriptID = plRet.RenameScriptID; // refresh data RefreshScripts(); } } catch (Exception ex) { Utils.ShowErrorMessage(ex); } }
public bool Save() { try { JMMServerBinary.Contract_RenameScript_SaveResponse response = JMMServerVM.Instance.clientBinaryHTTP.SaveRenameScript(this.ToContract()); if (!string.IsNullOrEmpty(response.ErrorMessage)) { Utils.ShowErrorMessage(response.ErrorMessage); return(false); } else { this.Populate(response.RenameScript); return(true); } } catch (Exception ex) { Utils.ShowErrorMessage(ex); return(false); } }