Пример #1
0
        private bool CheckNameDuplicate(string pName)
        {
            int index = CataloguesIndex.GetIndexByName(pName);

            if (index < 0)
            {
                return(false);
            }

            MessageBox.Show("There's already a catalogue with this name", "Name duplicated", MessageBoxButtons.OK);
            return(true);
        }
Пример #2
0
        private void CatalogueIndexOpsForm_Load(object sender, EventArgs e)
        {
            CatalogueInfo currentCatalogue;

            if (CataloguesIndex == null)
            {
                MessageBox.Show("ERROR: No Catalogue Index has been specified", "Error", MessageBoxButtons.OK);
                DialogResult = DialogResult.Cancel;
                Close();
                return;
            }

            if (_operation != CataloguesIndexOperation.NewCatalogue)
            {
                if (CataloguesIndex.GetIndexByName(_selectedCatalogueName) < 0)
                {
                    MessageBox.Show("ERROR: Current Catalogue not found in the index", "Error", MessageBoxButtons.OK);
                    DialogResult = DialogResult.Cancel;
                    Close();
                    return;
                }
            }

            SetToolTips();
            ContextHelp.HelpNamespace = Globals.HelpFilename;
            ContextHelp.SetHelpNavigator(this, HelpNavigator.TopicId);

            switch (_operation)
            {
            case CataloguesIndexOperation.NewCatalogue:
                Text = "Create New Catalogue";
                lblCurrentCat.Visible = tbCurrentCat.Visible = false;
                tbNewCat.Focus();
                break;

            case CataloguesIndexOperation.RenameCatalogue:
                Text = "Rename Selected Catalogue";
                tbCurrentCat.Text      = _selectedCatalogueName;
                lblNewCat.Text         = "New Name:";
                tbDescription.ReadOnly = true;
                currentCatalogue       = CataloguesIndex.GetByName(_selectedCatalogueName);
                tbDescription.Text     = currentCatalogue.Description;
                tbNewCat.Focus();
                break;

            case CataloguesIndexOperation.EditDescription:
                Text = "Edit Description of Selected Catalogue";
                tbCurrentCat.Text      = _selectedCatalogueName;
                lblNewCat.Visible      = tbNewCat.Visible = false;
                tbDescription.ReadOnly = false;
                _formToolTip.SetToolTip(tbDescription, "New description of the selected catalogue");
                currentCatalogue   = CataloguesIndex.GetByName(_selectedCatalogueName);
                tbDescription.Text = currentCatalogue.Description;
                tbDescription.Focus();
                break;

            case CataloguesIndexOperation.CopyCatalogue:
                Text = "Copy Current Catalogue";
                tbCurrentCat.Text = _selectedCatalogueName;
                lblNewCat.Text    = "New Catalogue:";
                _formToolTip.SetToolTip(tbNewCat, "Name of the new (copy) catalogue");
                _formToolTip.SetToolTip(tbDescription, "Description of the new (copy) catalogue");
                tbDescription.ReadOnly = false;
                currentCatalogue       = CataloguesIndex.GetByName(_selectedCatalogueName);
                tbDescription.Text     = currentCatalogue.Description;
                tbNewCat.Focus();
                break;
            }
        }