Esempio n. 1
0
        public static string Show(Form owner, string formText, string title, string subTitle, string @default)
        {
            using (FrmInputSingleLine find = new FrmInputSingleLine())
            {
                find.Text = formText;
                find.ctlTitleBar1.Text    = title;
                find.ctlTitleBar1.SubText = subTitle;
                find._txtInput.Text       = @default;

                if (UiControls.ShowWithDim(owner, find) == DialogResult.OK)
                {
                    return(find._txtInput.Text);
                }

                return(null);
            }
        }
Esempio n. 2
0
        private void _btnOk_Click(object sender, EventArgs e)
        {
            string fileName;

            if (string.IsNullOrEmpty(this._fileName))
            {
                string text = FrmInputSingleLine.Show(this, this.Text, "Save changes", "Please enter a name for your script", "");

                if (string.IsNullOrEmpty(text))
                {
                    return;
                }

                fileName = Path.Combine(UiControls.GetOrCreateFixedFolder(this._saveFolder), text + ".r");
            }
            else if (FrmMsgBox.ShowYesNo(this, this.Text, "Save changes?\r\n" + this._fileName, Resources.MsgInfo))
            {
                fileName = this._fileName;
            }
            else
            {
                return;
            }

            try
            {
                File.WriteAllText(fileName, this.textBox1.Text);
            }
            catch (Exception ex)
            {
                FrmMsgBox.ShowError(this, ex);
                return;
            }

            this._fileName    = fileName;
            this.DialogResult = DialogResult.OK;
        }