Exemple #1
0
        private void buttonAddProfile_Click(object sender, EventArgs e)
        {
            SaveCurrentItem();

            TextDialog dialog = new TextDialog("Enter a name for the new profile","Profile Name","New Profile");

            while (dialog.ShowDialog() == DialogResult.OK)
            {
                if (dialog.Response == string.Empty)
                {
                    MessageBox.Show(@"Profile name can not be blank.");
                }

                if (comboBoxProfiles.Items.Cast<ProfileItem>().Any(items => items.Name == dialog.Response))
                {
                    MessageBox.Show(@"A profile with the name " + dialog.Response + @" already exists.");
                }

                if (dialog.Response != string.Empty && comboBoxProfiles.Items.Cast<ProfileItem>().All(items => items.Name != dialog.Response))
                {
                    break;
                }

            }

            if (dialog.DialogResult == DialogResult.Cancel)
                return;

            ProfileItem item = new ProfileItem { Name = dialog.Response, DataFolder = _defaultFolder + " " + dialog.Response };
            comboBoxProfiles.Items.Add(item);
            comboBoxProfiles.SelectedIndex = comboBoxProfiles.Items.Count - 1;
            PopulateLoadProfileSection(false);
        }
Exemple #2
0
		public bool SetupTemplate(IEnumerable<ElementNode> selectedNodes = null)
		{
			using (TextDialog td = new TextDialog("New Element Name?", "Element Name", itemName, true)) {
				DialogResult dr = td.ShowDialog();
				if (dr == DialogResult.OK) {
					itemName = td.Response;
					if (itemName == "") {
						itemName = "New Item";
					}
					return true;
				}
			}
			return false;
		}
Exemple #3
0
        internal bool AddGradientToLibrary(ColorGradient cg, bool edit = true)
        {
            Common.Controls.TextDialog dialog = new Common.Controls.TextDialog("Gradient name?");

            while (dialog.ShowDialog() == DialogResult.OK)
            {
                if (dialog.Response == string.Empty)
                {
                    //messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
                    MessageBoxForm.msgIcon = SystemIcons.Error;                     //this is used if you want to add a system icon to the message form.
                    var messageBox = new MessageBoxForm("Please enter a name.", "Warning", false, false);
                    messageBox.ShowDialog();
                    continue;
                }

                if (_colorGradientLibrary.Contains(dialog.Response))
                {
                    //messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
                    MessageBoxForm.msgIcon = SystemIcons.Warning;                     //this is used if you want to add a system icon to the message form.
                    var messageBox = new MessageBoxForm("There is already a gradient with that name. Do you want to overwrite it?", "Overwrite gradient?", true, true);
                    messageBox.ShowDialog();
                    if (messageBox.DialogResult == DialogResult.OK)
                    {
                        _colorGradientLibrary.AddColorGradient(dialog.Response, cg);
                        if (edit)
                        {
                            _colorGradientLibrary.EditLibraryItem(dialog.Response);
                        }
                        OnGradientLibraryChanged();
                        return(false);
                    }

                    if (messageBox.DialogResult == DialogResult.Cancel)
                    {
                        return(true);
                    }
                }
                else
                {
                    _colorGradientLibrary.AddColorGradient(dialog.Response, cg);
                    if (edit)
                    {
                        _colorGradientLibrary.EditLibraryItem(dialog.Response);
                    }
                    OnGradientLibraryChanged();
                    return(false);
                }
            }
            return(true);
        }
Exemple #4
0
        internal bool AddCurveToLibrary(Curve c, bool edit = true)
        {
            Common.Controls.TextDialog dialog = new Common.Controls.TextDialog("Curve name?");

            while (dialog.ShowDialog() == DialogResult.OK)
            {
                if (dialog.Response == string.Empty)
                {
                    //messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
                    var messageBox = new MessageBoxForm("Please enter a name.", "Curve Name", false, false);
                    messageBox.ShowDialog();
                    continue;
                }

                if (_curveLibrary.Contains(dialog.Response))
                {
                    //messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
                    MessageBoxForm.msgIcon = SystemIcons.Question;                     //this is used if you want to add a system icon to the message form.
                    var messageBox = new MessageBoxForm("There is already a curve with that name. Do you want to overwrite it?", "Overwrite curve?", true, true);
                    messageBox.ShowDialog();
                    if (messageBox.DialogResult == DialogResult.OK)
                    {
                        _curveLibrary.AddCurve(dialog.Response, c);
                        if (edit)
                        {
                            _curveLibrary.EditLibraryCurve(dialog.Response);
                        }
                        OnCurveLibraryChanged();
                        return(false);
                    }

                    if (messageBox.DialogResult == DialogResult.Cancel)
                    {
                        return(true);
                    }
                }
                else
                {
                    _curveLibrary.AddCurve(dialog.Response, c);
                    if (edit)
                    {
                        _curveLibrary.EditLibraryCurve(dialog.Response);
                    }
                    OnCurveLibraryChanged();
                    return(false);
                }
            }
            return(true);
        }
Exemple #5
0
 public bool RenameControllerWithPrompt(IControllerDevice outputController)
 {
     using (TextDialog textDialog = new TextDialog("Controller Name?", "Controller Name", outputController.Name, true)) {
         if (textDialog.ShowDialog() == DialogResult.OK)
         {
             if (textDialog.Response != string.Empty)
             {
                 outputController.Name = textDialog.Response;
                 OnControllersChanged();
                 PopulateControllerTree();
                 return(true);
             }
         }
     }
     return(false);
 }
