Example #1
0
        private void buttonOK_Click(object sender, EventArgs e)
        {
            XMLProfileSettings profile = new XMLProfileSettings();
            SaveCurrentItem();
            profile.PutSetting("Profiles/ProfileCount", comboBoxProfiles.Items.Count);
            for (int i = 0; i < comboBoxProfiles.Items.Count; i++) {
                ProfileItem item = comboBoxProfiles.Items[i] as ProfileItem;
                profile.PutSetting("Profiles/" + "Profile" + i.ToString() + "/Name", item.Name);
                profile.PutSetting("Profiles/" + "Profile" + i.ToString() + "/DataFolder", item.DataFolder);
            }

            if (radioButtonAskMe.Checked)
                profile.PutSetting("Profiles/LoadAction", "Ask");
            else
                profile.PutSetting("Profiles/LoadAction", "LoadSelected");

            if (comboBoxLoadThisProfile.SelectedIndex >= 0)
                profile.PutSetting("Profiles/ProfileToLoad", comboBoxLoadThisProfile.SelectedIndex);

            DialogResult = System.Windows.Forms.DialogResult.OK;

            Close();
        }
Example #2
0
        void IEditorUserInterface.EditorClosing()
        {
            dockPanel.SaveAsXml(settingsPath);
            MarksForm.Close();
            EffectsForm.Close();

            var xml = new XMLProfileSettings();
            xml.PutSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/DockLeftPortion", Name), (int)dockPanel.DockLeftPortion);
            xml.PutSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/DockRightPortion", Name), (int)dockPanel.DockLeftPortion);
            xml.PutSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/AutoSaveEnabled", Name), autoSaveToolStripMenuItem.Checked);
            xml.PutSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/DrawModeSelected", Name), toolStripButton_DrawMode.Checked);
            xml.PutSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/SelectionModeSelected", Name), toolStripButton_SelectionMode.Checked);
            xml.PutSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/SnapToSelected", Name), toolStripButton_SnapTo.Checked);
            xml.PutSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/WindowHeight", Name), Size.Height);
            xml.PutSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/WindowWidth", Name), Size.Width);
            xml.PutSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/WindowLocationX", Name), Location.X);
            xml.PutSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/WindowLocationY", Name), Location.Y);
            xml.PutSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/WindowState", Name), WindowState.ToString());
            xml.PutSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/SnapStrength", Name), TimelineControl.grid.SnapStrength);
            xml.PutSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/ResizeIndicatorEnabled", Name), TimelineControl.grid.ResizeIndicator_Enabled);
            xml.PutSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/CadStyleSelectionBox", Name), cADStyleSelectionBoxToolStripMenuItem.Checked);
            xml.PutSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/ResizeIndicatorColor", Name), TimelineControl.grid.ResizeIndicator_Color);
            xml.PutSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/ToolPaletteLinkCurves", Name), ToolsForm.LinkCurves);
            xml.PutSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/ToolPaletteLinkGradients", Name), ToolsForm.LinkGradients);

            ToolsForm.Close();

            //These are only saved in options
            //xml.PutPreference(string.Format("{0}/AutoSaveInterval", Name), _autoSaveTimer.Interval);

            //Clean up any old locations from before we organized the settings.
            xml.RemoveNode("StandardNudge");
            xml.RemoveNode("SuperNudge");
            xml.RemoveNode(Name);
        }
        void IEditorUserInterface.EditorClosing()
        {
            if (WindowState == FormWindowState.Minimized)
            {
                //Don't close with a minimized window.
                WindowState = FormWindowState.Normal;
            }

            dockPanel.SaveAsXml(_settingsPath);
            MarksForm.Close();
            EffectsForm.Close();
            LayerEditor.Close();

            var xml = new XMLProfileSettings();
            xml.PutSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/DockLeftPortion", Name), (int)dockPanel.DockLeftPortion);
            xml.PutSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/DockRightPortion", Name), (int)dockPanel.DockRightPortion);
            xml.PutSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/AutoSaveEnabled", Name), autoSaveToolStripMenuItem.Checked);
            xml.PutSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/DrawModeSelected", Name), toolStripButton_DrawMode.Checked);
            xml.PutSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/SelectionModeSelected", Name), toolStripButton_SelectionMode.Checked);
            xml.PutSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/SnapToSelected", Name), toolStripButton_SnapTo.Checked);
            xml.PutSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/WindowHeight", Name), Size.Height);
            xml.PutSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/WindowWidth", Name), Size.Width);
            xml.PutSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/WindowLocationX", Name), Location.X);
            xml.PutSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/WindowLocationY", Name), Location.Y);
            xml.PutSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/WindowState", Name), WindowState.ToString());
            xml.PutSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/SnapStrength", Name), TimelineControl.grid.SnapStrength);
            xml.PutSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/CloseGapThreshold", Name), TimelineControl.grid.CloseGap_Threshold);
            xml.PutSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/AlignToThreshold", Name), AlignTo_Threshold);
            xml.PutSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/ResizeIndicatorEnabled", Name), TimelineControl.grid.ResizeIndicator_Enabled);
            xml.PutSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/CadStyleSelectionBox", Name), cADStyleSelectionBoxToolStripMenuItem.Checked);
            xml.PutSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/ResizeIndicatorColor", Name), TimelineControl.grid.ResizeIndicator_Color);
            xml.PutSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/ToolPaletteLinkCurves", Name), ToolsForm.LinkCurves);
            xml.PutSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/ToolPaletteLinkGradients", Name), ToolsForm.LinkGradients);
            xml.PutSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/ZoomUnderMousePosition", Name), zoomUnderMousePositionToolStripMenuItem.Checked);
            xml.PutSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/WaveFormHeight", Name), TimelineControl.waveform.Height);
            xml.PutSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/RulerHeight", Name), TimelineControl.ruler.Height);

            //This .Close is here because we need to save some of the settings from the form before it is closed.
            ToolsForm.Close();

            //These are only saved in options
            //xml.PutPreference(string.Format("{0}/AutoSaveInterval", Name), _autoSaveTimer.Interval);

            //Clean up any old locations from before we organized the settings.
            xml.RemoveNode("StandardNudge");
            xml.RemoveNode("SuperNudge");
            xml.RemoveNode(Name);
        }
