public void Load(string path)
        {
            TreeViewFrame treeView = LayoutManager.TreeView;

            try
            {
                if (!File.Exists(path))
                {
                    treeView.CreateTreeView();
                }

                // Clear TreeView.
                treeView.ClearTreeViewNodes();

                using (var stream = new FileStream(path, FileMode.OpenOrCreate))
                {
                    XmlSerializer     deserializer = new XmlSerializer(typeof(XmlProjectPersist));
                    XmlProjectPersist appPersist   = (XmlProjectPersist)deserializer.Deserialize(stream);

                    // Add databases in TreeView.
                    foreach (var database in appPersist.Databases)
                    {
                        treeView.CreateTreeViewNode(database.Key, database.Value, appPersist.IsCategoryOrder);
                    }

                    foreach (var comboBox in appPersist.ComboBoxItems)
                    {
                        LayoutManager.ComboBoxes.First(x => x.Name == comboBox.Key).Text = comboBox.Value;
                    }

                    foreach (var btn in appPersist.Buttons)
                    {
                        var currentBtn = LayoutManager.Buttons.First(x => x.Name == btn.Key);
                        currentBtn.Checked = !btn.Value;
                        currentBtn.PerformClick();
                    }

                    foreach (var stepFrame in appPersist.ChartSettings)
                    {
                        LayoutManager.StepFrames[stepFrame.Key].SetSettings(stepFrame.Value);
                    }

                    LayoutManager.TrackBar.Value = appPersist.TrackBarValue;
                }

                treeView.ExpandAll();
                treeView.SelectFirstNode();

                LayoutManager.RefreshPropertyFrame();
            }
            catch (Exception exc)
            {
                Logger.Error("Persist load error ...", exc);
                treeView.CreateTreeView();
            }
        }
        public void Store(string path)
        {
            try
            {
                // Docking.
                StoreDocking();

                // Remove last configuration.
                if (File.Exists(path))
                {
                    File.Delete(path);
                }

                // Databases and frames.
                using (var stream = new FileStream(path, FileMode.OpenOrCreate))
                {
                    Dictionary <IDatabase, bool> databases        = LayoutManager.TreeView.GetAllDatabases();
                    Dictionary <string, string>  selectedItmes    = LayoutManager.GetSelectedFromComboBoxes();
                    Dictionary <string, bool>    toolStripButtons = LayoutManager.GetToolStripCheckedButtons();

                    List <KeyValuePair <TestMethod, List <ChartSettings> > > chartSettings = new List <KeyValuePair <TestMethod, List <ChartSettings> > >();

                    foreach (var frame in LayoutManager.StepFrames)
                    {
                        chartSettings.Add(new KeyValuePair <TestMethod, List <ChartSettings> >(frame.Key, frame.Value.GetLineChartSettings()));
                    }

                    XmlProjectPersist persist = new XmlProjectPersist(databases, LayoutManager.TreeView.IsCategoryOrder(), selectedItmes, toolStripButtons, chartSettings, LayoutManager.TrackBar.Value);

                    XmlSerializer serializer = new XmlSerializer(typeof(XmlProjectPersist));
                    serializer.Serialize(stream, persist);
                }
            }
            catch (Exception exc)
            {
                Logger.Error("Persist store error ...", exc);
            }
        }
        public void Store(string path)
        {
            try
            {
                // Docking.
                StoreDocking();

                // Remove last configuration.
                if (File.Exists(path))
                    File.Delete(path);

                // Databases and frames.
                using (var stream = new FileStream(path, FileMode.OpenOrCreate))
                {
                    Dictionary<IDatabase, bool> databases = LayoutManager.TreeView.GetAllDatabases();
                    Dictionary<string, string> selectedItmes = LayoutManager.GetSelectedFromComboBoxes();
                    Dictionary<string, bool> toolStripButtons = LayoutManager.GetToolStripCheckedButtons();

                    List<KeyValuePair<TestMethod, List<ChartSettings>>> chartSettings = new List<KeyValuePair<TestMethod, List<ChartSettings>>>();

                    foreach (var frame in LayoutManager.StepFrames)
                        chartSettings.Add(new KeyValuePair<TestMethod, List<ChartSettings>>(frame.Key, frame.Value.GetLineChartSettings()));

                    XmlProjectPersist persist = new XmlProjectPersist(databases,LayoutManager.TreeView.IsCategoryOrder(), selectedItmes, toolStripButtons, chartSettings, LayoutManager.TrackBar.Value);

                    XmlSerializer serializer = new XmlSerializer(typeof(XmlProjectPersist));
                    serializer.Serialize(stream, persist);
                }
            }
            catch (Exception exc)
            {
                Logger.Error("Persist store error ...", exc);
            }
        }