public static void GetInput(Browser browser, bool modal, SendResult <BrowseType, String> sendResult) { InputBrowserWindow <BrowseType> inputBox = new InputBrowserWindow <BrowseType>(browser.Prompt, ""); inputBox.setBrowser(browser); inputBox.SendResult = sendResult; inputBox.Closing += new EventHandler <DialogCancelEventArgs>(inputBox_Closing); inputBox.Closed += new EventHandler(inputBox_Closed); inputBox.center(); inputBox.open(modal); }
static void inputBox_Closing(object sender, DialogCancelEventArgs e) { InputBrowserWindow <BrowseType> inputBox = (InputBrowserWindow <BrowseType>)sender; String errorPrompt = null; if (inputBox.Accepted && !inputBox.SendResult(inputBox.SelectedValue, inputBox.Input, ref errorPrompt)) { MessageBox.show(errorPrompt, "Error", MessageBoxStyle.IconError | MessageBoxStyle.Ok); inputBox.selectAllText(); e.Cancel = true; } }
private static void inputBox_Closed(object sender, EventArgs e) { InputBrowserWindow <BrowseType> inputBox = (InputBrowserWindow <BrowseType>)sender; inputBox.Dispose(); }
public void showInputBrowser <T>(Browser browser, SendResult <T, string> resultCallback) { InputBrowserWindow <T> .GetInput(browser, true, resultCallback); }