Example #1
0
        /// <summary>
        /// Saves column values to config file.
        /// </summary>
        /// <param name="path"></param>
        /// <param name="toolbar"></param>
        public void SaveColumn(string path, ColumnSetting column)
        {
            XmlTextReader reader = new XmlTextReader(_fileName);
            XmlDocument   doc    = new XmlDocument();

            doc.Load(reader);
            reader.Close();

            XmlNode    oldForm;
            XmlElement root = doc.DocumentElement;

            oldForm = root.SelectSingleNode(path);
            XmlNode parentNode = oldForm.ParentNode;

            XmlElement newForm = doc.CreateElement("column");

            newForm.SetAttribute("name", column.Name);

            newForm.InnerXml = "<DisplayIndex>" + column.DisplayIndex + "</DisplayIndex>" +
                               "<Width>" + column.Width + "</Width>";

            // If existing element was not found, append setting as new element
            if (oldForm != null)
            {
                parentNode.ReplaceChild(newForm, oldForm);
            }
            else
            {
                parentNode.AppendChild(newForm);
            }
            doc.Save(_fileName);
        }
Example #2
0
        /// <summary>
        /// Setting displayIndex value info.
        /// </summary>
        /// <param name="component"></param>
        /// <param name="iterator"></param>
        public static void SetColumnValues(ColumnSetting component,
                                           XPathNodeIterator iterator)
        {
            int displayIndex = 0;
            int width        = 0;

            while (iterator.MoveNext())
            {
                XPathNavigator navigator = iterator.Current.Clone();

                switch (navigator.Name)
                {
                case "DisplayIndex":
                    try
                    {
                        displayIndex = Convert.ToInt32(navigator.Value);
                    }
                    catch (Exception)
                    {
                        displayIndex = 0;
                    }
                    break;

                case "Width":
                    try
                    {
                        width = Convert.ToInt32(navigator.Value);
                    }
                    catch (Exception)
                    {
                        width = 0;
                    }
                    break;

                default:
                    break;
                }
            }

            component.SetValues(displayIndex, width);
        }
Example #3
0
        /// <summary>
        /// Saves column values to config file.
        /// </summary>
        /// <param name="path"></param>
        /// <param name="toolbar"></param>
        public void SaveColumn(string path, ColumnSetting column)
        {
            XmlTextReader reader = new XmlTextReader(_fileName);
            XmlDocument doc = new XmlDocument();
            doc.Load(reader);
            reader.Close();

            XmlNode oldForm;
            XmlElement root = doc.DocumentElement;
            oldForm = root.SelectSingleNode(path);
            XmlNode parentNode = oldForm.ParentNode;

            XmlElement newForm = doc.CreateElement("column");
            newForm.SetAttribute("name", column.Name);

            newForm.InnerXml = "<DisplayIndex>" + column.DisplayIndex + "</DisplayIndex>" +
                               "<Width>" + column.Width + "</Width>";

            // If existing element was not found, append setting as new element
            if (oldForm != null)
            {
                parentNode.ReplaceChild(newForm, oldForm);
            }
            else
            {
                parentNode.AppendChild(newForm);
            }
            doc.Save(_fileName);
        }
Example #4
0
        /// <summary>
        /// Setting displayIndex value info.
        /// </summary>
        /// <param name="component"></param>
        /// <param name="iterator"></param>
        public static void SetColumnValues(ColumnSetting component,
                XPathNodeIterator iterator)
        {
            int displayIndex = 0;
            int width = 0;

            while (iterator.MoveNext())
            {
                XPathNavigator navigator = iterator.Current.Clone();

                switch (navigator.Name)
                {
                    case "DisplayIndex":
                        try
                        {
                            displayIndex = Convert.ToInt32(navigator.Value);
                        }
                        catch(Exception)
                        {
                            displayIndex = 0;
                        }
                        break;
                    case "Width":
                        try
                        {
                            width = Convert.ToInt32(navigator.Value);
                        }
                        catch(Exception)
                        {
                            width = 0;
                        }
                        break;
                    default:
                        break;
                 }
            }

            component.SetValues(displayIndex, width);
        }