Exemple #6
0
        public bool RenameSelectedElements()
        {
            if (SelectedTreeNodes.Count == 0)
            {
                return(false);
            }

            if (SelectedTreeNodes.Count == 1)
            {
                using (TextDialog dialog = new TextDialog("Item name?", "Rename item", (SelectedNode).Name, true)) {
                    if (dialog.ShowDialog() == DialogResult.OK)
                    {
                        if (dialog.Response != string.Empty && dialog.Response != SelectedNode.Name)
                        {
                            VixenSystem.Nodes.RenameNode(SelectedNode, dialog.Response);
                            PopulateNodeTree();

                            return(true);
                        }
                    }
                }
            }
            else if (SelectedTreeNodes.Count > 1)
            {
                List <string> oldNames = new List <string>(treeview.SelectedNodes.Select(x => x.Tag as ElementNode).Select(x => x.Name).ToArray());
                NameGenerator renamer  = new NameGenerator(oldNames.ToArray());
                if (renamer.ShowDialog() == DialogResult.OK)
                {
                    for (int i = 0; i < treeview.SelectedNodes.Count; i++)
                    {
                        if (i >= renamer.Names.Count)
                        {
                            Logging.Warn("ConfigElements: bulk renaming elements, and ran out of new names!");
                            break;
                        }
                        VixenSystem.Nodes.RenameNode((treeview.SelectedNodes[i].Tag as ElementNode), renamer.Names[i]);
                    }

                    PopulateNodeTree();

                    return(true);
                }
            }

            return(false);
        }
Exemple #7
0
        private void buttonAddColorSet_Click(object sender, EventArgs e)
        {
            using (TextDialog textDialog = new TextDialog("New Color Set name?", "New Color Set")) {
                if (textDialog.ShowDialog() == DialogResult.OK) {
                    string newName = textDialog.Response;

                    if (_data.ContainsColorSet(newName)) {
                        MessageBox.Show("Color Set already exists.");
                        return;
                    }

                    ColorSet newcs = new ColorSet();
                    _data.SetColorSet(newName, newcs);
                    UpdateGroupBoxWithColorSet(newName, newcs);
                    UpdateColorSetsList();
                }
            }
        }
Exemple #8
0
        private void buttonNewCurve_Click(object sender, EventArgs e)
        {
            Common.Controls.TextDialog dialog = new Common.Controls.TextDialog("Curve name?");

            while (dialog.ShowDialog() == DialogResult.OK)
            {
                if (dialog.Response == string.Empty)
                {
                    //messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
                    MessageBoxForm.msgIcon = SystemIcons.Error;                     //this is used if you want to add a system icon to the message form.
                    var messageBox = new MessageBoxForm("Please enter a name.", "Curve Name", false, false);
                    messageBox.ShowDialog();
                    continue;
                }

                if (Library.Contains(dialog.Response))
                {
                    //messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
                    MessageBoxForm.msgIcon = SystemIcons.Question;                     //this is used if you want to add a system icon to the message form.
                    var messageBox = new MessageBoxForm("There is already a curve with that name. Do you want to overwrite it?", "Overwrite curve?", true, true);
                    messageBox.ShowDialog();
                    if (messageBox.DialogResult == DialogResult.OK)
                    {
                        Library.AddCurve(dialog.Response, new Curve());
                        Library.EditLibraryCurve(dialog.Response);
                        PopulateListWithCurves();
                        break;
                    }
                    if (messageBox.DialogResult == DialogResult.Cancel)
                    {
                        break;
                    }
                }
                else
                {
                    Library.AddCurve(dialog.Response, new Curve());
                    Library.EditLibraryCurve(dialog.Response);
                    PopulateListWithCurves();
                    break;
                }
            }
        }
Exemple #9
0
        private void buttonNewColorGradient_Click(object sender, EventArgs e)
        {
            Common.Controls.TextDialog dialog = new Common.Controls.TextDialog("Gradient name?");

            while (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                if (dialog.Response == string.Empty)
                {
                    //messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
                    MessageBoxForm.msgIcon = SystemIcons.Error;
                    var messageBox = new MessageBoxForm("Please enter a name.", "Color Gradient Name", false, false);
                    messageBox.ShowDialog();
                    continue;
                }

                if (Library.Contains(dialog.Response))
                {
                    //messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
                    var messageBox = new MessageBoxForm("There is already a gradient with that name. Do you want to overwrite it?", "Overwrite gradient?", true, true);
                    MessageBoxForm.msgIcon = SystemIcons.Question;
                    messageBox.ShowDialog();
                    if (messageBox.DialogResult == DialogResult.OK)
                    {
                        Library.AddColorGradient(dialog.Response, new ColorGradient());
                        Library.EditLibraryItem(dialog.Response);
                        PopulateListWithColorGradients();
                        break;
                    }
                    else if (messageBox.DialogResult == System.Windows.Forms.DialogResult.Cancel)
                    {
                        break;
                    }
                }
                else
                {
                    Library.AddColorGradient(dialog.Response, new ColorGradient());
                    Library.EditLibraryItem(dialog.Response);
                    PopulateListWithColorGradients();
                    break;
                }
            }
        }
Exemple #10
0
        private void NewColorCollection()
        {
            Common.Controls.TextDialog dialog = new Common.Controls.TextDialog("Collecton Name?");
            while (dialog.ShowDialog() == DialogResult.OK)
            {
                if (dialog.Response == string.Empty)
                {
                    //messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
                    MessageBoxForm.msgIcon = SystemIcons.Error;                     //this is used if you want to add a system icon to the message form.
                    var messageBox = new MessageBoxForm("Please enter a name.", "Color Collection Name", false, false);
                    messageBox.ShowDialog();
                    continue;
                }
                ColorCollection item = new ColorCollection {
                    Name = dialog.Response
                };
                if (ColorCollections.Contains(item))
                {
                    //messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
                    MessageBoxForm.msgIcon = SystemIcons.Warning;                     //this is used if you want to add a system icon to the message form.
                    var messageBox = new MessageBoxForm("A collection with the name " + item.Name + @" already exists. Do you want to overwrite it?", "Overwrite collection?", true, true);
                    messageBox.ShowDialog();
                    if (messageBox.DialogResult == DialogResult.OK)
                    {
                        ColorCollections.Remove(item);
                        ColorCollections.Add(item);
                        _isDirty = true;
                        PopulateCollectionList();
                        comboBoxCollections.Text = item.Name;
                    }

                    break;
                }

                ColorCollections.Add(item);
                _isDirty = true;
                PopulateCollectionList();
                comboBoxCollections.Text = item.Name;
                break;
            }
        }
