Пример #1
0
        /// <summary>
        /// Changes the name to the Custom selected DisplaySet
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnRenameDisplaySet_Click(object sender, EventArgs e)
        {
            // Only custom DisplaySets can be modified
            if (SelectedDisplaySet == null || !SelectedDisplaySet.Custom)
            {
                return;
            }

            string oldName = SelectedDisplaySet.Name;

            // Create the not valid name list with the other DisplaySet names
            StringCollection notValidNames = new StringCollection();

            foreach (DisplaySetInformation displaySet in mTempDisplaySets)
            {
                if (displaySet.Name != oldName)
                {
                    notValidNames.Add(displaySet.Name);
                }
            }

            // Open the form
            RenameDisplaySetForm form = new RenameDisplaySetForm();

            form.Initialize(oldName, notValidNames);
            if (form.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            // If not canceled, changes the names
            string newName = form.DisplaySetName;

            lstDisplaySets.SelectedItems[0].Text = newName;
            SelectedDisplaySet.Name = newName;
        }
Пример #2
0
        /// <summary>
        /// Changes the name to the Custom selected DisplaySet
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnRenameDisplaySet_Click(object sender, EventArgs e)
        {
            // Only custom DisplaySets can be modified
            if (SelectedDisplaySet == null || !SelectedDisplaySet.Custom)
                return;

            string oldName = SelectedDisplaySet.Name;

            // Create the not valid name list with the other DisplaySet names
            StringCollection notValidNames = new StringCollection();
            foreach (DisplaySetInformation displaySet in mTempDisplaySets)
            {
                if (displaySet.Name != oldName)
                    notValidNames.Add(displaySet.Name);
            }

            // Open the form
            RenameDisplaySetForm form = new RenameDisplaySetForm();
            form.Initialize(oldName, notValidNames);
            if (form.ShowDialog() != DialogResult.OK)
                return;

            // If not canceled, changes the names
            string newName = form.DisplaySetName;
            lstDisplaySets.SelectedItems[0].Text = newName;
            SelectedDisplaySet.Name = newName;
        }