Example #5
0
        /// <summary>
        /// Called when MainForm is starting.
        /// Setting positions for MainForm and Toolbars.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MainFormLoad(object sender, EventArgs e)
        {
            // Setting MainForm starting values
            FormSetting mainFormSetting = new FormSetting(_handler);
            mainFormSetting.GetSetting("MainForm");

            if (mainFormSetting.X == -1 || mainFormSetting.Y == -1)
                StartPosition = FormStartPosition.CenterScreen;
            else
                Location = new Point(mainFormSetting.X, mainFormSetting.Y);

            Width = mainFormSetting.Width;
            Height = mainFormSetting.Height;

            // Setting toolStripFile starting values
            ToolbarSetting settingToolStripFile = new ToolbarSetting(_handler);
            settingToolStripFile.GetSetting("toolStripFile");

            if (settingToolStripFile.X == -1 || settingToolStripFile.Y == -1)
                toolStripFile.Location = new Point(3, 24);
            else
                toolStripFile.Location = new Point(settingToolStripFile.X, settingToolStripFile.Y);
            toolStripFile.Visible = settingToolStripFile.Visible;

            mainMenuViewToolbarsFile.Checked  = toolStripFile.Visible;
            contextMenuFile.Checked  = toolStripFile.Visible;

            // Setting toolStripSums starting values
            ToolbarSetting settingToolStripSums = new ToolbarSetting(_handler);
            settingToolStripSums.GetSetting("toolStripSums");

            if (settingToolStripSums.X == -1 || settingToolStripSums.Y == -1)
                toolStripSums.Location = new Point(3, 49);
            else
                toolStripSums.Location = new Point(settingToolStripSums.X, settingToolStripSums.Y);
            toolStripSums.Visible = settingToolStripSums.Visible;

            mainMenuViewToolbarsSums.Checked  = toolStripSums.Visible;
            contextMenuSums.Checked  = toolStripSums.Visible;

            // Setting statusStrip1 starting values
            StatusbarSetting settingStatusStrip1 = new StatusbarSetting(_handler);
            settingStatusStrip1.GetSetting("statusStrip1");

            statusStrip1.Visible = settingStatusStrip1.Visible;
            mainMenuViewStatusBar.Checked  = statusStrip1.Visible;

            // Setting columnSize starting values
            ColumnSetting settingColumnSize = new ColumnSetting(_handler);
            settingColumnSize.GetSetting("columnSize");

            columnSize.DisplayIndex = settingColumnSize.DisplayIndex;
            columnSize.Width = settingColumnSize.Width;

            // Setting columnFullpath starting values
            ColumnSetting settingColumnFullpath = new ColumnSetting(_handler);
            settingColumnFullpath.GetSetting("columnFullpath");

            columnFullpath.DisplayIndex = settingColumnFullpath.DisplayIndex;
            columnFullpath.Width = settingColumnFullpath.Width;

            //Setting columnVerified starting values
            ColumnSetting settingColumnVerified = new ColumnSetting(_handler);
            settingColumnVerified.GetSetting("columnVerified");

            columnVerified.DisplayIndex = settingColumnVerified.DisplayIndex;
            columnVerified.Width = settingColumnVerified.Width;

            // Setting columnType starting values
            ColumnSetting settingColumnType = new ColumnSetting(_handler);
            settingColumnType.GetSetting("columnType");

            columnType.DisplayIndex = settingColumnType.DisplayIndex;
            columnType.Width = settingColumnType.Width;

            // Setting columnFilename starting values
            ColumnSetting settingColumnFilename = new ColumnSetting(_handler);
            settingColumnFilename.GetSetting("columnFilename");

            columnFilename.DisplayIndex = settingColumnFilename.DisplayIndex;
            columnFilename.Width = settingColumnFilename.Width;

            UpdateViewMenuItems();
        }
Example #6
0
        /// <summary>
        /// Called when MainForm is closing.
        /// Setting positio and visible values in user settings.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MainFormFormClosing(object sender, FormClosingEventArgs e)
        {
            // Setting MainForm ending values
            FormSetting mainFormSetting = new FormSetting(_handler);
            mainFormSetting.SaveSetting("MainForm",
                                        this.Location.X,
                                        this.Location.Y,
                                        this.Width,
                                        this.Height);
            // Setting toolStripFile ending values
            ToolbarSetting toolStripFileSetting = new ToolbarSetting(_handler);
            toolStripFileSetting.SaveSetting("toolStripFile",
                                             toolStripFile.Location.X,
                                             toolStripFile.Location.Y,
                                             toolStripFile.Visible);

            // Setting toolStripSums ending values
            ToolbarSetting toolStripSumsSetting = new ToolbarSetting(_handler);
            toolStripSumsSetting.SaveSetting("toolStripSums",
                                             toolStripSums.Location.X,
                                             toolStripSums.Location.Y,
                                             toolStripSums.Visible);

            //Setting settingStatusStrip1 ending values
            StatusbarSetting settingStatusStrip1 = new StatusbarSetting(_handler);
            settingStatusStrip1.SaveSetting("statusStrip1", statusStrip1.Visible);

            //Setting columnSize starting ending values
            ColumnSetting settingColumnSize = new ColumnSetting(_handler);
            settingColumnSize.SaveSetting("columnSize", columnSize.DisplayIndex, columnSize.Width);

            //Setting columnFullpath starting ending values
            ColumnSetting settingColumnFullpath = new ColumnSetting(_handler);
            settingColumnFullpath.SaveSetting("columnFullpath", columnFullpath.DisplayIndex, columnFullpath.Width);

            //Setting columnVerified starting ending values
            ColumnSetting settingColumnVerified = new ColumnSetting(_handler);
            settingColumnVerified.SaveSetting("columnVerified", columnVerified.DisplayIndex, columnVerified.Width);

            //Setting columnType starting ending values
            ColumnSetting settingColumnType = new ColumnSetting(_handler);
            settingColumnType.SaveSetting("columnType", columnType.DisplayIndex, columnType.Width);

            //Setting columnFilename starting ending values
            ColumnSetting settingColumnFilename = new ColumnSetting(_handler);
            settingColumnFilename.SaveSetting("columnFilename", columnFilename.DisplayIndex, columnFilename.Width);
        }