Exemple #11
0
        private void buttonAddColorSet_Click(object sender, EventArgs e)
        {
            using (TextDialog textDialog = new TextDialog("New Color Set name?", "New Color Set")) {
                if (textDialog.ShowDialog() == DialogResult.OK) {
                    string newName = textDialog.Response;

                    if (_data.ContainsColorSet(newName)) {
                        //messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
                        MessageBoxForm.msgIcon = SystemIcons.Error; //this is used if you want to add a system icon to the message form.
                        var messageBox = new MessageBoxForm("Color Set already exists.", "Error", false, false);
                        messageBox.ShowDialog();
                        return;
                    }

                    ColorSet newcs = new ColorSet();
                    _data.SetColorSet(newName, newcs);
                    UpdateGroupBoxWithColorSet(newName, newcs);
                    UpdateColorSetsList();
                }
            }
        }
Exemple #12
0
 private void buttonNewCollection_Click(object sender, EventArgs e)
 {
     Common.Controls.TextDialog dialog = new Common.Controls.TextDialog("Collecton Name?");
     while (dialog.ShowDialog() == DialogResult.OK)
     {
         if (dialog.Response == string.Empty)
         {
             MessageBox.Show("Please enter a name.");
             continue;
         }
         ColorCollection item = new ColorCollection();
         item.Name = dialog.Response;
         if (ColorCollections.Contains(item))
         {
             DialogResult result = MessageBox.Show("There is already a collection with the name " + item.Name + ". Do you want to overwrite it?",
                                                   "Overwrite collection?", MessageBoxButtons.YesNoCancel);
             if (result == DialogResult.Yes)
             {
                 ColorCollections.Remove(item);
                 ColorCollections.Add(item);
                 isDirty = true;
                 PopulateCollectionList();
                 comboBoxCollections.Text = item.Name;
                 break;
             }
             else if (result == DialogResult.Cancel)
             {
                 break;
             }
         }
         else
         {
             ColorCollections.Add(item);
             isDirty = true;
             PopulateCollectionList();
             comboBoxCollections.Text = item.Name;
             break;
         }
     }
 }
Exemple #13
0
        private void buttonAddProfile_Click(object sender, EventArgs e)
        {
            SaveCurrentItem();

            TextDialog dialog = new TextDialog("Enter a name for the new profile","Profile Name","New Profile");

            while (dialog.ShowDialog() == DialogResult.OK)
            {
                if (dialog.Response == string.Empty)
                {
                    //messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
                    MessageBoxForm.msgIcon = SystemIcons.Error; //this is used if you want to add a system icon to the message form.
                    var messageBox = new MessageBoxForm("Profile name can not be blank.",
                        "Error", false, false);
                    messageBox.ShowDialog();
                }

                if (comboBoxProfiles.Items.Cast<ProfileItem>().Any(items => items.Name == dialog.Response))
                {
                    //messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
                    MessageBoxForm.msgIcon = SystemIcons.Warning; //this is used if you want to add a system icon to the message form.
                    var messageBox = new MessageBoxForm("A profile with the name " + dialog.Response + @" already exists.", "", false, false);
                    messageBox.ShowDialog();
                }

                if (dialog.Response != string.Empty && comboBoxProfiles.Items.Cast<ProfileItem>().All(items => items.Name != dialog.Response))
                {
                    break;
                }

            }

            if (dialog.DialogResult == DialogResult.Cancel)
                return;

            ProfileItem item = new ProfileItem { Name = dialog.Response, DataFolder = _defaultFolder + " " + dialog.Response };
            comboBoxProfiles.Items.Add(item);
            comboBoxProfiles.SelectedIndex = comboBoxProfiles.Items.Count - 1;
            PopulateLoadProfileSection(false);
        }
Exemple #14
0
        public ElementNode AddSingleNodeWithPrompt(ElementNode parent = null)
        {
            // since we're only adding a single node, prompt with a single text dialog.
            using (TextDialog textDialog = new TextDialog("Element Name?")) {
                if (textDialog.ShowDialog() == DialogResult.OK)
                {
                    string newName;
                    if (textDialog.Response == string.Empty)
                    {
                        newName = "New Element";
                    }
                    else
                    {
                        newName = textDialog.Response;
                    }

                    ElementNode en = AddNewNode(newName, true, parent);
                    return(en);
                }
            }

            return(null);
        }
Exemple #15
0
        public bool AddNewControllerOfTypeWithPrompts(Guid controllerTypeId)
        {
            IModuleDescriptor moduleDescriptor = ApplicationServices.GetModuleDescriptor(controllerTypeId);
            if (moduleDescriptor == null) {
                Logging.Error("couldn't get descriptor for controller of type ID: " + controllerTypeId);
                return false;
            }

            string defaultName = moduleDescriptor.TypeName;
            string name;
            using (TextDialog textDialog = new TextDialog("New Controller Name?", "Controller Name", defaultName, true)) {
                if (textDialog.ShowDialog() != DialogResult.OK)
                    return false;

                name = textDialog.Response;
                if (name.Length <= 0)
                    name = defaultName;
            }

            int outputCount;
            using (NumberDialog nd = new NumberDialog("Controller Output Count", "Outputs on this controller?", 0)) {
                if (nd.ShowDialog() != DialogResult.OK)
                    return false;

                outputCount = nd.Value;
            }

            ControllerFactory controllerFactory = new ControllerFactory();
            OutputController oc = (OutputController)controllerFactory.CreateDevice(controllerTypeId, name);
            oc.OutputCount = outputCount;
            VixenSystem.OutputControllers.Add(oc);

            PopulateControllerTree(oc);
            OnControllersChanged();

            return true;
        }
