public async Task <string> GetTextAsync(string title, string placeholder, string defaultText = "", Func <string, bool> validater = null) { if (validater == null) { validater = (_) => true; } var context = new TextInputDialogContext(title, placeholder, defaultText, validater); var dialog = new TextInputDialog() { DataContext = context }; var result = await dialog.ShowAsync(); // 仮想入力キーボードを閉じる Windows.UI.ViewManagement.InputPane.GetForCurrentView().TryHide(); if (result == Windows.UI.Xaml.Controls.ContentDialogResult.Primary) { return(context.GetValidText()); } else { return(null); } }
public void AddComObject() { TextInputDialog dialog = new TextInputDialog( "Add COM object", "CLSID or ProgID of COM object:", "Enter the CLSID (eg '{0002DF01-0000-0000-C000-000000000046}')\r\n" + "or ProgID (eg 'InternetExplorer.Application') of the COM object to create and\r\n" + "provide to the WebView as `window.chrome.remoteObjects.example`.", "InternetExplorer.Application", false); if (dialog.ShowDialog() == true) { Type type = Type.GetTypeFromProgID(dialog.Input, false); if (type == null) { try { Guid guid = new Guid(dialog.Input); type = Type.GetTypeFromCLSID(guid, false); } catch (Exception) { } } if (type != null) { _remoteObject = Activator.CreateInstance(type); _webView2.AddRemoteObject("example", ref _remoteObject); } else { CommonDialogs.ShowError("Coudn't create COM object."); } } }
public void TextInputDialogConstructorTest() { string prompt = string.Empty; // TODO: Initialize to an appropriate value TextInputDialog target = new TextInputDialog(prompt); Assert.Inconclusive("TODO: Implement code to verify target"); }
public static bool GetRenamedLayoutName(string defaultName, Predicate <string> nameValidator, out string layoutName) { Validate.IsNotNull(defaultName, nameof(defaultName)); Validate.IsNotNull(nameValidator, nameof(nameValidator)); return(TextInputDialog.Show(WindowManagement_Resources.RenameLayoutTitle, WindowManagement_Resources.RenameLayoutMessage, 100, defaultName, nameValidator, out layoutName)); }
public override void OnEnter(GameManager gameManager) { this.gameManager = gameManager; int eventNumber = gameManager.GetPlayerCompany().eventHistory.Count + 1; if (gameManager.GetCurrentEvent().Type.typeName == "House show") // Bypass selection for house shows and move right on to the next step. { SetEventName("Event #" + eventNumber); return; } // Default to the last name used for a TV since TV shows don't change titles. string defaultName = ""; if (gameManager.GetCurrentEvent().Type.typeName == "TV") { foreach (HistoricalWrestlingEvent wrestlingEvent in gameManager.GetPlayerCompany().eventHistory) { if (wrestlingEvent.type == "TV") { defaultName = wrestlingEvent.name; } } } eventNameDialog = gameManager.GetGUIManager().InstantiateTextInputDialog(); eventNameDialog.Initialize("Name your event", defaultName, "Enter the name of your upcoming event.", new UnityAction(OnNameEntered)); }
private void ExecuteOpenCommand() { if (_pdfComponent == null) { return; } var dialog = new OpenFileDialog { Filter = "PDF Files|*.pdf|All files|*.*", }; if (dialog.ShowDialog() == false) { return; } _pdfComponent.OpenDocument(dialog.FileName, () => { // ToDo: Hard coded text. var inputDialog = new TextInputDialog() { UsePasswordInput = true, InputDialogTitle = "PDF document is password protected", InputTextHint = "Please enter a password:", }; if (inputDialog.ShowDialog(_view.Window)) { return(inputDialog.InputText); } return(null); }); InvokePropertyChangedEvent(); }
private void editFeatureBtn_Click(object sender, EventArgs e) { if (!featuresListView.IsAnySelected()) { return; } var item = featuresListView.SelectedItem(); string category = this.category.GetCurrent(); string oldFeature = this.feature.NameOf(item); string oldPath = this.viewData.Provider.GetTexturePathToOpen(category, oldFeature); string newFeature = TextInputDialog.Show("項目名を変更", "", oldFeature); if (newFeature == oldFeature) { return; } this.viewData.Operator.Import(category, newFeature, oldPath); featuresListView.Items.Add(this.listViewItem.Of(category, newFeature)); this.viewData.Operator.RemoveFeature(category, oldFeature); if (!this.viewData.Provider.IsSystemTexture(category, oldFeature)) { featuresListView.Items.Remove(item); } this.listView.RemoveCache(category); this.listView.UpdateFeaturesListView(); }
/// <summary> /// Prompt the user for the name and parameters of a CDP method, then call it. /// </summary> public void CallCdpMethod() { TextInputDialog dialog = new TextInputDialog( "Call CDP Method", "CDP method name:", "Enter the CDP method name to call, followed by a space,\r\n" + "followed by the parameters in JSON format.", "Runtime.evaluate {\"expression\":\"alert(\\\"test\\\")\"}", false); if (dialog.ShowDialog() == true) { int delimiterPos = dialog.Input.IndexOf(' '); string methodName = dialog.Input.Substring(0, delimiterPos); string methodParams = (delimiterPos < dialog.Input.Length ? dialog.Input.Substring(delimiterPos + 1) : "{}"); _webView2.CallDevToolsProtocolMethod( methodName, methodParams, (args) => { MessageBox.Show(args.ReturnObjectAsJson, "CDP Method Result", MessageBoxButton.OK); }); } }
private void previewButtonSplit_Click(object sender, RoutedEventArgs e) { TextInputDialog tid = new TextInputDialog("Split GCode: \n Segment Length (mm)"); tid.ErrorMessage = "Invalid Number"; tid.Validate += (s) => { double length; if (!double.TryParse(s, out length)) { return(false); } return(length > 0); }; if (tid.ShowDialog().Value) { double length = double.Parse(tid.textBoxInput.Text); previewPath = previewPath.Split(length); editor_UpdatePreview(); } }
/// <summary> /// Prompt the user for some script and register it to execute whenever a new page loads. /// </summary> public void AddInitializeScript() { TextInputDialog dialog = new TextInputDialog( "Add Initialize Script", "Initialization Script:", "Enter the JavaScript code to run as the initialization script that " + "runs before any script in the HTML document.", // This example script stops child frames from opening new windows. Because // the initialization script runs before any script in the HTML document, we // can trust the results of our checks on window.parent and window.top. "if (window.parent !== window.top) {\r\n" + " delete window.open;\r\n" + "}", false); if (dialog.ShowDialog() == true) { _webView2.AddScriptToExecuteOnDocumentCreated( dialog.Input, (args) => { _lastInitializeScriptId = args.Id; MessageBox.Show(_lastInitializeScriptId, "AddScriptToExecuteOnDocumentCreated Id", MessageBoxButton.OK); }); } }
/* * public void ShowLoadGameMode(UnityAction backButtonDelegate) { * * this.backButtonDelegate = backButtonDelegate; * //editModeManagerCanvas.gameObject.SetActive(true); * loadgameStartWindow.Show( () => * { * TextInputDialog.Show("New layout", (string text) => * { * if (!String.IsNullOrEmpty(text)) * { * string fileName = text + ".json"; * currenteditedFileName = fileName; * startWindow.Hide(); * tablesHolder.Clear(); * } * }); * }, * fileName => { * currenteditedFileName = fileName; * tablesHolder.LoadFromJson(fileName); * startWindow.Hide(); * }, * fileName => { * tablesHolder.LoadFromJson(fileName); * tablesHolder.Apply(); * OnBackButtonPressed(); * } * );Debug.Log("meg kene jelenni"); * } */ public void ShowEditMode(UnityAction backButtonDelegate) { this.backButtonDelegate = backButtonDelegate; editModeManagerCanvas.gameObject.SetActive(true); tableNameText.text = tablesHolder.ActiveTable.tableName; startWindow.Show(() => { TextInputDialog.Show("New layout", (string text) => { if (!String.IsNullOrEmpty(text)) { string fileName = text + ".json"; currenteditedFileName = fileName; startWindow.Hide(); tablesHolder.Clear(); } }); }, fileName => { currenteditedFileName = fileName; tablesHolder.LoadFromJson(fileName); startWindow.Hide(); }, fileName => { tablesHolder.LoadFromJson(fileName); tablesHolder.Apply(); OnBackButtonPressed(); }); }
public static bool Update() { List <TouchData> touchDataList = Touch.GetData(0); if (button.TouchDown(touchDataList)) { if (dialog == null) { dialog = new TextInputDialog(); dialog.Text = button.Label; dialog.Open(); } return(true); } if (dialog != null) { if (dialog.State == CommonDialogState.Finished) { if (dialog.Result == CommonDialogResult.OK) { button.Label = dialog.Text; } dialog.Dispose(); dialog = null; } } return(true); }
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 button1_Click(object sender, EventArgs e) { string[] labels = new string[] { "Is", "Testing", "Good?" }; object[] initial = new object[] { "Testing", "Is", "Good" }; TextInputDialog tid = new TextInputDialog(labels, initial); ShowAndPresentResults(tid); }
public TextInputDialog CreateNameInput() { GameObject root = Instantiate(textInputDialogPrefab); TextInputDialog ret = root.GetComponentInChildren <TextInputDialog> (); root.transform.GetChild(0).SetParent(InventoryView.instance.transform); return(ret); }
private void addCategoryBtn_Click(object sender, EventArgs e) { string category = TextInputDialog.Show("新しいカテゴリーの名前: "); categoriesListView.Items.Add(this.listViewItem.Of(category)); this.viewData.Operator.AddCategory(category); this.listView.UpdateCategoriesListView(); }
private void menuItemSetDefaultValue_Click(object sender, EventArgs e) { TextInputDialog tid = new TextInputDialog("Set Default Value"); if (tid.ShowDialog() == DialogResult.OK) { this.DefaultValue = tid.Value; } }
/// <summary> /// This function is the callback used to execute the command when the menu item is clicked. /// See the constructor to see how the menu item is associated with this function using /// OleMenuCommandService service and MenuCommand class. /// </summary> /// <param name="sender">Event sender.</param> /// <param name="e">Event args.</param> private void MenuItemCallback(object sender, EventArgs e) { var dteSolutionHelper = new DteSolutionHelper(); var messageBoxHelper = new MessageBoxHelper(this.ServiceProvider); var selectedProject = dteSolutionHelper.GetSelectedProject(); string newProjectName; bool isOkButtonClicked = TextInputDialog .Show("Full Rename", "Enter new project name", selectedProject.Name, out newProjectName); if (!isOkButtonClicked) { return; } if (newProjectName == selectedProject.Name) { return; } var projectRenamer = new ProjectRenamer() { SolutionFullName = dteSolutionHelper.GetSolutionFullName(), ProjectFullName = selectedProject.FullName, ProjectName = selectedProject.Name, ProjectUniqueName = selectedProject.UniqueName, ProjectNameNew = newProjectName, SolutionProjects = dteSolutionHelper.GetSolutionProjects().Select(it => it.FullName) }; if (IsSharedProject(selectedProject)) { projectRenamer = new SharedTypeProjectRenamer { SolutionFullName = projectRenamer.SolutionFullName, ProjectFullName = selectedProject.FullName, ProjectName = selectedProject.Name, ProjectUniqueName = Path.ChangeExtension(selectedProject.UniqueName, null), ProjectNameNew = newProjectName, SolutionProjects = projectRenamer.SolutionProjects }; } try { projectRenamer.FullRename(); messageBoxHelper.ShowSuccessMessage(); } catch (IOException ioe) { messageBoxHelper.ShowErrorMessage(ioe, "Close all folders, text editors related to the project"); } catch (Exception ex) { messageBoxHelper.ShowErrorMessage(ex); } }
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); } }
public bool TryGetSavedLayoutName(string defaultName, Predicate <string> nameValidator, out string layoutName) { Validate.IsNotNull(defaultName, nameof(defaultName)); Validate.IsNotNull(nameValidator, nameof(nameValidator)); return(TextInputDialog.Show(WindowManagement_Resources.SaveLayoutCommandDefinitionMessageBox_Title, WindowManagement_Resources.SaveLayoutCommandDefinitionMessageBox_Label, 100, defaultName, nameValidator, out layoutName)); }
private void button2_Click(object sender, EventArgs e) { string[] labels = new string[] { "Is", "Testing", "Good?" }; object[] initial = new object[] { "Testing", "Is", "Good" }; object[] comboItems = new object[] { true, false, 1, 1.6f, "bad" }; TextInputDialog tid = new TextInputDialog(labels, initial, comboItems); ShowAndPresentResults(tid); }
/// Terminate public static void Term() { if (dialog != null) { dialog.Dispose(); dialog = null; } SampleDraw.Term(); graphics.Dispose(); }
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; } }
public void TextValueTest1() { TextInputDialog target = new TextInputDialog(); // TODO: Initialize to an appropriate value string expected = string.Empty; // TODO: Initialize to an appropriate value string actual; target.TextValue = expected; actual = target.TextValue; Assert.AreEqual(expected, actual); Assert.Inconclusive("Verify the correctness of this test method."); }
//#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); }
protected internal override void OnTouchEvent(TouchEventCollection touchEvents) { base.OnTouchEvent(touchEvents); if (touchEvents.PrimaryTouchEvent.Type == TouchEventType.Down) { this.dialog = new TextInputDialog(); this.dialog.Mode = this.TextInputMode; this.dialog.Text = this.Text; this.dialog.Open(); } }
public async Task <string?> ShowInput(InputDialogData data) { var dialog = new TextInputDialog(data); var showResult = await dialog.ShowAsync(); if (showResult == ContentDialogResult.Primary) { return(dialog.Data.InputDefaultValue); } return(null); }
private async void OnPlayerRequestClass(PlayerRequestClassEvent eventdata) { this.logger.LogInformation($"Player {eventdata.Player} requested class"); var dialog = new TextInputDialog("Hey", "Login pls", "Login"); var response = await this.dialogHandler.ShowDialogAsync(eventdata.Player, dialog); this.logger.LogInformation($"Text: {response.InputText}"); eventdata.Player.Spawn(); }
public void Update(MouseState ms_Mouse) { sSprite.Alpha = 0.5f; cText = new Color(Color.White, 0.5f); if (new Rectangle((int)sSprite.Position.X, (int)sSprite.Position.Y, sSprite.FrameWidth, sSprite.FrameHeight).Intersects(new Rectangle((int)ms_Mouse.X, (int)ms_Mouse.Y, 1, 1))) { Hovered(); if (ms_Mouse.LeftButton == ButtonState.Pressed && !bClicked) { if (sText == sStandardText) { sText = ""; } cText = new Color(Color.White, 1.0f); bClicked = true; bSelected = true; kLastKey = Keys.None; } } else if (ms_Mouse.LeftButton == ButtonState.Pressed && bSelected) { if (sText == "") { sText = sStandardText; cText = new Color(Color.White, 0.5f); } bClicked = false; bSelected = false; } if (bSelected) { #if DESKTOP iFlashTimer -= (int)Control.DeltaTime.dDeltaTime; if (iFlashTimer <= 0) { iFlashTimer = 400; } iTime -= (int)Control.DeltaTime.dDeltaTime; Keys[] key = Keyboard.GetState().GetPressedKeys(); bool bShift, bNum; bShift = Control.KeyChecker.GetShift(key); bNum = Control.KeyChecker.GetNumLock(key); if (key.Length == 0) { bKeyPressed = false; kLastKey = Keys.None; } if (key.Length > 0) { if (kLastKey != key[0]) { bKeyPressed = false; } Char c = Control.KeyChecker.TranslateChar(key, bShift, bNum); if (c != (char)0) { if (sText == sStandardText) { sText = ""; } if (!bKeyPressed && key[0] != Keys.None) { bKeyPressed = true; kLastKey = key[0]; sText += c; } } else if (key[0] == Keys.Back && iTime <= 0) { iTime = 50; if (sText.Length > 0) { sText = sText.Substring(0, sText.Length - 1); } return; } } #elif PSM // input dialog. if (dialog == null) { dialog = new TextInputDialog(); if (sText == "Filename") { sText = ""; } dialog.Text = sText; dialog.Open(); bSelected = false; } #endif } #if PSM if (dialog != null) { if (dialog.State == CommonDialogState.Finished) { if (dialog.Result == CommonDialogResult.OK) { int len = dialog.Text.Length; sText = dialog.Text.Substring(0,len); } dialog.Dispose(); dialog = null; bClicked = false; bSelected = false; } } #endif }