示例#1
0
        public ParamWindow(QueryStressSettings settings, string outerQuery)
        {
            InitializeComponent();

            _settings   = settings ?? throw new ArgumentNullException(nameof(settings));
            _outerQuery = outerQuery ?? throw new ArgumentNullException(nameof(outerQuery));

            var sqlControl = elementHost1.Child as SqlControl;

            if (sqlControl != null)
            {
                sqlControl.Text = (string)settings.ParamQuery.Clone();
            }

            columnMapGrid.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable;
            columnMapGrid.Columns[1].SortMode = DataGridViewColumnSortMode.NotSortable;
            columnMapGrid.Columns[2].SortMode = DataGridViewColumnSortMode.NotSortable;

            //TODO: Which event to handle?!?!
            columnMapGrid.CellEndEdit += columnMapGrid_CellValueChanged;

            if (sqlControl != null && (outerQuery.Length > 0) && (sqlControl.Text.Length > 0))
            {
                getColumnsButton_Click("constructor", null);
            }
        }
示例#2
0
        private void OpenConfigFile(string fileName)
        {
            FileStream fs = null;

            try
            {
                fs = new FileStream(fileName, FileMode.Open);
                var bf = new BinaryFormatter();

                _settings = (QueryStressSettings)bf.Deserialize(fs);
            }
            catch
            {
                MessageBox.Show(Resources.ErrLoadingSettings);
            }
            finally
            {
                if (fs != null)
                {
                    fs.Dispose();
                }
            }

            var sqlControl = elementHost1.Child as SqlControl;

            if (sqlControl != null)
            {
                sqlControl.Text = _settings.MainQuery;
            }
            threads_numericUpDown.Value    = _settings.NumThreads;
            iterations_numericUpDown.Value = _settings.NumIterations;
        }
示例#3
0
        private void openConfigFile(string FileName)
        {
            System.IO.FileStream fs = null;

            try
            {
                fs = new System.IO.FileStream(FileName, System.IO.FileMode.Open);
                System.Runtime.Serialization.Formatters.Binary.BinaryFormatter bf = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();

                this.settings = (QueryStressSettings)bf.Deserialize(fs);
            }
            catch
            {
                MessageBox.Show("Error loading settings.");
            }
            finally
            {
                if (fs != null)
                {
                    fs.Dispose();
                }
            }

            query_textBox.Text             = settings.mainQuery;
            threads_numericUpDown.Value    = settings.numThreads;
            iterations_numericUpDown.Value = settings.numIterations;
        }
示例#4
0
        public Options(QueryStressSettings settings)
        {
            _settings = settings ?? throw new ArgumentNullException(nameof(settings));

            InitializeComponent();

            connectionTimeout_numericUpDown.Value = settings.ConnectionTimeout;
            commandTimeout_numericUpDown.Value    = settings.CommandTimeout;
            connectionPooling_checkBox.Checked    = settings.EnableConnectionPooling;
            IOStatistics_checkBox.Checked         = settings.CollectIoStats;
            timeStatistics_checkBox.Checked       = settings.CollectTimeStats;
            clientDataRetrieval_checkBox.Checked  = settings.ForceDataRetrieval;
            killQueriesOnCancel_checkBox.Checked  = settings.KillQueriesOnCancel;
        }
示例#5
0
        private void OpenConfigFile(string fileName)
        {
            try
            {
                var contents = File.ReadAllText(fileName);
                _settings = JsonSerializer.ReadToObject <QueryStressSettings>(contents);
            }
            catch (Exception ex)
            {
                MessageBox.Show($"{Resources.ErrLoadingSettings}: {ex.Message}");
            }
            sqlControl1.Text = _settings.MainQuery;

            threads_numericUpDown.Value    = _settings.NumThreads;
            iterations_numericUpDown.Value = _settings.NumIterations;
            queryDelay_textBox.Text        = _settings.DelayBetweenQueries.ToString(CultureInfo.InvariantCulture);
        }
