public bool ValidateUiData(RoyalBase data) { bool retVal = true; if (!data.IsDefaultSetting) { bool isDisplayNameRequired = !IsInBulkAddMode; bool displayNameOk = !string.IsNullOrEmpty(textFieldDisplayName.StringValue); bool computerNameOk = !string.IsNullOrEmpty(textFieldComputerName.StringValue); if (isDisplayNameRequired && !displayNameOk) { RmMessageBox.Show(RmMessageBoxType.WarningMessage, this.View.Window, "Warning".TL(), Language.Get("The \"Display Name\" must not be empty."), "OK".TL()); } if (!computerNameOk) { RmMessageBox.Show(RmMessageBoxType.WarningMessage, this.View.Window, "Warning".TL(), Language.Get("The \"Computer Name\" must not be empty."), "OK".TL()); } retVal = (!isDisplayNameRequired || (isDisplayNameRequired && displayNameOk)) && computerNameOk; } return(retVal); }
public void ShowMessage() { RmMessageBox.ShowNonModal( RmMessageBoxType.InformationMessage, View.Window, "Information".TL(), "Hello World!".TLL(), "OK".TL() ); }
partial void ButtonComputerNameEditor_Action(Id sender) { string computers = RmComputerPicker.Show(View.Window, new RmComputerPickerArguments() { BonjourEnabled = false, CustomEntryEnabled = EditMode == ObjectEditMode.EditMode_New, CanAddMultiple = EditMode == ObjectEditMode.EditMode_New, CurrentHosts = textFieldComputerName.StringValue }); if (!string.IsNullOrWhiteSpace(computers)) { string[] computerLines = computers.Split(new string[] { "\r\n", "\n", "\r" }, StringSplitOptions.RemoveEmptyEntries); if (computerLines.Length == 1) { RoyalRDSConnection con = new RoyalRDSConnection(null); con.ExtendWithTaggedComputerString(computerLines[0]); if (!string.IsNullOrWhiteSpace(con.Name)) { textFieldDisplayName.StringValue = con.Name.NS(); } if (!string.IsNullOrWhiteSpace(con.Description)) { textFieldDescription.StringValue = con.Description.NS(); } if (!string.IsNullOrWhiteSpace(con.URI)) { textFieldComputerName.StringValue = con.URI.NS(); CheckIfIsInBulkAddMode(); } } else if (computerLines.Length > 1) { if (EditMode == ObjectEditMode.EditMode_New) { string hostsJoined = string.Empty; foreach (string host in computerLines) { hostsJoined += host + ";"; } if (hostsJoined.EndsWith(";")) { hostsJoined = hostsJoined.Substring(0, hostsJoined.LastIndexOf(";")); } textFieldComputerName.StringValue = hostsJoined.NS(); CheckIfIsInBulkAddMode(); } else { RmMessageBox.Show( RmMessageBoxType.WarningMessage, this.View.Window, "Warning".TL(), "Bulk-add can only be used when adding new connections.".TL(), "OK".TL() ); } } } }