Exemple #16
0
        private void toolStripButtonNewCurve_Click(object sender, EventArgs e)
        {
            Common.Controls.TextDialog dialog = new Common.Controls.TextDialog("Curve name?");

            while (dialog.ShowDialog() == DialogResult.OK)
            {
                if (dialog.Response == string.Empty)
                {
                    MessageBox.Show("Please enter a name.");
                    continue;
                }

                if (_curveLibrary.Contains(dialog.Response))
                {
                    DialogResult result = MessageBox.Show("There is already a curve with that name. Do you want to overwrite it?",
                                                          "Overwrite curve?", MessageBoxButtons.YesNoCancel);
                    if (result == DialogResult.Yes)
                    {
                        _curveLibrary.AddCurve(dialog.Response, new Curve());
                        _curveLibrary.EditLibraryCurve(dialog.Response);
                        Populate_Curves();
                        break;
                    }
                    else if (result == DialogResult.Cancel)
                    {
                        break;
                    }
                }
                else
                {
                    _curveLibrary.AddCurve(dialog.Response, new Curve());
                    _curveLibrary.EditLibraryCurve(dialog.Response);
                    break;
                }
            }
        }
Exemple #17
0
        private void toolStripButtonNewGradient_Click(object sender, EventArgs e)
        {
            Common.Controls.TextDialog dialog = new Common.Controls.TextDialog("Gradient name?");

            while (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                if (dialog.Response == string.Empty)
                {
                    MessageBox.Show("Please enter a name.");
                    continue;
                }

                if (_colorGradientLibrary.Contains(dialog.Response))
                {
                    DialogResult result = MessageBox.Show("There is already a gradient with that name. Do you want to overwrite it?",
                                                          "Overwrite gradient?", MessageBoxButtons.YesNoCancel);
                    if (result == System.Windows.Forms.DialogResult.Yes)
                    {
                        _colorGradientLibrary.AddColorGradient(dialog.Response, new ColorGradient());
                        _colorGradientLibrary.EditLibraryItem(dialog.Response);
                        Populate_Gradients();
                        break;
                    }
                    else if (result == System.Windows.Forms.DialogResult.Cancel)
                    {
                        break;
                    }
                }
                else
                {
                    _colorGradientLibrary.AddColorGradient(dialog.Response, new ColorGradient());
                    _colorGradientLibrary.EditLibraryItem(dialog.Response);
                    break;
                }
            }
        }
        private void buttonNewColorGradient_Click(object sender, EventArgs e)
        {
            Common.Controls.TextDialog dialog = new Common.Controls.TextDialog("Gradient name?");

            while (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                if (dialog.Response == string.Empty)
                {
                    //messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
                    MessageBoxForm.msgIcon = SystemIcons.Error;
                    var messageBox = new MessageBoxForm("Please enter a name.", "Color Gradient Name", false, false);
                    messageBox.ShowDialog();
                    continue;
                }

                if (Library.Contains(dialog.Response))
                {
                    //messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
                    var messageBox = new MessageBoxForm("There is already a gradient with that name. Do you want to overwrite it?", "Overwrite gradient?", true, true);
                    MessageBoxForm.msgIcon = SystemIcons.Question;
                    messageBox.ShowDialog();
                    if (messageBox.DialogResult == DialogResult.OK)
                    {
                        Library.AddColorGradient(dialog.Response, new ColorGradient());
                        Library.EditLibraryItem(dialog.Response);
                        PopulateListWithColorGradients();
                        break;
                    }
                    else if (messageBox.DialogResult == System.Windows.Forms.DialogResult.Cancel)
                    {
                        break;
                    }
                }
                else
                {
                    Library.AddColorGradient(dialog.Response, new ColorGradient());
                    Library.EditLibraryItem(dialog.Response);
                    PopulateListWithColorGradients();
                    break;
                }
            }
        }
Exemple #19
0
		private void buttonCopyAndOffsetMarks_Click(object sender, EventArgs e)
		{
			if (listViewMarks.SelectedItems.Count < 1)
			{
				//messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
				MessageBoxForm.msgIcon = SystemIcons.Error; //this is used if you want to add a system icon to the message form.
				var messageBox = new MessageBoxForm("Select at least one mark duplicate and offset.", "Select more marks", false, false);
				messageBox.ShowDialog();
				return;
			}

			Common.Controls.TextDialog prompt = new Common.Controls.TextDialog("Start time for copied marks (in seconds):");
			if (prompt.ShowDialog() == DialogResult.OK) {
				TimeSpan offsetTime;

				if (TimeSpan.TryParseExact(prompt.Response, TimeFormats.PositiveFormats, null, out offsetTime)) {
					TimeSpan earliestTime = TimeSpan.MaxValue;
					foreach (ListViewItem item in listViewMarks.SelectedItems) {
						if ((TimeSpan) item.Tag < earliestTime)
							earliestTime = (TimeSpan) item.Tag;
					}

					foreach (ListViewItem item in listViewMarks.SelectedItems) {
						_displayedCollection.Marks.Add((TimeSpan) item.Tag + offsetTime - earliestTime);
					}

					_displayedCollection.Marks.Sort();
					PopulateMarkListFromMarkCollection(_displayedCollection);
					UpdateMarkCollectionInList(_displayedCollection);
				}
				else
				{
					//messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
					MessageBoxForm.msgIcon = SystemIcons.Error; //this is used if you want to add a system icon to the message form.
					var messageBox = new MessageBoxForm("Error parsing time: please use the format '<minutes>:<seconds>.<milliseconds>'", "Error parsing time", false, false);
					messageBox.ShowDialog();
				}
			}
		}
Exemple #20
0
        private void buttonNewCurve_Click(object sender, EventArgs e)
        {
            Common.Controls.TextDialog dialog = new Common.Controls.TextDialog("Curve name?");

            while (dialog.ShowDialog() == DialogResult.OK)
            {
                if (dialog.Response == string.Empty)
                {
                    //messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
                    MessageBoxForm.msgIcon = SystemIcons.Error; //this is used if you want to add a system icon to the message form.
                    var messageBox = new MessageBoxForm("Please enter a name.", "Curve Name", false, false);
                    messageBox.ShowDialog();
                    continue;
                }

                if (Library.Contains(dialog.Response))
                {
                    //messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
                    MessageBoxForm.msgIcon = SystemIcons.Question; //this is used if you want to add a system icon to the message form.
                    var messageBox = new MessageBoxForm("There is already a curve with that name. Do you want to overwrite it?", "Overwrite curve?", true, true);
                    messageBox.ShowDialog();
                    if (messageBox.DialogResult == DialogResult.OK)
                    {
                        Library.AddCurve(dialog.Response, new Curve());
                        Library.EditLibraryCurve(dialog.Response);
                        PopulateListWithCurves();
                        break;
                    }
                    if (messageBox.DialogResult == DialogResult.Cancel)
                    {
                        break;
                    }
                }
                else
                {
                    Library.AddCurve(dialog.Response, new Curve());
                    Library.EditLibraryCurve(dialog.Response);
                    PopulateListWithCurves();
                    break;
                }
            }
        }
