private void buttonChangeName_Click(object sender, EventArgs e) { if (this._agent != null) { TextInputDialog tid = new TextInputDialog("New Collectors Name", this._agent.CollectorsName); // Dialog zentrieren tid.Location = new Point((this.Size.Width) / 2 - (tid.Size.Width) / 2, this.Location.Y); if (tid.ShowDialog() == DialogResult.OK) { try { DataFunctions.Instance.Remove(this._agent); } catch (Exception ex) { Cursor.Current = Cursors.Default; MessageBox.Show("Name can't be changed. (" + ex.Message + ")", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); return; } this._agent.CollectorsName = tid.Value; this.textBoxCollectorsName.Text = tid.Value; this.changed = true; } } }
public void ImportPlayset() { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Filter = "Stellaris Playset Database|*.sqlite"; openFileDialog.CheckFileExists = true; bool? result = openFileDialog.ShowDialog(); string path; if (result == true) { path = openFileDialog.FileName; } else { return; } TextInputDialog dialog = new TextInputDialog(Properties.Resources.EnterName, Properties.Resources.EnterPlaysetNameQuestion, openFileDialog.SafeFileName.Replace(".sqlite", "")); string playsetName; if (dialog.ShowDialog() == true) { playsetName = dialog.ResultText; } else { return; } using (SqliteConnection connection = new SqliteConnection($"Data Source={path}")) { connection.Open(); List <ImportMod> toImport = ToImport(connection); AttachLauncherDB(connection); List <ImportMod> missing = GetMissingMods(connection, toImport); if (missing == null) { return; } if (missing.Count > 0) { MissingModsMessageBox messageBox = new MissingModsMessageBox(Properties.Resources.MissingMods, missing); if (messageBox.ShowDialog() == true) { return; } else { //Closed some other way. Eh whatever. return; } } Playset newPlayset = createNewPlaysetOnConnection(playsetName, connection); CloneDataFromImportDB(connection, newPlayset); } }
private void menuItemSetText_Click(object sender, EventArgs e) { TextInputDialog tid = new TextInputDialog("Set Label Text"); if (tid.ShowDialog() == DialogResult.OK) { this.Text = tid.Value; } }
private void renameTabHandler(object sender, EventArgs e) { var textInputDialog = new TextInputDialog("Results tab text", getTabTitle(_tabContainer.SelectedTab)); if (textInputDialog.ShowDialog() == DialogResult.OK) { setTabTitle(_tabContainer.SelectedTab, textInputDialog.Input); } }
private void menuItemSetDefaultValue_Click(object sender, EventArgs e) { TextInputDialog tid = new TextInputDialog("Set Default Value"); if (tid.ShowDialog() == DialogResult.OK) { this.DefaultValue = tid.Value; } }
private void btnCreateCustom_Click(object sender, EventArgs e) { int range = _values[0].Count; MessageBox.Show(string.Format("To create a custom range, enter {0} values separated by commas.", range)); Func <string, string> isValid = new Func <string, string>( delegate(string input) { string[] values = input.Split(new char[] { ',' }); if (values.Length != range) { return("Exactly " + range.ToString() + " values must be specified."); } List <string> filteredValues = new List <string>(values.Distinct()); if (filteredValues.Count != range) { return("Values must be unique."); } if (filteredValues.Any(delegate(string str) { return(string.IsNullOrWhiteSpace(str)); })) { return("Blank values cannot be used"); } return(string.Empty); } ); TextInputDialog tid = new TextInputDialog(isValid); if (tid.ShowDialog(this) == DialogResult.OK) { string text = tid.Value; List <string> newSource = new List <string>(text.Split(new char[] { ',' })); _values.Add(newSource); lstValues.Items.Add(ValuesString(newSource) + CUSTOM); if (rdbtnOrCols.Checked) { indexCols = lstValues.Items.Count - 1; } else if (rdbtnOrRows.Checked) { indexRows = lstValues.Items.Count - 1; } lstValues.SelectedIndex = lstValues.Items.Count - 1; } }
//#act internal bool VerifyStartPassword(bool verifyByInput, string passwordVerificationRule, string password) { try { if (!passwordVerificationRule.IsNullOrEmpty()) { if (passwordVerificationRule.Contains(";")) { passwordVerificationRule = passwordVerificationRule.Replace(";", ";"); } if (passwordVerificationRule.Contains(",")) { passwordVerificationRule = passwordVerificationRule.Replace(",", ","); } var verifyType = passwordVerificationRule.SplitByTwoDifferentStrings("Type:", ";", true)[0]; var verifyParams = passwordVerificationRule.SplitByTwoDifferentStrings("Params:", ";", true)[0]; if (!EnumHelper.IsNameValid <PasswordEncryptionType>(verifyType)) { throw new ArgumentException("passwordVerificationRule is not correct!"); } if (verifyByInput) { StartPassword = verifyParams; var dlg = new TextInputDialog(); { dlg.Text = EasyWinAppRes.PlsInputPassword; dlg.VerificationRule = verifyType; dlg.VerificationParams = verifyParams; dlg.ShowDialog(); return(dlg.IsOk); } } else { if (GetHelper.VerifyPassword(password, verifyType, verifyParams)) { StartPassword = verifyParams; return(true); } else { return(false); } } } } catch (Exception ex) { throw new ArgumentException("\n>> " + GetType().FullName + ".VerifyStartPassword Error: " + ex.Message); } return(true); }
private void BtnAddOption_Click(object sender, RoutedEventArgs e) { TextInputDialog tid = new TextInputDialog("Add Option", "Insert name of the new option", "New Option"); if (tid.ShowDialog() == true) { Property.Options.Add(new Model.Languages.WordTypePropertyTextOption() { Value = tid.txbInput.Text }); } }
/// <summary> /// Prompt the user for some JSON and then post it as a web message. /// </summary> public void SendJsonWebMessage() { TextInputDialog dialog = new TextInputDialog( "Post Web Message JSON", "Web message JSON:", "Enter the web message as JSON.", "{\"SetColor\":\"blue\"}", false); if (dialog.ShowDialog() == DialogResult.OK) { _webView2.PostWebMessageAsJson(dialog.Input); } }
/// <summary> /// Prompt the user for an initialization script ID and deregister that script. /// </summary> public void RemoveInitializeScript() { TextInputDialog dialog = new TextInputDialog( "Remove Initialize Script", "Script ID:", "Enter the ID created from Add Initialize Script.", _lastInitializeScriptId, false); if (dialog.ShowDialog() == DialogResult.OK) { _webView2.RemoveScriptToExecuteOnDocumentCreated(dialog.Input); } }
/// <summary> /// Prompt the user for a string and then post it as a web message. /// </summary> public void SendStringWebMessage() { TextInputDialog dialog = new TextInputDialog( "Post Web Message String", "Web message string:", "Enter the web message as a string.", string.Empty, false); if (dialog.ShowDialog() == DialogResult.OK) { _webView2.PostWebMessageAsString(dialog.Input); } }
private void buttonNotes_Click(object sender, EventArgs e) { if (this._event != null) { TextInputDialog tid = new TextInputDialog("Notes", this._event.Notes); // Dialog zentrieren tid.Location = new Point((this.Size.Width) / 2 - (tid.Size.Width) / 2, this.Location.Y); if (tid.ShowDialog() == DialogResult.OK) { this._event.Notes = tid.Value; } } }
private void buttonLocality_Click(object sender, EventArgs e) { if (this._event != null) { TextInputDialog tid = new TextInputDialog("Description of Event Locality", this._event.LocalityDescription); // Dialog zentrieren tid.Location = new Point((this.Size.Width) / 2 - (tid.Size.Width) / 2, this.Location.Y); if (tid.ShowDialog() == DialogResult.OK) { this._event.LocalityDescription = tid.Value; } } }
private string AddManufacturer() { TextInputDialog manufacturerName = new TextInputDialog(); manufacturerName.Title = "Please enter a manufacturer name"; manufacturerName.ShowDialog(); if (manufacturerName.DialogResult == MessageBoxResult.OK) { return(manufacturerName.Text); } else { return(null); } }
private void buttonWithholdingReason_Click(object sender, EventArgs e) { if (this._specimen != null) { TextInputDialog tid = new TextInputDialog(buttonDataWithholdingReason.Text, this._specimen.DataWithholdingReason); // Dialog zentrieren tid.Location = new Point((this.Size.Width) / 2 - (tid.Size.Width) / 2, this.Location.Y); if (tid.ShowDialog() == DialogResult.OK) { this._specimen.DataWithholdingReason = tid.Value; } } }
private void ShowAndPresentResults(TextInputDialog tid) { DialogResult res = tid.ShowDialog(); resultBox.Text = "" + res + Environment.NewLine; foreach (object o in tid.ResultObjects) { resultBox.Text += "" + o + "(" + o.GetType() + "), "; } resultBox.Text += Environment.NewLine; foreach (string o in tid.ResultStrings) { resultBox.Text += o + ","; } }
/// <summary> /// This method is executed when the user wants to play a media from an URI source. /// </summary> /// <param name="sender">The sender object's instance</param> /// <param name="e">Event parameters</param> private async void UriOpen_Click(object sender, MouseButtonEventArgs e) { this.viewModel.MenuVisible = false; #region Check requirements if (!YoutubePlayback.ToolsAvailable) { MessageBoxResult DownloadQuestion = MessageBox.Show( messageBoxText: "Első alkalommal le kell tölteni az ffmpeg.exe, az ffprobe.exe és a youtube-dl.exe programokat. Szeretnéd most letölteni?", caption: "Kellene még néhány dolog...", button: MessageBoxButton.YesNo, icon: MessageBoxImage.Question ); if (DownloadQuestion == MessageBoxResult.Yes) { ProgressBarDialog ProgressBar = new ProgressBarDialog("YouTube eszközök letöltése", "Fél perc és kész vagyunk..."); ProgressBar.Show(); await YoutubePlayback.DownloadSoftwareAsync(); ProgressBar.Close(); } else { return; } } #endregion TextInputDialog Dialog = new TextInputDialog("YouTube média letöltése", "Írd ide a videó címét, amit meg szeretnél nyitni:"); Dialog.Owner = this; bool?Result = Dialog.ShowDialog(); if (Result.HasValue && Result.Value == true) { if (!YoutubeUri.IsValidYoutubeUri(Dialog.UserInput)) { PlayerUtils.ErrorMessageBox(App.Name, "Úgy tűnik, hibás linket adtál meg."); return; } await this.OpenFilesAsync(new string[] { Dialog.UserInput }); } }
/// <summary> /// Prompt the user for some script and then execute it. /// </summary> public void InjectScript() { TextInputDialog dialog = new TextInputDialog( "Inject Script", "Enter script code:", "Enter the JavaScript code to run in the webview.", "window.getComputedStyle(document.body).backgroundColor", false); if (dialog.ShowDialog() == DialogResult.OK) { _webView2.ExecuteScript(dialog.Input, (args) => { if (args.ErrorCode != 0) { CommonDialogs.ShowFailure(args.ErrorCode, "ExecuteScript failed"); } MessageBox.Show(args.ResultAsJson, "ExecuteScript Result", MessageBoxButtons.OK); }); } }
private void ConnectToRoomButton_Click(object sender, RoutedEventArgs e) { if (_control.RoomSelector.SelectedIndex < 0) { return; } var dialog = new TextInputDialog(); dialog.ShowDialog(); RoomID = _tcpConnection.ConnectToRoom( _control.RoomSelector.SelectedItem as string, dialog.PasswordTextBox.Text); if (RoomID < 0) { return; } RoomChanged?.Invoke(); }
private void ExecuteSaveAs(object parameter) { string nozzlename; TextInputDialog inputDialog = new TextInputDialog("New nozzle spray pattern", "Please enter the nozzle name:", ""); if (inputDialog.ShowDialog() == true) { nozzlename = inputDialog.Answer; if (IsValidName(nozzlename)) { if (FindNozzleIndex(nozzlename) == -1) { //add new to nozzle list //save all Pattern p = SaveNozzlePattern(nozzlename, -1); _nozzlenames.Add(nozzlename); NozzleType _t = new NozzleType { NozzleTypeName = nozzlename, Pattern = p.PPattern }; NozzleTypes.Add(_t); SelectedNozzle = nozzlename; _canexecutedelete = true; } else { MessageBox.Show("Nozzle already exists. Unable to save.", "Duplicate Name", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK); } } else { MessageBox.Show("Nozzle name is invalid. Unable to save.", "Invalid Name", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK); } } }
/// <summary> /// Prompt the user to name a CDP event, and then subscribe to that event. /// </summary> public void SubscribeToCdpEvent() { TextInputDialog dialog = new TextInputDialog( "Subscribe to CDP Event", "CDP event name:", "Enter the name of the CDP event to subscribe to.\r\n" + "You may also have to call the \"enable\" method of the\r\n" + "event's domain to receive events (for example \"Log.enable\").\r\n", "Log.entryAdded", false); if (dialog.ShowDialog() == true) { string eventName = dialog.Input; // If we are already subscribed to this event, unsubscribe first. if (!string.IsNullOrEmpty(eventName)) { _webView2.StopListeningDevToolsProtocolEvent(eventName); } _webView2.StartListeningDevToolsProtocolEvent(eventName); } }
internal static bool VerifyPassword(string passwordVerificationStr, string password) { try { if (!passwordVerificationStr.IsNullOrEmpty()) { //passwordVerificationStr = EncryptionHelper.SmDecrypt(passwordVerificationStr, // StartHelper.GlobalEncrptKey1, StartHelper.GlobalEncrptKey2); if (passwordVerificationStr.Contains(";")) { passwordVerificationStr = passwordVerificationStr.Replace(";", ";"); } if (passwordVerificationStr.Contains(",")) { passwordVerificationStr = passwordVerificationStr.Replace(",", ","); } var accessType = passwordVerificationStr.SplitByTwoDifferentStrings("AccessType:", ";", true)[0]; var verifyRule = passwordVerificationStr.SplitByTwoDifferentStrings("VerificationRule:", ";", true)[0]; var verifyParams = passwordVerificationStr.SplitByTwoDifferentStrings("VerificationParams:", ";", true)[0]; if (verifyRule.ToLower() != "ClearText".ToLower() & verifyRule.ToLower() != "TdePassword".ToLower() & verifyRule.ToLower() != "Password".ToLower()) { throw new ArgumentException("verifyRule is not correct!"); } if (accessType.ToLower() == "Manual".ToLower()) { var dlg = new TextInputDialog(); { dlg.Text = EasyWinAppRes.PlsInputPassword; dlg.VerificationRule = verifyRule; dlg.VerificationParams = verifyParams; dlg.ShowDialog(); return(dlg.IsOk); } } else if (accessType.ToLower() == "Auto".ToLower()) { if (password.IsNullOrEmpty()) { throw new ArgumentException("Password can't be empty!"); } else { if (!TextVerificationHelper.Verify(password, verifyRule, verifyParams)) { throw new ArgumentException("Password is incorrect!"); } } } else if (accessType.ToLower() == "Both".ToLower()) { if (password.IsNullOrEmpty()) { var dlg = new TextInputDialog(); { dlg.Text = EasyWinAppRes.PlsInputPassword; dlg.VerificationRule = verifyRule; dlg.VerificationParams = verifyParams; dlg.ShowDialog(); return(dlg.IsOk); } } else { if (!TextVerificationHelper.Verify(password, verifyRule, verifyParams)) { throw new ArgumentException("Password is incorrect!"); } } } return(false); } } catch (Exception ex) { throw new ArgumentException("\n>> " + TypeName + ".CheckStartPassword Error: " + ex.Message); } return(true); }
//#GetText public static string GetText(string funcName, string[] funcParamArray) { try { //common if (funcName.ToLower() == "empty" | funcName.ToLower() == "null") { return(string.Empty); } else if (funcName.ToLower() == "GetInputText".ToLower()) { var dlg = new TextInputDialog(); var verifyRule = funcParamArray.Length > 0 ? funcParamArray[0] : ""; var verifyParams = funcParamArray.Length > 1 ? funcParamArray[1] : ""; dlg.VerificationRule = verifyRule; dlg.VerificationParams = verifyParams; dlg.ShowDialog(); return(dlg.InputText); } else if (funcName.ToLower() == "GetInputDateTime".ToLower()) { var dlg = new DateTimeInputDialog(); var customFormat = funcParamArray.Length > 0 ? funcParamArray[0] : ""; var verifyRule = funcParamArray.Length > 1 ? funcParamArray[1] : ""; var verifyParams = funcParamArray.Length > 2 ? funcParamArray[2] : ""; dlg.VerificationRule = verifyRule; dlg.VerificationParams = verifyParams; dlg.CustomFormat = customFormat; dlg.ShowDialog(); return(dlg.InputText); } else if (funcName.ToLower() == "LineQty".ToLower()) { int qty = funcParamArray[0].Split('\n').Length; return(Convert.ToString(qty)); } else if (funcName.ToLower() == "LinesBySearch".ToLower()) { var strArry = funcParamArray[0].Split('\n'); var schStrArry = funcParamArray[1].Split(','); var strList = new List <string>(); foreach (var v in strArry) { foreach (var s in schStrArry) { if (v.ToLower().Contains(s.ToLower())) { strList.Add(v); } } } var strList1 = strList.Distinct(); var strBlder = new StringBuilder(); foreach (var v in strList1) { if (!string.IsNullOrEmpty(v)) { strBlder.AppendLine(v); } } return(strBlder.ToString()); } else if (funcName.ToLower() == "DateTime".ToLower()) { var customFormat = "yyyy-MM-dd HH:mm:ss"; if (funcParamArray[0].ToLower() == "UtcNow".ToLower()) { var time = SystemTimeHelper.UtcNow(); // return(time.ToString(customFormat, DateTimeFormatInfo.InvariantInfo)); } else if (funcParamArray[0].ToLower() == "Now".ToLower()) { var time = SystemTimeHelper.Now(); // return(time.ToString(customFormat, DateTimeFormatInfo.InvariantInfo)); } else { throw new ArgumentException("funcName: " + funcName + " has no param " + funcParamArray[0] + "! "); } } else if (funcName.ToLower() == "UniqueString".ToLower()) { if (funcParamArray[0] == "ByNow") { var seperator = funcParamArray[1]; return(funcParamArray[2].ToUniqueStringByNow(seperator)); } else { throw new ArgumentException("funcName: " + funcName + " has no param '" + funcParamArray[0] + "'! "); } } else if (funcName.ToLower() == "Format".ToLower()) { if (funcParamArray[0].ToLower() == "upper") { return(funcParamArray[1].ToUpper()); } else if (funcParamArray[0].ToLower() == "lower") { return(funcParamArray[1].ToLower()); } else if (funcParamArray[0].ToLower() == "timespan") { return(SystemTimeHelper.GetTimeSpanString(Convert.ToDouble(funcParamArray[1]), funcParamArray[2], false)); } else if (funcParamArray[0].ToLower() == "real") { return(string.Format(funcParamArray[2], Convert.ToDouble(funcParamArray[1]))); } else if (funcParamArray[0].ToLower() == "FormatString") { return(string.Format(funcParamArray[1], funcParamArray[2])); } else { throw new ArgumentException(funcName + " has no param '" + funcParamArray[0] + "'! "); } } else if (funcName.ToLower() == "Replace".ToLower()) { return(funcParamArray[1].Length == 0 ? funcParamArray[0] : funcParamArray[0].Replace(funcParamArray[1], funcParamArray[2])); } else if (funcName.ToLower() == "Split".ToLower()) { var seperator = funcParamArray[1][0]; var tmpStrArray = funcParamArray[0].Split(seperator); var index = Convert.ToInt16(funcParamArray[2]); if (index > tmpStrArray.Length || index == tmpStrArray.Length) { return(""); } else { return(tmpStrArray[index]); } } else if (funcName.ToLower() == "Combine".ToLower()) { var separator = funcParamArray[0].GetSubParamSeparator(); var tmpStrArray = funcParamArray[0].Split(separator); var rtStr = ""; var i = 0; foreach (var tmpStr in tmpStrArray) { rtStr = rtStr + tmpStr; } return(rtStr); } else if (funcName.ToLower() == "SubString".ToLower()) { var tmStr = funcParamArray[0]; Int16 sttIndex = Convert.ToInt16(funcParamArray[1]); Int16 len = Convert.ToInt16(funcParamArray[2]); return(tmStr.Substring(sttIndex, len)); } //file else if (funcName.ToLower() == "FileDetail".ToLower()) { if (funcParamArray[1].IsNullOrEmpty()) { throw new ArgumentException("file path can't be empty! "); } if (funcParamArray[0].ToLower() == "Directory".ToLower()) { return(FileHelper.GetFileDetailByOption(funcParamArray[1], FilePathComposition.Directory)); } else if (funcParamArray[0].ToLower() == "FileName".ToLower()) { return(FileHelper.GetFileDetailByOption(funcParamArray[1], FilePathComposition.FileName)); } else if (funcParamArray[0].ToLower() == "FileTitle".ToLower()) { return(FileHelper.GetFileDetailByOption(funcParamArray[1], FilePathComposition.FileTitle)); } else if (funcParamArray[0].ToLower() == "Suffix".ToLower()) { return(FileHelper.GetFileDetailByOption(funcParamArray[1], FilePathComposition.Suffix)); } else if (funcParamArray[0].ToLower() == "Postfix".ToLower()) { return(FileHelper.GetFileDetailByOption(funcParamArray[1], FilePathComposition.Postfix)); } else { throw new ArgumentException("funcName: " + funcName + " has no param '" + funcParamArray[0] + "'! "); } } else if (funcName.ToLower() == "ChooseFile".ToLower()) { var dlg = new OpenFileDialog(); dlg.Title = "Choose File"; if (!string.IsNullOrEmpty(funcParamArray[0])) { dlg.InitialDirectory = funcParamArray[0]; } if (!string.IsNullOrEmpty(funcParamArray[1])) { dlg.Filter = funcParamArray[1]; } dlg.Multiselect = false; dlg.RestoreDirectory = true; if (dlg.ShowDialog() == DialogResult.OK) { if (dlg.FileNames.Count() > 0) { var firstFilePath = dlg.FileNames[0]; return(firstFilePath); } } return(string.Empty); } //no use yet else if (funcName.ToLower() == "CompareFile".ToLower()) { //var result = FileHelper.Compare2Files(funcParamArray[1], funcParamArray[2]).ToString(); return(string.Empty); } //dir else if (funcName.ToLower() == "ChooseDirectory".ToLower()) { var dlg = new FolderBrowserDialog(); dlg.Description = @"Choose Directory"; dlg.SelectedPath = funcParamArray[0]; if (dlg.ShowDialog() == DialogResult.OK) { return(dlg.SelectedPath); } return(string.Empty); } //calc else if (funcName.ToLower() == "Calc".ToLower()) { if (funcParamArray[0].ToLower() == "add".ToLower()) { return((Convert.ToDouble(funcParamArray[1]) + Convert.ToDouble(funcParamArray[2])).ToString()); } else if (funcParamArray[0].ToLower() == "sub".ToLower()) { return((Convert.ToDouble(funcParamArray[1]) - Convert.ToDouble(funcParamArray[2])).ToString()); } else if (funcParamArray[0].ToLower() == "mtp".ToLower()) { return((Convert.ToDouble(funcParamArray[1]) * Convert.ToDouble(funcParamArray[2])).ToString()); } else if (funcParamArray[0].ToLower() == "div".ToLower()) { return((Convert.ToDouble(funcParamArray[1]) / Convert.ToDouble(funcParamArray[2])).ToString()); } else if (funcParamArray[0].ToLower() == "rnd".ToLower()) { return((Math.Round(Convert.ToDouble(funcParamArray[1]))).ToString()); } else if (funcParamArray[0].ToLower() == "spls".ToLower()) { return((Convert.ToDouble(funcParamArray[1]) % (Convert.ToDouble(funcParamArray[2]))).ToString()); } else { throw new ArgumentException("funcName: " + funcName + " has no param: " + funcParamArray[0] + "! "); } } //ifelse else if (funcName.ToLower() == "IfElse".ToLower()) { var con = funcParamArray[0]; var returnVal = funcParamArray[1]; var returnVal1 = funcParamArray[2]; var conArry = con.Split(con.GetSubParamSeparator()); var compareVar = conArry[0]; var compareFlag = conArry[1]; var compareVal = ""; if (conArry.Length > 2) { compareVal = conArry[2]; } if (compareFlag.ToLower().Trim() == "Contain".ToLower().Trim()) { if (compareVar.Contains(compareVal)) { if (!string.IsNullOrEmpty(compareVal)) { return(returnVal); } } } else if (compareFlag.ToLower().Trim() == "Equal".ToLower().Trim()) { if (compareVar == compareVal) { return(returnVal); } } else if (compareFlag.ToLower() == "VEqual".ToLower()) { if (Convert.ToDouble(compareVar) == Convert.ToDouble(compareVal)) { return(returnVal); } } else if (compareFlag.ToLower() == "VGreater".ToLower()) { if (Convert.ToDouble(compareVar) > Convert.ToDouble(compareVal)) { return(returnVal); } } else if (compareFlag.ToLower() == "VGreaterEqual".ToLower()) { if (Convert.ToDouble(compareVar) >= Convert.ToDouble(compareVal)) { return(returnVal); } } else if (compareFlag.ToLower() == "VLess".ToLower()) { if (Convert.ToDouble(compareVar) < Convert.ToDouble(compareVal)) { return(returnVal); } } else if (compareFlag.ToLower() == "VLessEqual".ToLower()) { if (Convert.ToDouble(compareVar) <= Convert.ToDouble(compareVal)) { return(returnVal); } } else if (compareFlag.ToLower() == "NotEqual".ToLower()) { if (compareVar.Trim() != compareVal.Trim()) { return(returnVal); } } else if (compareFlag.ToLower() == "IsNull".ToLower()) { if (compareVar.IsNullOrEmpty()) { return(returnVal); } } else if (compareFlag.ToLower() == "IsNotNull".ToLower()) { if (!compareVar.IsNullOrEmpty()) { return(returnVal); } } else { throw new ArgumentException("funcName: " + funcName + " has no compare Flag: '" + compareFlag + "'! "); } return(returnVal1); } //IfElse ends //Status else if (funcName.ToLower() == "GetFinalStatus".ToLower()) { if (funcParamArray.All(v => v.ToLower() == "true")) { return("true"); } if (funcParamArray.Any(v => v.ToLower() == "unknown")) { return("unknown"); } return("false"); } //getbool else if (funcName.ToLower() == "GetBool".ToLower()) { if (funcParamArray[0].ToLower() == "TotalStatus".ToLower()) { var returnStr = "true"; var subfuncParamArray = funcParamArray[1].Split(','); if (subfuncParamArray.Any(v => v.ToLower() != "1")) { returnStr = "false"; } return(returnStr); } else if (funcParamArray[0].ToLower() == "And".ToLower()) { var returnStr = "true"; var subfuncParamArray = funcParamArray[1].Split(','); if (subfuncParamArray.Any(v => v.ToLower() != "true")) { returnStr = "false"; } return(returnStr); } else if (funcParamArray[0].ToLower() == "Or".ToLower()) { var returnStr = "false"; var subfuncParamArray = funcParamArray[1].Split(','); if (subfuncParamArray.Any(v => v.ToLower() == "true")) { returnStr = "true"; } return(returnStr); } else if (funcParamArray[0].ToLower() == "Not".ToLower()) { var returnStr = "true"; if (funcParamArray[1].ToLower() == "true") { returnStr = "false"; } return(returnStr); } else if (funcParamArray[0].ToLower() == "JudgeStringIsNull".ToLower()) { var returnStr = "false"; if (string.IsNullOrEmpty(funcParamArray[1])) { returnStr = "true"; } return(returnStr); } else if (funcParamArray[0].ToLower() == "JudgeStringIsNotNull".ToLower()) { var returnStr = "false"; if (!string.IsNullOrEmpty(funcParamArray[1])) { returnStr = "true"; } return(returnStr); } else if (funcParamArray[0].ToLower() == "JudgeIfDirectoryExists".ToLower()) { var returnStr = "false"; if (Directory.Exists(funcParamArray[1])) { returnStr = "true"; } return(returnStr); } else if (funcParamArray[0].ToLower() == "JudgeIsDirectoryHidden".ToLower()) { if (!Directory.Exists(funcParamArray[1])) { return("false"); } var returnStr = "false"; var di = new DirectoryInfo(funcParamArray[1]); if ((di.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden) { returnStr = "true"; } return(returnStr); } else if (funcParamArray[0].ToLower() == "VerifyInput".ToLower()) { var returnStr = "false"; var dlg = new TextInputDialog(); var verifyRule = funcParamArray[1]; var verifyParams = funcParamArray.Length > 2 ? funcParamArray[2] : ""; dlg.VerificationRule = verifyRule; dlg.VerificationParams = verifyParams; dlg.ShowDialog(); returnStr = dlg.IsOk.ToString().ToLower(); return(returnStr); } else { throw new ArgumentException("funcName: " + funcName + " has no param: " + funcParamArray[0] + "! "); } } else if (funcName.ToLower() == "GetEncryptedText".ToLower()) { if (funcParamArray[0].ToLower() == "Md5".ToLower()) { //return EncryptionHelper.Md5Encrypt(funcParamArray[1]); return(string.Empty); } else if (funcParamArray[0].ToLower() == "Rsa".ToLower()) { //return EncryptionHelper.RsaEncrypt(funcParamArray[1]); return(string.Empty); } else if (funcParamArray[0].ToLower() == "Bitwise".ToLower()) { //return EncryptionHelper.BitwiseEncrypt(funcParamArray[1]); return(string.Empty); } else if (funcParamArray[0].ToLower() == "Symmetric".ToLower()) { return(EncryptionHelper.SmEncrypt(funcParamArray[1])); } else if (funcParamArray[0].ToLower() == "TimeDynamic".ToLower()) { return(string.Empty); } else { throw new ArgumentException("funcName: " + funcName + " has no param: " + funcParamArray[0] + "! "); } } else if (funcName.ToLower() == "GetDecryptedText".ToLower()) { if (funcParamArray[0].ToLower() == "Rsa".ToLower()) { //return EncryptionHelper.RsaDecrypt(funcParamArray[1]); return(string.Empty); } if (funcParamArray[0].ToLower() == "Symmetric".ToLower()) { //return EncryptionHelper.SmDecrypt(funcParamArray[1]); return(string.Empty); } else { throw new ArgumentException("funcName: " + funcName + " has no param: " + funcParamArray[0] + "! "); } } //xml else if (funcName.ToLower() == "GetTableXmlNodeVal".ToLower()) { var path = funcParamArray[0]; var xmlMgr = new XmlHandler(path); return(xmlMgr.GetNodeInnerTextByTagName(funcParamArray[1], 0)); } //following can be extended to impl in AdapterGetHelper else if (funcName.ToLower() == "GetValidationResult".ToLower()) { var retStr = TextValidationHelper.Validate(funcParamArray[0], funcParamArray[1]); if (retStr == "OutOfScopeOfTextValidationHelper") { return("OutOfScope"); } else { return(retStr); } } else if (funcName.ToLower() == "GetJson".ToLower()) { return("OutOfScope"); } else { return("OutOfScope"); } } catch (Exception ex) { throw new ArgumentException("\n>> " + TypeName + ".GetText error: " + ex.Message); } }
private void menuItemSetText_Click(object sender, EventArgs e) { TextInputDialog tid = new TextInputDialog("Set Label Text"); if (tid.ShowDialog() == DialogResult.OK) { this.Text = tid.Value; } }
private void menuItemSetDefaultValue_Click(object sender, EventArgs e) { TextInputDialog tid = new TextInputDialog("Set Default Value"); if (tid.ShowDialog() == DialogResult.OK) { this.DefaultValue = tid.Value; } }