private void InitializeData() { if (_mainForm == null || _mainForm.OptionSettings == null) { return; } _optionSettings = _mainForm.OptionSettings; _isInitialising = true; txtSvgSuitePath.Text = _optionSettings.GetPath(_optionSettings.LocalSuitePath); txtSvgSuitePathWeb.Text = _optionSettings.WebSuitePath; txtSvgSuitePath.ReadOnly = _optionSettings.HidePathsRoot; chkHidePathsRoot.Checked = _optionSettings.HidePathsRoot; _isConversionModified = false; cmbTheme.Items.Clear(); for (int i = 0; i < 3; i++) { DockingTheme theme = (DockingTheme)i; cmbTheme.Items.Add(theme.ToString().Replace("Theme", "")); } cmbTheme.SelectedIndex = (int)_optionSettings.Theme; _isInitialising = false; }
public MainForm() { InitializeComponent(); this.AutoScaleMode = AutoScaleMode.Dpi; this.BackColor = Color.White; var screenBounds = Screen.PrimaryScreen.WorkingArea; int width = screenBounds.Width; int height = screenBounds.Height; if (width > 1200) { this.Width = 1200; } else { this.Width = (int)(Math.Min(1200, width) * 0.80); } this.Height = (int)(Math.Min(1080, height) * 0.90); _optionSettings = new OptionSettings(); _testSettingsPath = Path.GetFullPath(Path.Combine("..\\", SvgTestSettings)); if (!string.IsNullOrWhiteSpace(_testSettingsPath) && File.Exists(_testSettingsPath)) { _optionSettings.Load(_testSettingsPath, this); } _currentTheme = DockingTheme.LightTheme; InitializePanels(); }
private void SaveOption(XmlWriter writer, string name, DockingTheme theme) { writer.WriteStartElement("option"); writer.WriteAttributeString("name", name); writer.WriteAttributeString("type", "Other"); writer.WriteString(theme.ToString()); writer.WriteEndElement(); }
private void InitializeData() { if (_mainForm == null || _mainForm.OptionSettings == null) { return; } _optionSettings = _mainForm.OptionSettings; _isInitialising = true; txtSvgSuitePath.Text = _optionSettings.GetPath(_optionSettings.LocalSuitePath); txtSvgSuitePathWeb.Text = _optionSettings.WebSuitePath; txtSvgSuitePath.ReadOnly = _optionSettings.HidePathsRoot; chkHidePathsRoot.Checked = _optionSettings.HidePathsRoot; var testSuites = _optionSettings.TestSuites; if (testSuites != null && testSuites.Count != 0) { cboTestSuites.Items.Clear(); int selectedIndex = 0; for (int i = 0; i < testSuites.Count; i++) { var testSuite = testSuites[i]; ComboBoxItem comboxItem = new ComboBoxItem(); comboxItem.Value = testSuite.Description; comboxItem.Tag = testSuite; cboTestSuites.Items.Add(comboxItem); if (testSuite.IsSelected) { selectedIndex = i; } } cboTestSuites.SelectedIndex = selectedIndex; } _isConversionModified = false; cmbTheme.Items.Clear(); for (int i = 0; i < 3; i++) { DockingTheme theme = (DockingTheme)i; cmbTheme.Items.Add(theme.ToString().Replace("Theme", string.Empty)); } cmbTheme.SelectedIndex = (int)_optionSettings.Theme; _isInitialising = false; }
public OptionSettings(OptionSettings source) { if (source == null) { return; } _hidePathsRoot = source._hidePathsRoot; _webSuitePath = source._webSuitePath; _localSuitePath = source._localSuitePath; _theme = source._theme; _winPosition = source._winPosition; }
public OptionSettings() { string currentDir = Path.GetFullPath(@"..\..\FullTestSuite"); if (!Directory.Exists(currentDir)) { Directory.CreateDirectory(currentDir); } _localSuitePath = currentDir; _webSuitePath = FullTestSuite; _theme = DockingTheme.LightTheme; }
public OptionSettings(string testPath) { _localSuitePath = testPath; if (string.IsNullOrWhiteSpace(testPath)) { string currentDir = Path.GetFullPath(@"..\..\FullTestSuite"); _localSuitePath = currentDir; } _webSuitePath = FullTestSuite; if (!Directory.Exists(_localSuitePath)) { Directory.CreateDirectory(_localSuitePath); } _theme = DockingTheme.LightTheme; }
private void ApplyTheme(DockingTheme theme) { if (_currentTheme != theme) { _currentTheme = theme; var dockPanels = new DockPanelContent[] { _testViewPanel, _debugPanel, _testPanel, _aboutTestPanel, _inputPanel, _settingsPanel, _resultsPanel }; ThemeBase currentTheme = _vS2015LightTheme; switch (_currentTheme) { case DockingTheme.LightTheme: currentTheme = _vS2015LightTheme; break; case DockingTheme.BlueTheme: currentTheme = _vS2015BlueTheme; break; case DockingTheme.DarkTheme: currentTheme = _vS2015DarkTheme; break; } foreach (var dockPanel in dockPanels) { dockPanel.Theme = currentTheme; } _dockPanel.Theme = currentTheme; } }
private void InitializeData() { if (_mainForm == null || _mainForm.OptionSettings == null) { return; } _optionSettings = _mainForm.OptionSettings; _isInitialising = true; cmbTheme.Items.Clear(); for (int i = 0; i < 3; i++) { DockingTheme theme = (DockingTheme)i; cmbTheme.Items.Add(theme.ToString().Replace("Theme", "")); } cmbTheme.SelectedIndex = (int)_optionSettings.Theme; _isConversionModified = false; _isInitialising = false; }
public OptionSettings(string testPath) { _localSuitePath = testPath; _testSuites = SvgTestSuite.Create(); // For the start the default is selected var selectedSuite = SvgTestSuite.GetDefault(_testSuites); if (selectedSuite != null) { if (string.IsNullOrWhiteSpace(testPath)) { _localSuitePath = selectedSuite.LocalSuitePath; } _webSuitePath = selectedSuite.WebSuitePath; } if (!Directory.Exists(_localSuitePath)) { Directory.CreateDirectory(_localSuitePath); } _theme = DockingTheme.LightTheme; }
private void InitializePanels() { _dockPanel = new DockPanel(); _vS2015LightTheme = new VS2015LightTheme(); _vS2015BlueTheme = new VS2015BlueTheme(); _vS2015DarkTheme = new VS2015DarkTheme(); _currentTheme = _optionSettings.Theme; ThemeBase currentTheme = _vS2015LightTheme; switch (_currentTheme) { case DockingTheme.LightTheme: currentTheme = _vS2015LightTheme; break; case DockingTheme.BlueTheme: currentTheme = _vS2015BlueTheme; break; case DockingTheme.DarkTheme: currentTheme = _vS2015DarkTheme; break; } _dockPanel.Dock = DockStyle.Fill; _dockPanel.DockBackColor = Color.White; _dockPanel.DockBottomPortion = 300D; _dockPanel.DockLeftPortion = 300D; _dockPanel.DockRightPortion = 300D; _dockPanel.DockTopPortion = 150D; _dockPanel.Font = new Font("Tahoma", 12F, FontStyle.Regular, GraphicsUnit.World, 0); _dockPanel.Location = new Point(0, 49); _dockPanel.Name = "dockPanel"; _dockPanel.Padding = new Padding(6); _dockPanel.RightToLeftLayout = true; _dockPanel.ShowAutoHideContentOnHover = true; _dockPanel.Size = new Size(this.Width - 10, this.Height - 10); _dockPanel.TabIndex = 0; _dockPanel.Theme = currentTheme; _dockPanel.DocumentStyle = DocumentStyle.DockingWindow; _dockPanel.ShowDocumentIcon = true; _dockPanel.AllowEndUserDocking = false; _dockPanel.AllowEndUserNestedDocking = false; this.Controls.Add(_dockPanel); _vS2015LightTheme.Skin.DockPaneStripSkin.TextFont = new Font("Segoe UI", 16F, FontStyle.Regular, GraphicsUnit.World, 0); _vS2015BlueTheme.Skin.DockPaneStripSkin.TextFont = new Font("Segoe UI", 16F, FontStyle.Regular, GraphicsUnit.World, 0); _vS2015DarkTheme.Skin.DockPaneStripSkin.TextFont = new Font("Segoe UI", 16F, FontStyle.Regular, GraphicsUnit.World, 0); _debugPanel = new DebugDockPanel(); _debugPanel.Text = "Debugging"; _debugPanel.Show(_dockPanel, DockState.DockBottomAutoHide); //_testPanel = new TestDockPanel(); //_testPanel.Text = "Test"; //_testPanel.Show(_dockPanel, DockState.Document); _inputPanel = new SvgInputDockPanel(); _inputPanel.Text = "Svg Input"; _inputPanel.Show(_dockPanel, DockState.Document); _settingsPanel = new SettingsDockPanel(); _settingsPanel.Text = "Settings"; _settingsPanel.Show(_inputPanel.Pane, null); var dockPanels = new DockPanelContent[] { _debugPanel, _inputPanel, _settingsPanel }; foreach (var dockPanel in dockPanels) { dockPanel.InitializePanel(this, _optionSettings, currentTheme); } _dockPanel.ActiveContentChanged += OnDockPanelActiveContentChanged; _dockPanel.ActiveDocumentChanged += OnDockPanelActiveDocumentChanged; _dockPanel.ActivePaneChanged += OnDockPanelActivePaneChanged; _inputPanel.Activate(); }
private void Load(XmlReader reader, Form mainForm) { var comparer = StringComparison.OrdinalIgnoreCase; List <SvgTestSuite> testSuites = new List <SvgTestSuite>(SvgTestSuite.TestSuiteCount); while (reader.Read()) { if (reader.NodeType == XmlNodeType.Element) { if (string.Equals(reader.Name, "option", comparer)) { string optionName = reader.GetAttribute("name"); string optionType = reader.GetAttribute("type"); if (string.Equals(optionType, "String", comparer)) { string optionValue = reader.ReadElementContentAsString(); switch (optionName) { //case "WebSuitePath": // _webSuitePath = optionValue; // break; //case "LocalSuitePath": // if (optionValue.StartsWith(ParentSymbol, comparer)) // { // var inputPath = string.Copy(_localSuitePath); // int indexOf = inputPath.IndexOf(SharpVectors, comparer); // if (indexOf > 0) // { // var basePath = inputPath.Substring(0, indexOf); // _localSuitePath = Path.Combine(basePath, optionValue.Replace(ParentSymbol, "")); // } // else // { // _localSuitePath = optionValue; // } // } // else // { // _localSuitePath = optionValue; // } // // Ignore old test suite directory, if found // if (string.IsNullOrWhiteSpace(_localSuitePath) || // !this.IsLocalSuitePathChanged(Path.GetFullPath(TestsSvg))) // { // _localSuitePath = Path.GetFullPath(TestsSvg10); // } // break; case "SelectedValuePath": _selectedValuePath = optionValue; break; } } else if (string.Equals(optionType, "Boolean", comparer)) { bool optionValue = reader.ReadElementContentAsBoolean(); switch (optionName) { case "HidePathsRoot": _hidePathsRoot = optionValue; break; } } else if (string.Equals(optionType, "Other", comparer)) { string optionValue = reader.ReadElementContentAsString(); switch (optionName) { case "Theme": _theme = (DockingTheme)Enum.Parse(typeof(DockingTheme), optionValue, true); break; } } } else if (string.Equals(reader.Name, "testSuite", comparer)) { if (!reader.IsEmptyElement) { SvgTestSuite testSuite = new SvgTestSuite(reader); if (testSuite.IsValid()) { testSuites.Add(testSuite); } } } else if (string.Equals(reader.Name, "placements", comparer)) { if (reader.IsEmptyElement == false) { if (reader.ReadToFollowing("WindowPosition")) { var xs = new XmlSerializer(typeof(WindowPosition)); _winPosition = xs.Deserialize(reader) as WindowPosition; } } } } } if (testSuites.Count == SvgTestSuite.TestSuiteCount) { var selectedSuite = SvgTestSuite.GetSelected(testSuites); if (selectedSuite != null) { _localSuitePath = selectedSuite.LocalSuitePath; _webSuitePath = selectedSuite.WebSuitePath; _testSuites = testSuites; } } if (mainForm != null && _winPosition != null) { try { switch (_winPosition.WindowState) { case FormWindowState.Maximized: mainForm.Location = _winPosition.MaximisedPoint; mainForm.StartPosition = FormStartPosition.Manual; break; case FormWindowState.Normal: if (_winPosition.IsIdenticalScreen()) { mainForm.Location = _winPosition.Location; mainForm.Size = _winPosition.Size; mainForm.StartPosition = FormStartPosition.Manual; } break; case FormWindowState.Minimized: _winPosition.WindowState = FormWindowState.Normal; break; default: break; } mainForm.WindowState = _winPosition.WindowState; } catch (Exception ex) { Trace.TraceError(ex.ToString()); } } }
private void Load(XmlReader reader, Form mainForm) { var comparer = StringComparison.OrdinalIgnoreCase; while (reader.Read()) { if (reader.NodeType == XmlNodeType.Element) { if (string.Equals(reader.Name, "option", comparer)) { string optionName = reader.GetAttribute("name"); string optionType = reader.GetAttribute("type"); if (string.Equals(optionType, "String", comparer)) { string optionValue = reader.ReadElementContentAsString(); switch (optionName) { case "WebSuitePath": _webSuitePath = optionValue; break; case "LocalSuitePath": if (optionValue.StartsWith(ParentSymbol, comparer)) { var inputPath = string.Copy(_localSuitePath); int indexOf = inputPath.IndexOf(SharpVectors, comparer); if (indexOf > 0) { var basePath = inputPath.Substring(0, indexOf); _localSuitePath = Path.Combine(basePath, optionValue.Replace(ParentSymbol, "")); } else { _localSuitePath = optionValue; } } else { _localSuitePath = optionValue; } break; case "SelectedValuePath": _selectedValuePath = optionValue; break; } } else if (string.Equals(optionType, "Boolean", comparer)) { bool optionValue = reader.ReadElementContentAsBoolean(); switch (optionName) { case "HidePathsRoot": _hidePathsRoot = optionValue; break; } } else if (string.Equals(optionType, "Other", comparer)) { string optionValue = reader.ReadElementContentAsString(); switch (optionName) { case "Theme": _theme = (DockingTheme)Enum.Parse(typeof(DockingTheme), optionValue, true); break; } } } else if (string.Equals(reader.Name, "placements", StringComparison.OrdinalIgnoreCase)) { if (reader.IsEmptyElement == false) { if (reader.ReadToFollowing("WindowPosition")) { var xs = new XmlSerializer(typeof(WindowPosition)); _winPosition = xs.Deserialize(reader) as WindowPosition; } } } } } if (mainForm != null && _winPosition != null) { try { switch (_winPosition.WindowState) { case FormWindowState.Maximized: mainForm.Location = _winPosition.MaximisedPoint; mainForm.StartPosition = FormStartPosition.Manual; break; case FormWindowState.Normal: if (_winPosition.IsIdenticalScreen()) { mainForm.Location = _winPosition.Location; mainForm.Size = _winPosition.Size; mainForm.StartPosition = FormStartPosition.Manual; } break; case FormWindowState.Minimized: _winPosition.WindowState = FormWindowState.Normal; break; default: break; } mainForm.WindowState = _winPosition.WindowState; } catch (Exception ex) { Trace.TraceError(ex.ToString()); } } }