public static Tuple <bool, T> Show <T>(string questionText, string title, T defaultValue, NumTextBox.Type type = NumTextBox.Type.Int) { var res = true; T t = default(T); Application.Current.Dispatcher.Invoke(new Action(() => { InputBoxX nb = new InputBoxX { Title = title, QuestionText = questionText, Type = type, NumText = defaultValue.ToString(), Owner = ControlHelper.GetTopWindow() }; nb.ShowDialog(); try { t = (T)Convert.ChangeType(nb.NumText, typeof(T)); } catch (FormatException) {} res = nb.Result; })); return(new Tuple <bool, T>(res, t)); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.mb = ((WxTools.Theme.Control.InputBoxX)(target)); return; case 2: this.InputTextBox = ((WxTools.Theme.Control.NumTextBox)(target)); return; case 3: this.btnOK = ((WxTools.Theme.Control.FButton)(target)); return; case 4: this.btnCancel = ((WxTools.Theme.Control.FButton)(target)); return; } this._contentLoaded = true; }