Beispiel #1
0
        /// <summary>
        /// Required designer variable.
        /// </summary>
        //private System.ComponentModel.Container components = null;

        public InputBoxLarge()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            Instance = this;
        }
Beispiel #2
0
        /// <summary>
        /// Get a line of input from the user
        /// </summary>
        /// <param name="prompt"></param>
        /// <param name="title"></param>
        /// <param name="defaultText"></param>
        /// <param name="width"></param>
        /// <param name="height"></param>
        /// <returns>New input or null if cancelled</returns>

        public static string Show(
            string prompt,
            string title,
            string defaultText,
            int width,
            int height)
        {
            string txt;

            if (Instance == null)
            {
                Instance = new InputBoxLarge();
            }

            if (width > 0)
            {
                Instance.Width = width;
            }
            if (height > 0)
            {
                Instance.Height = height;
            }

            Instance.Prompt.Text = prompt;

            Instance.Text       = title;
            Instance.Input.Text = defaultText;

            DialogResult dr = Instance.ShowDialog(Form.ActiveForm);             // (SessionManager.ActiveForm);

            if (dr == DialogResult.Cancel)
            {
                return(null);
            }
            else
            {
                return(Instance.Input.Text);
            }
        }