public MainLayout(DockPanel panel, List <ToolStripComboBox> comboBoxes, List <ToolStripButton> buttons, TrackBar trackBar, string path) { Logger = LogManager.GetLogger(Settings.Default.ApplicationLogger); Panel = panel; ComboBoxes = comboBoxes; Buttons = buttons; TrackBar = trackBar; if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } DockConfigPath = Path.Combine(path, Settings.Default.DockingConfigurationPath); TreeView = new TreeViewFrame(); TreeView.SelectedDatabaseChanged += TreeView_SlectedDatabaseChanged; TreeView.PropertiesClick += TreeView_PropertiesClick; StepFrames = new Dictionary <TestMethod, StepFrame>(); LogFrame = new LogFrame(); PropertiesFrame = new PropertiesFrame(); PropertiesFrame.Caller = TreeView; foreach (TestMethod method in GetTestMethods()) { StepFrames[method] = CreateStepFrame(method); } }
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 ShowTreeViewFrame() { if (TreeView.IsDisposed) { TreeView = new TreeViewFrame(); TreeView.CreateTreeView(); } TreeView.Activate(); TreeView.Text = "Databases"; TreeView.Show(Panel); TreeView.DockState = DockState.DockLeft; TreeView.SelectedDatabaseChanged += TreeView_SlectedDatabaseChanged; TreeView.PropertiesClick += TreeView_PropertiesClick; }
public LayoutManager(DockPanel panel, ToolStripComboBox[] comboBoxes, List <ToolStripButton> buttons, TrackBar trackBar) { Panel = panel; ComboBoxes = comboBoxes; Buttons = buttons; TrackBar = trackBar; TreeView = new TreeViewFrame(); TreeView.SelectedDatabaseChanged += TreeView_SlectedDatabaseChanged; TreeView.PropertiesClick += TreeView_PropertiesClick; StepFrames = new Dictionary <TestMethod, StepFrame>(); LogFrame = new LogFrame(); InstanceProperites = new BenchmarkInstanceProperies(); InstanceProperites.Caller = TreeView; Initialize(); foreach (var method in new TestMethod[] { TestMethod.Write, TestMethod.Read, TestMethod.SecondaryRead }) { StepFrames[method] = CreateStepFrame(method); } }