private string GetUserInput(Dictionary <string, string> Options, Dictionary <string, string> Overrides) { InputBox input = null; lock (this._InputBoxLocker) { if (this._IsFinalizing) { return(null); } SkinWindow skin = new SkinWindow(rm); // Create the form. 'InputBox' is a .NET form with a textbox and two button controls on it. this._InputBox = new InputBox(skin); input = this._InputBox; input.ChangeX("0"); input.ChangeY("0"); // Change the styles of the InputBox form based on overrides or INI values #region Style and preference tweaks (INI and override settings) ChangeInputBoxSetting changeSetting = (opt, change) => { if (Overrides.ContainsKey(opt)) { change(Overrides[opt]); } else if (Options.ContainsKey(opt)) { change(Options[opt]); } }; changeSetting("FontFace", input.ChangeFontFace); changeSetting("FontSize", input.ChangeFontSize); changeSetting("W", input.ChangeW); changeSetting("H", input.ChangeH); changeSetting("X", input.ChangeX); changeSetting("Y", input.ChangeY); changeSetting("StringStyle", input.ChangeFontStringStyle); changeSetting("StringAlign", input.ChangeStringAlign); changeSetting("FontColor", input.ChangeFontColor); changeSetting("SolidColor", input.ChangeBackColor); if (Overrides.ContainsKey("FocusDismiss")) { input.MakeFocusDismiss(Overrides["FocusDismiss"] == "1"); } else if (Options.ContainsKey("FocusDismiss")) { input.MakeFocusDismiss(Options["FocusDismiss"].Trim() == "1"); } if (Overrides.ContainsKey("Password")) { input.MakePassword(Overrides["Password"] == "1"); } else if (Options.ContainsKey("Password")) { input.MakePassword(Options["Password"].Trim() == "1"); } string topmost = null; if (Overrides.ContainsKey("TopMost")) { topmost = Overrides["TopMost"]; } else if (Options.ContainsKey("TopMost")) { topmost = Options["TopMost"].Trim(); } switch (topmost) { case "1": input.MakeTopmost(); break; case "0": break; default: // AUTO if (skin.IsTopmost) { input.MakeTopmost(); } break; } changeSetting("DefaultValue", input.DefaultValue); #endregion } string result = null; if (input.ShowInputBox()) { lock (this.locker) { this.LastInput = input.TextValue; result = this.LastInput; } } // Dispose input = null; lock (this._InputBoxLocker) { this._InputBox.Dispose(); this._InputBox = null; } return(result); }
public InputBox(SkinWindow parent) { this.parent = parent; InitializeComponent(); }
private string GetUserInput(Dictionary<string, string> Options, Dictionary<string, string> Overrides) { InputBox input = null; lock (this._InputBoxLocker) { if (this._IsFinalizing) return null; SkinWindow skin = new SkinWindow(rm); // Create the form. 'InputBox' is a .NET form with a textbox and two button controls on it. this._InputBox = new InputBox(skin); input = this._InputBox; input.ChangeX("0"); input.ChangeY("0"); // Change the styles of the InputBox form based on overrides or INI values #region Style and preference tweaks (INI and override settings) ChangeInputBoxSetting changeSetting = (opt, change) => { if (Overrides.ContainsKey(opt)) change(Overrides[opt]); else if (Options.ContainsKey(opt)) change(Options[opt]); }; changeSetting("FontFace", input.ChangeFontFace); changeSetting("FontSize", input.ChangeFontSize); changeSetting("W", input.ChangeW); changeSetting("H", input.ChangeH); changeSetting("X", input.ChangeX); changeSetting("Y", input.ChangeY); changeSetting("StringStyle", input.ChangeFontStringStyle); changeSetting("StringAlign", input.ChangeStringAlign); changeSetting("FontColor", input.ChangeFontColor); changeSetting("SolidColor", input.ChangeBackColor); if (Overrides.ContainsKey("FocusDismiss")) input.MakeFocusDismiss(Overrides["FocusDismiss"] == "1"); else if (Options.ContainsKey("FocusDismiss")) input.MakeFocusDismiss(Options["FocusDismiss"].Trim() == "1"); if (Overrides.ContainsKey("Password")) input.MakePassword(Overrides["Password"] == "1"); else if (Options.ContainsKey("Password")) input.MakePassword(Options["Password"].Trim() == "1"); string topmost = null; if (Overrides.ContainsKey("TopMost")) topmost = Overrides["TopMost"]; else if (Options.ContainsKey("TopMost")) topmost = Options["TopMost"].Trim(); switch (topmost) { case "1": input.MakeTopmost(); break; case "0": break; default: // AUTO if (skin.IsTopmost) input.MakeTopmost(); break; } changeSetting("DefaultValue", input.DefaultValue); #endregion } string result = null; if (input.ShowInputBox()) { lock (this.locker) { this.LastInput = input.TextValue; result = this.LastInput; } } // Dispose input = null; lock (this._InputBoxLocker) { this._InputBox.Dispose(); this._InputBox = null; } return result; }