示例#1
0
        public static bool Show(Form owner, string windowText, string mainTitle, string subTitle, string defaultName, ref string name, ref string comments, bool readOnly, Visualisable supports)
        {
            bool canRename  = supports == null || IVisualisableExtensions.SupportsRename(supports);
            bool canComment = supports == null || IVisualisableExtensions.SupportsComment(supports);

            if (!canRename && !canComment)
            {
                FrmMsgBox.ShowInfo(owner, defaultName, "This item cannot be renamed.");
                return(false);
            }

            using (FrmEditINameable frm = new FrmEditINameable())
            {
                frm.Text = windowText;

                frm.textBox1.Watermark   = defaultName;
                frm.textBox1.Text        = name;
                frm._txtInput.Text       = comments;
                frm.ctlTitleBar1.Text    = mainTitle;
                frm.ctlTitleBar1.SubText = subTitle;

                frm.AcceptButton = null;
                frm.CancelButton = frm._btnCancel;

                frm.textBox1.Visible  = canRename;
                frm.label6.Visible    = !canRename;
                frm.label6.Text       = defaultName;
                frm._txtInput.Visible = canComment;
                frm.label2.Visible    = canComment;

                if (readOnly)
                {
                    frm._btnOk.Visible     = false;
                    frm._btnCancel.Text    = "  Close";
                    frm.AcceptButton       = frm._btnCancel;
                    frm.textBox1.ReadOnly  = true;
                    frm._txtInput.ReadOnly = true;
                }

                if (UiControls.ShowWithDim(owner, frm) == DialogResult.OK)
                {
                    name     = frm.textBox1.Text;
                    comments = frm._txtInput.Text;
                    return(true);
                }

                return(false);
            }
        }
示例#2
0
        private void Rename(Visualisable item)
        {
            string name    = item.OverrideDisplayName;
            string comment = item.Comment;

            if (FrmEditINameable.Show(this, item.DefaultDisplayName, "Rename", item.ToString(), item.DefaultDisplayName, ref name, ref comment, false, item))
            {
                this._backups.Backup(item, "Name changed");

                item.OverrideDisplayName = name;
                item.Comment             = comment;

                this._listViewHelper.Rebuild(EListInvalids.ValuesChanged);
            }
        }
示例#3
0
        public static bool Show(Form owner, TextBox name, ref string comments, bool readOnly)
        {
            if (readOnly)
            {
                FrmInputMultiLine.ShowFixed(owner, owner.Text, "View Comments", name.Text, comments);
                return(false);
            }
            else
            {
                string names = name.Text;

                if (FrmEditINameable.Show(owner, owner.Text, "Edit name and comments", null, name.Text, ref names, ref comments, readOnly, null))
                {
                    name.Text = names;
                    return(true);
                }

                return(false);
            }
        }
示例#4
0
 private void _btnComment_Click(object sender, EventArgs e)
 {
     FrmEditINameable.Show(this, this._txtName, ref this._comment, this._readOnly);
 }