예제 #1
0
        private void AddFolder(object sender, EventArgs e)
        {
            frmInputBox form = new frmInputBox("输入目录名称:", "新建目录", "");
            var         res  = form.ShowDialog();

            if (res == DialogResult.OK && !Folder.HasFolder(form.NewText))
            {
                PartFolder folder = new PartFolder {
                    Name = form.NewText
                };
                Folder.Add(folder);
            }
        }
예제 #2
0
        private void RenameFolder(object sender, EventArgs e)
        {
            frmInputBox form =
                new frmInputBox(
                    string.Format("将名为{0}的项目重命名为:", Folder.Name),
                    "项目重命名",
                    Folder.Name);
            var res = form.ShowDialog();

            if (res == DialogResult.OK)
            {
                Folder.Rename(form.NewText);
            }
        }
예제 #3
0
        private void mnuRename_Click(object sender, EventArgs e)
        {
            var         index = Folder.PartIndexs[SelectedIndex];
            var         part  = Database.ImagePartTable[index];
            frmInputBox form  =
                new frmInputBox(
                    string.Format("将名为{0}的项目重命名为:", part.Name),
                    "项目重命名",
                    part.Name);

            form.ShowDialog();
            if (form.DialogResult == DialogResult.OK)
            {
                Rename(part, form.NewText);
                UpdateView();
            }
        }
예제 #4
0
        private void cboStandard_SelectedIndexChanged(object sender, EventArgs e)
        {
            var lastIndex = cboStandard.Items.Count - 1;

            if (cboStandard.SelectedIndex == lastIndex)
            {
                frmInputBox inputBox = new frmInputBox("请输入标准名称:", "添加标准", "新的标准");
                var         res      = inputBox.ShowDialog();
                if (res == DialogResult.OK)
                {
                    var newName = inputBox.NewText.Trim();
                    if (string.IsNullOrEmpty(newName))
                    {
                        return;
                    }

                    if (cboStandard.Items.Contains(newName))
                    {
                        MessageBox.Show(
                            string.Format("无法添加标准\"{0}\":与现有标准重名", newName),
                            "添加标准时出错");
                        Standard = _standard;
                        return;
                    }
                    else
                    {
                        _database.ImagePartTable.AddDictionary(newName);
                        cboStandard.Items.Insert(lastIndex, newName);
                        cboStandard.SelectedIndex = lastIndex;
                    }
                }
                else
                {
                    cboStandard.Text = _standard;
                }
            }

            _standard = Standard;
            if (txtNo.Enabled = lblNo.Enabled = Standard != "Main")
            {
                txtNo.Select();
            }
            Check(null, null);
        }