示例#6
0
        private void OpenConfigFile(string fileName)
        {
            try
            {
                var contents = File.ReadAllText(fileName);
                _settings = JsonSerializer.ReadToObject <QueryStressSettings>(contents);
            }
            catch (Exception exc)
            {
                MessageBox.Show(string.Format("{0}: {1}", Resources.ErrLoadingSettings, exc.Message));
            }

            var sqlControl = elementHost1.Child as SqlControl;

            if (sqlControl != null)
            {
                sqlControl.Text = _settings.MainQuery;
            }
            threads_numericUpDown.Value    = _settings.NumThreads;
            iterations_numericUpDown.Value = _settings.NumIterations;
            queryDelay_textBox.Text        = _settings.DelayBetweenQueries.ToString();
        }
示例#7
0
        public DatabaseSelect(QueryStressSettings settings)
        {
            _settings = settings ?? throw new ArgumentNullException(nameof(settings));
            _localMainConnectionInfo = (ConnectionInfo)settings.MainDbConnectionInfo.Clone();

            if (settings.ShareDbSettings)
            {
                _localParamConnectionInfo = (ConnectionInfo)settings.MainDbConnectionInfo.Clone();
            }
            else
            {
                _localParamConnectionInfo = (ConnectionInfo)settings.ParamDbConnectionInfo.Clone();
            }

            InitializeComponent();

            server_textBox.Text = _localMainConnectionInfo.Server;

            if (_localMainConnectionInfo.IntegratedAuth)
            {
                authentication_comboBox.SelectedIndex = 0;
                login_textBox.Enabled    = false;
                password_textBox.Enabled = false;
            }
            else
            {
                authentication_comboBox.SelectedIndex = 1;
                login_textBox.Text    = _localMainConnectionInfo.Login;
                password_textBox.Text = _localMainConnectionInfo.Password;
            }

            if (_localMainConnectionInfo.Database.Length > 0)
            {
                db_comboBox.Items.Add(_localMainConnectionInfo.Database);
                db_comboBox.SelectedIndex = 0;
            }

            if (_localMainConnectionInfo.ApplicationIntent > 0)
            {
                appintent_check.Checked      = true;
                appintent_combo.SelectedItem = _localMainConnectionInfo.ApplicationIntent;
            }

            if (!settings.ShareDbSettings)
            {
                pm_server_textBox.Text = _localParamConnectionInfo.Server;

                if (_localParamConnectionInfo.IntegratedAuth)
                {
                    pm_authentication_comboBox.SelectedIndex = 0;
                    pm_login_textBox.Enabled    = false;
                    pm_password_textBox.Enabled = false;
                }
                else
                {
                    pm_authentication_comboBox.SelectedIndex = 1;
                    pm_login_textBox.Text    = _localParamConnectionInfo.Login;
                    pm_password_textBox.Text = _localParamConnectionInfo.Password;
                }

                if (_localParamConnectionInfo.Database.Length > 0)
                {
                    pm_db_comboBox.Items.Add(_localParamConnectionInfo.Database);
                    pm_db_comboBox.SelectedIndex = 0;
                }
                if (_localParamConnectionInfo.ApplicationIntent > 0)
                {
                    pm_appintent_check.Checked      = true;
                    pm_appintent_combo.SelectedItem = _localParamConnectionInfo.ApplicationIntent;
                }
            }
            else
            {
                pm_authentication_comboBox.SelectedIndex = 0;
            }

            shareSettings_checkBox.Checked = settings.ShareDbSettings;

            authentication_comboBox.SelectedIndexChanged    += authentication_comboBox_SelectedIndexChanged;
            pm_authentication_comboBox.SelectedIndexChanged += pm_authentication_comboBox_SelectedIndexChanged;

            db_comboBox.Enter += Db_comboBox_Enter;
            db_comboBox.Leave += Db_comboBox_Leave;

            pm_db_comboBox.Enter += Db_comboBox_Enter;
            pm_db_comboBox.Leave += Db_comboBox_Leave;

            server_textBox.KeyDown     += Server_textBox_KeyDown;
            server_textBox.TextChanged += Server_textBox_TextChanged;

            Server_textBox_TextChanged(null, null);
        }