Exemple #21
0
        private void toolStripButtonNewCurve_Click(object sender, EventArgs e)
        {
            Common.Controls.TextDialog dialog = new Common.Controls.TextDialog("Curve name?");

            while (dialog.ShowDialog() == DialogResult.OK)
            {
                if (dialog.Response == string.Empty)
                {
                    MessageBox.Show("Please enter a name.");
                    continue;
                }

                if (_curveLibrary.Contains(dialog.Response))
                {
                    DialogResult result = MessageBox.Show("There is already a curve with that name. Do you want to overwrite it?",
                                                          "Overwrite curve?", MessageBoxButtons.YesNoCancel);
                    if (result == DialogResult.Yes)
                    {
                        _curveLibrary.AddCurve(dialog.Response, new Curve());
                        _curveLibrary.EditLibraryCurve(dialog.Response);
                        Populate_Curves();
                        break;
                    }
                    else if (result == DialogResult.Cancel)
                    {
                        break;
                    }
                }
                else
                {
                    _curveLibrary.AddCurve(dialog.Response, new Curve());
                    _curveLibrary.EditLibraryCurve(dialog.Response);
                    break;
                }
            }
        }
        private void renameNodesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (multiSelectTreeviewElementsGroups.SelectedNodes.Count == 0)
                return;
            else if (multiSelectTreeviewElementsGroups.SelectedNodes.Count == 1) {
                ElementNode cn = multiSelectTreeviewElementsGroups.SelectedNode.Tag as ElementNode;
                TextDialog dialog = new TextDialog("Item name?", "Rename item", (cn).Name, true);
                if (dialog.ShowDialog() == DialogResult.OK) {
                    if (dialog.Response != "" && dialog.Response != cn.Name)
                        VixenSystem.Nodes.RenameNode(cn, dialog.Response);
                }
            } else if (multiSelectTreeviewElementsGroups.SelectedNodes.Count > 1) {
                RenameSelectedElements();
            }

            PopulateNodeTree();
            PopulateFormWithNode(_displayedNode, true);
        }
Exemple #23
0
        public bool RenameSelectedElements()
        {
            if (SelectedTreeNodes.Count == 0)
                return false;

            if (SelectedTreeNodes.Count == 1) {
                using (TextDialog dialog = new TextDialog("Item name?", "Rename item", (SelectedNode).Name, true)) {
                    if (dialog.ShowDialog() == DialogResult.OK) {
                        if (dialog.Response != string.Empty && dialog.Response != SelectedNode.Name) {
                            VixenSystem.Nodes.RenameNode(SelectedNode, dialog.Response);
                            PopulateNodeTree();

                            return true;
                        }
                    }
                }
            } else if (SelectedTreeNodes.Count > 1) {
                List<string> oldNames = new List<string>(treeview.SelectedNodes.Select(x => x.Tag as ElementNode).Select(x => x.Name).ToArray());
                NameGenerator renamer = new NameGenerator(oldNames.ToArray());
                if (renamer.ShowDialog() == DialogResult.OK) {
                    for (int i = 0; i < treeview.SelectedNodes.Count; i++) {
                        if (i >= renamer.Names.Count) {
                            Logging.Warn("ConfigElements: bulk renaming elements, and ran out of new names!");
                            break;
                        }
                        VixenSystem.Nodes.RenameNode((treeview.SelectedNodes[i].Tag as ElementNode), renamer.Names[i]);
                    }

                    PopulateNodeTree();

                    return true;
                }
            }

            return false;
        }
        private void modifySequenceLengthToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string oldLength = _sequence.Length.ToString("m\\:ss\\.fff");
            TextDialog prompt = new TextDialog("Enter new sequence length:", "Sequence Length",
                                                                               oldLength, true);

            do
            {
                if (prompt.ShowDialog() != DialogResult.OK)
                    break;

                TimeSpan time;
                bool success = TimeSpan.TryParseExact(prompt.Response, TimeFormats.PositiveFormats, null, out time);
                if (success)
                {
                    SequenceLength = time;
                    sequenceModified();
                    break;
                }
                else
                {
                    MessageBox.Show(@"Error parsing time: please use the format '<minutes>:<seconds>.<milliseconds>'",
                                    @"Error parsing time");
                }
            } while (true);
        }