Example #4
0
 private void SaveWindowState()
 {
     XMLProfileSettings xml = new XMLProfileSettings();
     xml.PutSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/WindowHeight", Name), Size.Height);
     xml.PutSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/WindowWidth", Name), Size.Width);
     xml.PutSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/WindowLocationX", Name), Location.X);
     xml.PutSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/WindowLocationY", Name), Location.Y);
     xml.PutSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/WindowState", Name),
         WindowState.ToString());
 }
Example #5
0
        private void buttonOK_Click(object sender, EventArgs e)
        {
            XMLProfileSettings profile = new XMLProfileSettings();
            List<string> checkName = new List<string>();
            List<string> checkDataFolder = new List<string>();
            List<string> duplicateItems = new List<string>();
            List<string> checkDataPath = new List<string>();
            bool duplicateName = false;
            bool duplicateDataFolder = false;
            bool invalidDataPath = false;

            //Check for null values, duplicate profile name or datapath and non rooted datapath
            foreach (ProfileItem item in comboBoxProfiles.Items)
            {
                if (item.Name == null || item.DataFolder == null)
                {
                    //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("One or more of your profile entries has a blank name or data folder. You must correct this before continuing.",
                        @"Warning - Blank Entries", false, false);
                    messageBox.ShowDialog();
                }

                if (checkName.Contains(item.Name))
                {
                    duplicateName = true;
                    duplicateItems.Add(item.Name + ":\t " + item.DataFolder);
                }
                checkName.Add(item.Name);

                if (checkDataFolder.Contains(item.DataFolder))
                {
                    duplicateDataFolder = true;
                    duplicateItems.Add(item.Name + ":\t " + item.DataFolder);
                }

                checkDataFolder.Add(item.DataFolder);

                if (!Path.IsPathRooted(item.DataFolder) || !item.DataFolder.Contains(@"\"))
                {
                    invalidDataPath = true;
                    checkDataPath.Add(item.Name + ":\t " + item.DataFolder);
                }
            }

            if (duplicateName || duplicateDataFolder)
            {
                //Not pretty here, but works well on the dialog
                //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 duplicate profile name, or data path exists." + Environment.NewLine + Environment.NewLine +
                        @"The duplicate items found were:" + Environment.NewLine + Environment.NewLine + string.Join(Environment.NewLine, duplicateItems) + Environment.NewLine + Environment.NewLine +
                        @"Click OK to accept and contine, or Cancel to go back and edit.",
                        @"Warning - Duplicate Entries", false, true);
                messageBox.ShowDialog();

                if (messageBox.DialogResult != DialogResult.OK)
                {
                    DialogResult = DialogResult.None;
                    return;
                }
            }

            if (invalidDataPath)
            {
                //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("An invalid profile data folder exists." + Environment.NewLine + Environment.NewLine +
                    @"The items with invalid paths were:" + Environment.NewLine + Environment.NewLine + string.Join(Environment.NewLine, checkDataPath) + Environment.NewLine + Environment.NewLine +
                    @"Click OK to accept and contine, or Cancel to go back and edit.",
                    @"Warning - Invalid Data Path", false, true);
                messageBox.ShowDialog();

                if (messageBox.DialogResult != DialogResult.OK)
                {
                    DialogResult = DialogResult.None;
                    return;
                }
            }

            SaveCurrentItem();
            profile.PutSetting(XMLProfileSettings.SettingType.Profiles, "ProfileCount", comboBoxProfiles.Items.Count);
            for (int i = 0; i < comboBoxProfiles.Items.Count; i++) {
                ProfileItem item = comboBoxProfiles.Items[i] as ProfileItem;
                profile.PutSetting(XMLProfileSettings.SettingType.Profiles, "Profile" + i + "/Name", item.Name);
                profile.PutSetting(XMLProfileSettings.SettingType.Profiles, "Profile" + i + "/DataFolder", item.DataFolder);
                if (!Directory.Exists(item.DataFolder))
                {
                    //messageBox Arguments are (Text, Title, No Button Visible, Cancel Button Visible)
                    MessageBoxForm.msgIcon = SystemIcons.Exclamation; //this is used if you want to add a system icon to the message form.
                    var messageBox = new MessageBoxForm("The data directory '" + item.DataFolder + "' for profile '" + item.Name + "' does not exist.  Would you like to create it?",
                        Application.ProductName, true, false);
                    messageBox.ShowDialog();
                    if (messageBox.DialogResult == DialogResult.OK)
                    {
                        try
                        {
                            Directory.CreateDirectory(item.DataFolder);
                        }
                        catch (Exception)
                        {
                            //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("Could not create new profile directory: " + item.DataFolder + Environment.NewLine + Environment.NewLine +
                                "Click OK to ignore and continue, or Cancel to go back and edit.",
                                "Error", false, true);
                            messageBox.ShowDialog();
                            if (messageBox.DialogResult == DialogResult.Cancel)
                            {
                                DialogResult = DialogResult.None;
                                return;
                            }
                        }
                    }
                }
            }

            profile.PutSetting(XMLProfileSettings.SettingType.Profiles, "LoadAction",
                radioButtonAskMe.Checked ? "Ask" : "LoadSelected");

            if (comboBoxLoadThisProfile.SelectedIndex >= 0)
                profile.PutSetting(XMLProfileSettings.SettingType.Profiles, "ProfileToLoad", comboBoxLoadThisProfile.SelectedIndex);

            DialogResult = DialogResult.OK;
            Close();
        }
