Beispiel #1
0
        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.95);
            }
            this.Height = (int)(Math.Min(1080, height) * 0.90);

            _optionSettings   = new OptionSettings();
            _testSettingsPath = Path.GetFullPath(Path.Combine("..\\", OptionSettings.SettingsFileName));
            if (!string.IsNullOrWhiteSpace(_testSettingsPath) && File.Exists(_testSettingsPath))
            {
                _optionSettings.Load(_testSettingsPath, this);
            }

            _currentTheme = DockingTheme.LightTheme;

            InitializePanels();
        }
        public OptionSettings Clone()
        {
            OptionSettings clonedSettings = new OptionSettings(this);

            if (_webSuitePath != null)
            {
                clonedSettings._webSuitePath = string.Copy(_webSuitePath);
            }
            if (_localSuitePath != null)
            {
                clonedSettings._localSuitePath = string.Copy(_localSuitePath);
            }
            if (_winPosition != null)
            {
                clonedSettings._winPosition = _winPosition.Clone();
            }
            if (_testSuites != null)
            {
                int itemCount = _testSuites.Count;
                List <SvgTestSuite> clonedTestSuites = new List <SvgTestSuite>(itemCount);
                for (int i = 0; i < itemCount; i++)
                {
                    clonedTestSuites.Add(_testSuites[i].Clone());
                }
                clonedSettings._testSuites = clonedTestSuites;
            }

            return(clonedSettings);
        }
 public OptionSettings(OptionSettings source)
 {
     if (source == null)
     {
         return;
     }
     _hidePathsRoot  = source._hidePathsRoot;
     _webSuitePath   = source._webSuitePath;
     _localSuitePath = source._localSuitePath;
 }
Beispiel #4
0
        private void OnOpenSvgSuitePath(object sender, EventArgs e)
        {
            var filePath = txtSvgSuitePath.Text;

            if (string.IsNullOrWhiteSpace(filePath) || Directory.Exists(filePath) == false)
            {
                return;
            }

            OptionSettings.OpenFolderAndSelectItem(filePath, null);
        }
 public OptionSettings(OptionSettings source)
 {
     if (source == null)
     {
         return;
     }
     _hidePathsRoot  = source._hidePathsRoot;
     _webSuitePath   = source._webSuitePath;
     _localSuitePath = source._localSuitePath;
     _theme          = source._theme;
     _winPosition    = source._winPosition;
     _testSuites     = source._testSuites;
 }
        private void OnTestSuitesSelectionChanged(object sender, EventArgs e)
        {
            if (_mainForm == null || _isInitialising || _optionSettings == null)
            {
                return;
            }

            var selectedItem = cboTestSuites.SelectedItem as ComboBoxItem;

            if (selectedItem == null || selectedItem.Tag == null)
            {
                return;
            }
            var testSuite = selectedItem.Tag as SvgTestSuite;

            if (testSuite == null)
            {
                return;
            }
            string localSuitePath = testSuite.LocalSuitePath;

            if (OptionSettings.IsTestSuiteAvailable(localSuitePath) == false)
            {
                PromptDialog dlg = new PromptDialog();
                dlg.Owner          = _mainForm;
                dlg.OptionSettings = _optionSettings;

                var dialogResult = dlg.ShowDialog();

                if (dialogResult == DialogResult.Cancel)
                {
                    return;
                }
            }

            _isInitialising = true;

            txtSvgSuitePath.Text    = _optionSettings.GetPath(testSuite.LocalSuitePath);
            txtSvgSuitePathWeb.Text = testSuite.WebSuitePath;

            _optionSettings.LocalSuitePath = testSuite.LocalSuitePath;
            _optionSettings.WebSuitePath   = testSuite.WebSuitePath;

            testSuite.SetSelected(_optionSettings.TestSuites);

            _isGeneralModified = true;

            _isInitialising = false;
        }
Beispiel #7
0
        public OptionSettings Clone()
        {
            OptionSettings optSettings = new OptionSettings(this);

            if (_webSuitePath != null)
            {
                optSettings._webSuitePath = string.Copy(_webSuitePath);
            }
            if (_localSuitePath != null)
            {
                optSettings._localSuitePath = string.Copy(_localSuitePath);
            }

            return(optSettings);
        }
Beispiel #8
0
        private void OnSvgSuitePathTextChanged(object sender, EventArgs e)
        {
            string selectePath = txtSvgSuitePath.Text;

            if (selectePath != null)
            {
                selectePath = selectePath.Trim();
            }
            if (string.IsNullOrWhiteSpace(selectePath) || !Directory.Exists(selectePath))
            {
                btnPathLocate.Enabled = false;

                return;
            }

            btnPathLocate.Enabled = true;

            if (OptionSettings.IsTestSuiteAvailable(selectePath))
            {
                _isGeneralModified             = true;
                _optionSettings.LocalSuitePath = selectePath;
            }
        }
 public void InitializePanel(MainForm mainForm, OptionSettings optionSettings, ThemeBase theme)
 {
     _mainForm       = mainForm;
     _optionSettings = optionSettings;
     _theme          = theme;
 }
Beispiel #10
0
 public OptionSettings(OptionSettings source)
 {
     _hidePathsRoot  = source._hidePathsRoot;
     _webSuitePath   = source._webSuitePath;
     _localSuitePath = source._localSuitePath;
 }