Exemple #25
0
		private void AddGradientToLibrary(ColorGradient cg, bool edit = true)
		{
			Common.Controls.TextDialog dialog = new Common.Controls.TextDialog("Gradient name?");

			while (dialog.ShowDialog() == DialogResult.OK)
			{
				if (dialog.Response == string.Empty)
				{
					//messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
					MessageBoxForm.msgIcon = SystemIcons.Error; //this is used if you want to add a system icon to the message form.
					var messageBox = new MessageBoxForm("Please enter a name.", "Warning", false, false);
					messageBox.ShowDialog();
					continue;
				}

				if (_colorGradientLibrary.Contains(dialog.Response))
				{
					//messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
					MessageBoxForm.msgIcon = SystemIcons.Warning; //this is used if you want to add a system icon to the message form.
					var messageBox = new MessageBoxForm("There is already a gradient with that name. Do you want to overwrite it?", "Overwrite gradient?", true, true);
					messageBox.ShowDialog();
					if (messageBox.DialogResult == DialogResult.OK)
					{
						_colorGradientLibrary.AddColorGradient(dialog.Response, cg);
						if (edit)
						{
							_colorGradientLibrary.EditLibraryItem(dialog.Response);	
						}
						break;
					}

					if (messageBox.DialogResult == DialogResult.Cancel)
					{
						break;
					}
				}
				else
				{
					_colorGradientLibrary.AddColorGradient(dialog.Response, cg);
					if (edit)
					{
						_colorGradientLibrary.EditLibraryItem(dialog.Response);	
					}
					break;
				}
			}
		}
        private ChannelNode AddSingleNodeWithPrompt(ChannelNode parent = null)
        {
            // since we're only adding a single node, prompt with a single text dialog.
            using (TextDialog textDialog = new TextDialog("Channel Name?")) {
                if (textDialog.ShowDialog() == DialogResult.OK) {
                    string newName;
                    if (textDialog.Response == "")
                        newName = "New Channel";
                    else
                        newName = textDialog.Response;

                    return AddNewNode(newName, true, parent);
                }
            }

            return null;
        }
        private void modifySequenceLengthToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string oldLength = _sequence.Length.ToString("m\\:ss\\.fff");
            TextDialog prompt = new TextDialog("Enter new sequence length:", "Sequence Length",
                                                                               oldLength, true);

            do
            {
                if (prompt.ShowDialog() != DialogResult.OK)
                    break;

                TimeSpan time;
                bool success = TimeSpan.TryParseExact(prompt.Response, TimeFormats.PositiveFormats, null, out time);
                if (success)
                {
                    SequenceLength = time;
                    SequenceModified();
                    break;
                }

                //messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
                MessageBoxForm.msgIcon = SystemIcons.Error; //this is used if you want to add a system icon to the message form.
                var messageBox = new MessageBoxForm("Error parsing time: please use the format '<minutes>:<seconds>.<milliseconds>'",
                    @"Error parsing time", false, false);
                messageBox.ShowDialog();
            } while (true);
        }
Exemple #28
0
        private void toolStripButtonNewGradient_Click(object sender, EventArgs e)
        {
            Common.Controls.TextDialog dialog = new Common.Controls.TextDialog("Gradient name?");

            while (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                if (dialog.Response == string.Empty)
                {
                    MessageBox.Show("Please enter a name.");
                    continue;
                }

                if (_colorGradientLibrary.Contains(dialog.Response))
                {
                    DialogResult result = MessageBox.Show("There is already a gradient with that name. Do you want to overwrite it?",
                                                          "Overwrite gradient?", MessageBoxButtons.YesNoCancel);
                    if (result == System.Windows.Forms.DialogResult.Yes)
                    {
                        _colorGradientLibrary.AddColorGradient(dialog.Response, new ColorGradient());
                        _colorGradientLibrary.EditLibraryItem(dialog.Response);
                        Populate_Gradients();
                        break;
                    }
                    else if (result == System.Windows.Forms.DialogResult.Cancel)
                    {
                        break;
                    }
                }
                else
                {
                    _colorGradientLibrary.AddColorGradient(dialog.Response, new ColorGradient());
                    _colorGradientLibrary.EditLibraryItem(dialog.Response);
                    break;
                }
            }
        }
Exemple #29
0
		private void buttonOffsetMarks_Click(object sender, EventArgs e)
		{
			Common.Controls.TextDialog prompt = new Common.Controls.TextDialog("Time to offset (in seconds):");
			if (prompt.ShowDialog() == DialogResult.OK) {
				TimeSpan time;

				if (TimeSpan.TryParseExact(prompt.Response, TimeFormats.AllFormats, null, out time)) {
					// this is hackey as shit.
					if (prompt.Response.ToCharArray()[0] == '-')
						time = -time;

					List<TimeSpan> newMarks = new List<TimeSpan>();
					foreach (ListViewItem item in listViewMarks.Items) {
						if (item.Selected) {
							newMarks.Add(((TimeSpan) item.Tag) + time);
						}
						else {
							newMarks.Add((TimeSpan) item.Tag);
						}
						newMarks.Sort();
						_displayedCollection.Marks = newMarks;
						PopulateMarkListFromMarkCollection(_displayedCollection);
					}
				}
				else
				{
					//messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
					MessageBoxForm.msgIcon = SystemIcons.Error; //this is used if you want to add a system icon to the message form.
					var messageBox = new MessageBoxForm("Error parsing time: please use the format '<minutes>:<seconds>.<milliseconds>'", "Error parsing time", false, false);
					messageBox.ShowDialog();
				}
			}
		}
Exemple #30
0
        private void renameNodesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (SelectedTreeNodes.Count == 0)
                return;

            if (SelectedTreeNodes.Count == 1) {
                using (TextDialog dialog = new TextDialog("Item name?", "Rename item", (SelectedNode).Name, true)) {
                    if (dialog.ShowDialog() == DialogResult.OK) {
                        if (dialog.Response != string.Empty && dialog.Response != SelectedNode.Name)
                            VixenSystem.Nodes.RenameNode(SelectedNode, dialog.Response);
                    }
                }
            } else if (SelectedTreeNodes.Count > 1) {
                RenameSelectedElements();
            }

            PopulateNodeTree();
            OnElementsChanged();
        }
        private void NewColorCollection()
        {
            Common.Controls.TextDialog dialog = new Common.Controls.TextDialog("Collecton Name?");
            while (dialog.ShowDialog() == DialogResult.OK)
            {
                if (dialog.Response == string.Empty)
                {
                    //messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
                    MessageBoxForm.msgIcon = SystemIcons.Error; //this is used if you want to add a system icon to the message form.
                    var messageBox = new MessageBoxForm("Please enter a name.", "Color Collection Name", false, false);
                    messageBox.ShowDialog();
                    continue;
                }
                ColorCollection item = new ColorCollection {Name = dialog.Response};
                if (ColorCollections.Contains(item))
                {
                    //messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
                    MessageBoxForm.msgIcon = SystemIcons.Warning; //this is used if you want to add a system icon to the message form.
                    var messageBox = new MessageBoxForm("A collection with the name " + item.Name + @" already exists. Do you want to overwrite it?", "Overwrite collection?", true, true);
                    messageBox.ShowDialog();
                    if (messageBox.DialogResult == DialogResult.OK)
                    {
                        ColorCollections.Remove(item);
                        ColorCollections.Add(item);
                        _isDirty = true;
                        PopulateCollectionList();
                        comboBoxCollections.Text = item.Name;
                    }

                    break;

                }

                ColorCollections.Add(item);
                _isDirty = true;
                PopulateCollectionList();
                comboBoxCollections.Text = item.Name;
                break;

            }
        }