Example #6
0
 private void Form_Marks_Closing(object sender, FormClosingEventArgs e)
 {
     var xml = new XMLProfileSettings();
     xml.PutSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/StandardNudge", Name), Convert.ToInt32(numericUpDownStandardNudge.Value));
     xml.PutSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/SuperNudge", Name), Convert.ToInt32(numericUpDownSuperNudge.Value));
 }
 void IEditorUserInterface.EditorClosing()
 {
     dockPanel.SaveAsXml(settingsPath);
     XMLProfileSettings xml = new XMLProfileSettings();
     xml.PutSetting(string.Format("{0}/DockLeftPortion",this.Name),(int)dockPanel.DockLeftPortion);
     xml.PutSetting(string.Format("{0}/DockRihtPortion", this.Name), (int)dockPanel.DockLeftPortion);
     xml = null;
 }
Example #8
0
        private void buttonOK_Click(object sender, EventArgs e)
        {
            XMLProfileSettings profile = new XMLProfileSettings();
            List<string> checkName = new List<string>();
            List<string> checkDataFolder = new List<string>();
            List<string> duplicateItems = new List<string>();
            List<string> checkDataPath = new List<string>();
            bool duplicateName = false;
            bool duplicateDataFolder = false;
            bool invalidDataPath = false;

            //Check for null values, duplicate profile name or datapath and non rooted datapath
            foreach (ProfileItem item in comboBoxProfiles.Items)
            {
                if (item.Name == null || item.DataFolder == null)
                {
                    MessageBox.Show(
                        @"One or more of your profile entries has a blank name or data folder. You must correct this before continuing.",
                        @"Warning - Blank Entries", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }

                if (checkName.Contains(item.Name))
                {
                    duplicateName = true;
                    duplicateItems.Add(item.Name + ":\t " + item.DataFolder);
                }
                checkName.Add(item.Name);

                if (checkDataFolder.Contains(item.DataFolder))
                {
                    duplicateDataFolder = true;
                    duplicateItems.Add(item.Name + ":\t " + item.DataFolder);
                }

                checkDataFolder.Add(item.DataFolder);

                if (!Path.IsPathRooted(item.DataFolder) || !item.DataFolder.Contains(@"\"))
                {
                    invalidDataPath = true;
                    checkDataPath.Add(item.Name + ":\t " + item.DataFolder);
                }
            }

            if (duplicateName || duplicateDataFolder)
            {
                //Not pretty here, but works well on the dialog
                var result =
                    MessageBox.Show(
                        @"A duplicate profile name, or data path exists." + Environment.NewLine + Environment.NewLine +
                        @"The duplicate items found were:" + Environment.NewLine + Environment.NewLine + string.Join(Environment.NewLine,duplicateItems) + Environment.NewLine + Environment.NewLine +
                        @"Click OK to accept and contine, or Cancel to go back and edit.",
                        @"Warning - Duplicate Entries", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);

                if (result != DialogResult.OK)
                {
                    DialogResult = DialogResult.None;
                    return;
                }
            }

            if (invalidDataPath)
            {
                var result =
                MessageBox.Show(
                    @"An invalid profile data folder exists." + Environment.NewLine + Environment.NewLine +
                    @"The items with invalid paths were:" + Environment.NewLine + Environment.NewLine + string.Join(Environment.NewLine, checkDataPath) + Environment.NewLine + Environment.NewLine +
                    @"Click OK to accept and contine, or Cancel to go back and edit.",
                    @"Warning - Invalid Data Path", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);

                if (result != DialogResult.OK)
                {
                    DialogResult = DialogResult.None;
                    return;
                }
            }

            SaveCurrentItem();
            profile.PutSetting(XMLProfileSettings.SettingType.Profiles, "ProfileCount", comboBoxProfiles.Items.Count);
            for (int i = 0; i < comboBoxProfiles.Items.Count; i++) {
                ProfileItem item = comboBoxProfiles.Items[i] as ProfileItem;
                profile.PutSetting(XMLProfileSettings.SettingType.Profiles, "Profile" + i + "/Name", item.Name);
                profile.PutSetting(XMLProfileSettings.SettingType.Profiles, "Profile" + i + "/DataFolder", item.DataFolder);
                //We're getting out of here and expect a restart by user, if the specified DataFolder doesn't exist, we should create it.

                if (item.DataFolder != string.Empty)
                {
                    if (!Directory.Exists(item.DataFolder))
                        Directory.CreateDirectory(item.DataFolder);
                }
            }

            profile.PutSetting(XMLProfileSettings.SettingType.Profiles, "LoadAction",
                radioButtonAskMe.Checked ? "Ask" : "LoadSelected");

            if (comboBoxLoadThisProfile.SelectedIndex >= 0)
                profile.PutSetting(XMLProfileSettings.SettingType.Profiles, "ProfileToLoad", comboBoxLoadThisProfile.SelectedIndex);

            DialogResult = DialogResult.OK;
            Close();
        }