Exemple #32
0
		private void buttonGenerateBeatMarks_Click(object sender, EventArgs e)
		{
			//messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
			MessageBoxForm.msgIcon = SystemIcons.Question; //this is used if you want to add a system icon to the message form.
			var messageBox = new MessageBoxForm("This operation will determine the average beat from the selected marks, and apply them for the rest of the song. Do you want to continue?", "Information", true, false);
			if (messageBox.ShowDialog() == DialogResult.No)
				return;

			if (listViewMarks.SelectedItems.Count < 2)
			{
				//messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
				MessageBoxForm.msgIcon = SystemIcons.Error; //this is used if you want to add a system icon to the message form.
				messageBox = new MessageBoxForm("Select at least two marks to be able to determine an average time interval.", "Select more marks", false, false);
				messageBox.ShowDialog();
				return;
			}

			Common.Controls.TextDialog prompt =
				new Common.Controls.TextDialog(
					"How long should the beats be generated for, in seconds? Leave blank to go to the end.");
			// the default prompt isn't enough to hold all the above text. Oops.
			prompt.Size = new Size(550, prompt.Size.Height);
			if (prompt.ShowDialog() == DialogResult.OK) {
				TimeSpan duration;
				bool conversionSuccess = TimeSpan.TryParseExact(prompt.Response, TimeFormats.PositiveFormats, null, out duration);
				if (!conversionSuccess && prompt.Response.Length == 0) {
					conversionSuccess = true;
					duration = TimeSpan.MaxValue;
				}

				if (conversionSuccess) {
					TimeSpan earlistMark = TimeSpan.MaxValue;
					TimeSpan latestMark = TimeSpan.MinValue;

					foreach (ListViewItem item in listViewMarks.SelectedItems) {
						if ((TimeSpan) item.Tag < earlistMark) {
							earlistMark = (TimeSpan) item.Tag;
						}
						if ((TimeSpan) item.Tag > latestMark) {
							latestMark = (TimeSpan) item.Tag;
						}
					}

					int sourcesCount = listViewMarks.SelectedItems.Count;
					TimeSpan interval = TimeSpan.FromTicks((latestMark - earlistMark).Ticks/(sourcesCount - 1));
					double bpm = 60/interval.TotalSeconds;

					TimeSpan maxPossibleDuration = _timedSequenceEditorForm.Sequence.Length - latestMark;
					if (duration > maxPossibleDuration)
						duration = maxPossibleDuration;

					int generatedMarks = (int) (duration.Ticks/interval.Ticks) - 1;

					//messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
					MessageBoxForm.msgIcon = SystemIcons.Question; //this is used if you want to add a system icon to the message form.
					messageBox = new MessageBoxForm(string.Format("From the selected marks, a beat interval of {0:%s\\.ff} seconds was detected ({1:0.00} bpm). This will generate {2} marks. Do you want to continue?", interval,
										 bpm, generatedMarks), "Confirmation", true, false);
					if (messageBox.ShowDialog() == DialogResult.No)
						return;

					TimeSpan currentTime = latestMark + interval;
					TimeSpan endTime = latestMark + duration;
					while (currentTime <= endTime) {
						_displayedCollection.Marks.Add(currentTime);
						currentTime += interval;
					}

					_displayedCollection.Marks.Sort();
					PopulateMarkListFromMarkCollection(_displayedCollection);
					UpdateMarkCollectionInList(_displayedCollection);
				}
				else
				{
					//messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
					MessageBoxForm.msgIcon = SystemIcons.Error; //this is used if you want to add a system icon to the message form.
					messageBox = new MessageBoxForm("Error parsing time: please use the format '<minutes>:<seconds>.<milliseconds>', or leave empty", "Error parsing time", false, false);
					messageBox.ShowDialog();
				}
			}
		}
Exemple #33
0
		public bool RenameControllerWithPrompt(IControllerDevice outputController)
		{
			using (TextDialog textDialog = new TextDialog("Controller Name?", "Controller Name", outputController.Name, true)) {
				if (textDialog.ShowDialog() == DialogResult.OK) {
					if (textDialog.Response != string.Empty) {
						outputController.Name = textDialog.Response;
						OnControllersChanged();
						PopulateControllerTree();
						return true;
					}
				}
			}
			return false;
		}
Exemple #34
0
		private void buttonGenerateGrid_Click(object sender, EventArgs e)
		{
			Common.Controls.TextDialog prompt =
				new Common.Controls.TextDialog("How often (in seconds) should the marks be generated?", "Mark Period", "0:00.050");
			if (prompt.ShowDialog() == DialogResult.OK) {
				TimeSpan interval;
				bool conversionSuccess = TimeSpan.TryParseExact(prompt.Response, TimeFormats.PositiveFormats, null, out interval);
				if (conversionSuccess) {
					TimeSpan currentTime = interval;
					TimeSpan endTime = _timedSequenceEditorForm.Sequence.Length;
					while (currentTime <= endTime) {
						_displayedCollection.Marks.Add(currentTime);
						currentTime += interval;
					}

					if (_displayedCollection.Level < 8) {
						_displayedCollection.Level = 8;
					}

					_displayedCollection.Marks.Sort();
					PopulateMarkListFromMarkCollection(_displayedCollection);
					UpdateMarkCollectionInList(_displayedCollection);
				}
				else
				{
					//messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
					MessageBoxForm.msgIcon = SystemIcons.Error; //this is used if you want to add a system icon to the message form.
					var messageBox = new MessageBoxForm("Error parsing time: please use the format '<minutes>:<seconds>.<milliseconds>'", "Error parsing time", false, false);
					messageBox.ShowDialog();
				}
			}
		}
Exemple #35
0
		private void AddCurveToLibrary(Curve c, bool edit=true)
		{
			Common.Controls.TextDialog dialog = new Common.Controls.TextDialog("Curve name?");

			while (dialog.ShowDialog() == DialogResult.OK)
			{
				if (dialog.Response == string.Empty)
				{
					//messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
					var messageBox = new MessageBoxForm("Please enter a name.", "Curve Name", false, false);
					messageBox.ShowDialog();
					continue;
				}

				if (_curveLibrary.Contains(dialog.Response))
				{
					//messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
					MessageBoxForm.msgIcon = SystemIcons.Question; //this is used if you want to add a system icon to the message form.
					var messageBox = new MessageBoxForm("There is already a curve with that name. Do you want to overwrite it?", "Overwrite curve?", true, true);
					messageBox.ShowDialog();
					if (messageBox.DialogResult == DialogResult.OK)
					{
						_curveLibrary.AddCurve(dialog.Response, c);
						if (edit)
						{
							_curveLibrary.EditLibraryCurve(dialog.Response);	
						}
						break;
					}

					if (messageBox.DialogResult == DialogResult.Cancel)
					{
						break;
					}
				}
				else
				{
					_curveLibrary.AddCurve(dialog.Response, c);
					if (edit)
					{
						_curveLibrary.EditLibraryCurve(dialog.Response);	
					}
					
					break;
				}
			}
		}
Exemple #36
0
        public ElementNode AddSingleNodeWithPrompt(ElementNode parent = null)
        {
            // since we're only adding a single node, prompt with a single text dialog.
            using (TextDialog textDialog = new TextDialog("Element Name?")) {
                if (textDialog.ShowDialog() == DialogResult.OK) {
                    string newName;
                    if (textDialog.Response == string.Empty)
                        newName = "New Element";
                    else
                        newName = textDialog.Response;

                    ElementNode en = AddNewNode(newName, true, parent);
                    return en;
                }
            }

            return null;
        }
Exemple #37
0
		private void buttonGenerateSubmarks_Click(object sender, EventArgs e)
		{
			if (listViewMarks.SelectedItems.Count < 2)
			{
				//messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
				MessageBoxForm.msgIcon = SystemIcons.Error; //this is used if you want to add a system icon to the message form.
				var messageBox = new MessageBoxForm("Select at least two marks to generate times between.", "Select more marks", false, false);
				messageBox.ShowDialog();
				return;
			}

			Common.Controls.TextDialog prompt =
				new Common.Controls.TextDialog("Break each interval into how many equal segments?");
			if (prompt.ShowDialog() == DialogResult.OK) {
				int divisions;
				if (int.TryParse(prompt.Response, out divisions))
				{
					//messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
					MessageBoxForm.msgIcon = SystemIcons.Question; //this is used if you want to add a system icon to the message form.
					var messageBox = new MessageBoxForm("Do you want to put the new marks into a different collection?", "Add to new collection?", true, true);
					messageBox.ShowDialog();
					if (messageBox.DialogResult == DialogResult.Cancel)
					{
						return;
					}

					List<TimeSpan> sourceTimes = new List<TimeSpan>();
					foreach (ListViewItem item in listViewMarks.SelectedItems) {
						sourceTimes.Add((TimeSpan) item.Tag);
					}
					sourceTimes.Sort();

					List<TimeSpan> newTimes = new List<TimeSpan>();
					for (int i = 1; i < sourceTimes.Count; i++) {
						TimeSpan interval = TimeSpan.FromTicks((sourceTimes[i] - sourceTimes[i - 1]).Ticks/divisions);
						for (int j = 0; j < divisions; j++) {
							newTimes.Add(sourceTimes[i - 1] + TimeSpan.FromTicks(interval.Ticks*j));
						}
					}
					newTimes.Add(sourceTimes.Last());

					MarkCollection destination = _displayedCollection;

					if (messageBox.DialogResult == DialogResult.OK)
					{
						List<KeyValuePair<string, object>> options = new List<KeyValuePair<string, object>>();
						foreach (MarkCollection mc in MarkCollections)
						{
							options.Add(new KeyValuePair<string, object>(mc.Name, mc));
						}
						ListSelectDialog selector = new ListSelectDialog("Destination Mark Collection?", options);
						if (selector.ShowDialog() == DialogResult.OK)
						{
							destination = selector.SelectedItem as MarkCollection;
						}
					}
					foreach (TimeSpan time in newTimes) {
						if (!destination.Marks.Contains(time))
							destination.Marks.Add(time);
					}

					destination.Marks.Sort();

					if (destination == _displayedCollection) {
						PopulateMarkListFromMarkCollection(_displayedCollection);
					}
					UpdateMarkCollectionInList(destination);
				}
				else
				{
					//messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
					MessageBoxForm.msgIcon = SystemIcons.Error; //this is used if you want to add a system icon to the message form.
					var messageBox = new MessageBoxForm("Error parsing number: please enter a whole number for the number of divisions.", "Error parsing number", false, false);
					messageBox.ShowDialog();
				}
			}
		}
 private void buttonNewCollection_Click(object sender, EventArgs e)
 {
     Common.Controls.TextDialog dialog = new Common.Controls.TextDialog("Collecton Name?");
     while (dialog.ShowDialog() == DialogResult.OK)
     {
         if (dialog.Response == string.Empty)
         {
             MessageBox.Show("Please enter a name.");
             continue;
         }
         ColorCollection item = new ColorCollection();
         item.Name = dialog.Response;
         if (ColorCollections.Contains(item))
         {
             DialogResult result = MessageBox.Show("There is already a collection with the name " + item.Name + ". Do you want to overwrite it?",
                                                   "Overwrite collection?", MessageBoxButtons.YesNoCancel);
             if (result == DialogResult.Yes)
             {
                 ColorCollections.Remove(item);
                 ColorCollections.Add(item);
                 isDirty = true;
                 PopulateCollectionList();
                 comboBoxCollections.Text = item.Name;
                 break;
             }
             else if (result == DialogResult.Cancel)
             {
                 break;
             }
         }
         else
         {
             ColorCollections.Add(item);
             isDirty = true;
             PopulateCollectionList();
             comboBoxCollections.Text = item.Name;
             break;
         }
     }
 }