private void Connections_Load(object sender, EventArgs e) { this.Width = Convert.ToInt32(this.Width * 1.3); if (_dpiScaleFactor > 1) { //DPI float dpiScaleFactorFudged = _dpiScaleFactor * HighDPIUtils.PrimaryFudgeFactor; float fudgeFactorWidth = 0.95f; this.Scale(new SizeF(dpiScaleFactorFudged * (_dpiScaleFactor > 1.7 ? 1 : HighDPIUtils.SecondaryFudgeFactor), dpiScaleFactorFudged * HighDPIUtils.SecondaryFudgeFactor)); this.Width = Convert.ToInt32(this.Width * dpiScaleFactorFudged * fudgeFactorWidth); foreach (Control control in HighDPIUtils.GetChildInControl(this)) //.OfType<Button>()) { if (control is GroupBox || control is Button) { control.Font = new Font(control.Font.FontFamily, control.Font.Size * dpiScaleFactorFudged * HighDPIUtils.SecondaryFudgeFactor, control.Font.Style); } if (control is GroupBox || control.Name == "btnSwitch") { control.Width = Convert.ToInt32(control.Width * dpiScaleFactorFudged * fudgeFactorWidth); } if (control is ComboBox) { control.Width = Convert.ToInt32(control.Width * fudgeFactorWidth); } if (control is Panel) { control.Left = Convert.ToInt32(control.Left * dpiScaleFactorFudged); } } this.btnSwitch.Left = grpSource.Right + Convert.ToInt32(12 * dpiScaleFactorFudged); this.grpTarget.Left = btnSwitch.Right + Convert.ToInt32(12 * dpiScaleFactorFudged); } cboSourceServer.DataSource = ComparisonControl.ReverseArray <string>(Settings.Default.SourceServerAutoCompleteEntries.Substring(0, Settings.Default.SourceServerAutoCompleteEntries.Length - 1).Split("|".ToCharArray())); cboTargetServer.DataSource = ComparisonControl.ReverseArray <string>(Settings.Default.TargetServerAutoCompleteEntries.Substring(0, Settings.Default.TargetServerAutoCompleteEntries.Length - 1).Split("|".ToCharArray())); cboSourceDatabase.Text = Settings.Default.SourceCatalog; cboTargetDatabase.Text = Settings.Default.TargetCatalog; bool boundTargetDatabase = false; BindSourceConnectionInfo(); BindTargetConnectionInfo(out boundTargetDatabase); }
private void Connections_Load(object sender, EventArgs e) { //Settings.Default.SourceServerAutoCompleteEntries = "localhost|"; //Settings.Default.TargetServerAutoCompleteEntries = "localhost|"; //Settings.Default.SourceCatalog = ""; //Settings.Default.TargetCatalog = ""; //Settings.Default.Save(); //this.Width = Convert.ToInt32(this.Width * 1.3); this.Height = Convert.ToInt32(grpSource.Height * 2.6); if (_dpiScaleFactor > 1) { //DPI float dpiScaleFactorFudged = _dpiScaleFactor * Utils.PrimaryFudgeFactor; float fudgeFactorWidth = 0.95f; this.Scale(new SizeF(dpiScaleFactorFudged * (_dpiScaleFactor > 1.7 ? 1 : Utils.SecondaryFudgeFactor), dpiScaleFactorFudged * Utils.SecondaryFudgeFactor)); this.Width = Convert.ToInt32(this.Width * dpiScaleFactorFudged * fudgeFactorWidth); foreach (Control control in Utils.GetChildInControl(this)) //.OfType<Button>()) { if (control is GroupBox || control is Button) { control.Font = new Font(control.Font.FontFamily, control.Font.Size * dpiScaleFactorFudged * Utils.SecondaryFudgeFactor, control.Font.Style); } if (control is GroupBox || control.Name == "btnSwitch") { control.Width = Convert.ToInt32(control.Width * dpiScaleFactorFudged * fudgeFactorWidth); } if (control is ComboBox) { control.Width = Convert.ToInt32(control.Width * fudgeFactorWidth); } if (control is Panel) { control.Left = Convert.ToInt32(control.Left * dpiScaleFactorFudged); } } this.btnSwitch.Left = grpSource.Right + Convert.ToInt32(12 * dpiScaleFactorFudged); this.grpTarget.Left = btnSwitch.Right + Convert.ToInt32(12 * dpiScaleFactorFudged); } cboSourceServer.DataSource = ComparisonControl.ReverseArray <string>(Settings.Default.SourceServerAutoCompleteEntries.Substring(0, Settings.Default.SourceServerAutoCompleteEntries.Length - 1).Split("|".ToCharArray())); cboTargetServer.DataSource = ComparisonControl.ReverseArray <string>(Settings.Default.TargetServerAutoCompleteEntries.Substring(0, Settings.Default.TargetServerAutoCompleteEntries.Length - 1).Split("|".ToCharArray())); cboSourceDatabase.Text = Settings.Default.SourceCatalog; cboTargetDatabase.Text = Settings.Default.TargetCatalog; #region Prep Desktop/SSDT instances cboSourceDesktop.Items.Clear(); cboTargetDesktop.Items.Clear(); BindingSource desktopBindingSource = new BindingSource(); BindingSource desktopBindingTarget = new BindingSource(); _powerBIInstances.Clear(); try { _powerBIInstances = PowerBIHelper.GetLocalInstances(); } catch { } if (_powerBIInstances.Count > 0) { rdoSourceDesktop.Enabled = true; rdoTargetDesktop.Enabled = true; desktopBindingSource.DataSource = _powerBIInstances; desktopBindingTarget.DataSource = _powerBIInstances; cboSourceDesktop.DataSource = desktopBindingSource; cboSourceDesktop.ValueMember = "Port"; cboSourceDesktop.DisplayMember = "Name"; cboTargetDesktop.DataSource = desktopBindingTarget; cboTargetDesktop.ValueMember = "Port"; cboTargetDesktop.DisplayMember = "Name"; } else { rdoSourceDesktop.Enabled = false; rdoTargetDesktop.Enabled = false; } #endregion BindSourceConnectionInfo(); BindTargetConnectionInfo(); }
private void Connections_Load(object sender, EventArgs e) { if (_dpiScaleFactor > 1) { //DPI float dpiScaleFactorFudged = _dpiScaleFactor * HighDPIUtils.PrimaryFudgeFactor; float fudgeFactorWidth = 0.95f; this.Scale(new SizeF(dpiScaleFactorFudged * (_dpiScaleFactor > 1.7 ? 1 : HighDPIUtils.SecondaryFudgeFactor), dpiScaleFactorFudged * HighDPIUtils.SecondaryFudgeFactor)); this.Width = Convert.ToInt32(this.Width * dpiScaleFactorFudged * fudgeFactorWidth); foreach (Control control in HighDPIUtils.GetChildInControl(this)) //.OfType<Button>()) { if (control is GroupBox || control is Button) { control.Font = new Font(control.Font.FontFamily, control.Font.Size * dpiScaleFactorFudged * HighDPIUtils.SecondaryFudgeFactor, control.Font.Style); } if (control is GroupBox || control.Name == "btnSwitch") { control.Width = Convert.ToInt32(control.Width * dpiScaleFactorFudged * fudgeFactorWidth); } if (control is ComboBox) { control.Width = Convert.ToInt32(control.Width * fudgeFactorWidth); } if (control is Panel) { control.Left = Convert.ToInt32(control.Left * dpiScaleFactorFudged); } } this.btnSwitch.Left = grpSource.Right + Convert.ToInt32(12 * dpiScaleFactorFudged); this.grpTarget.Left = btnSwitch.Right + Convert.ToInt32(12 * dpiScaleFactorFudged); } cboSourceServer.DataSource = ComparisonControl.ReverseArray <string>(Settings.Default.SourceServerAutoCompleteEntries.Substring(0, Settings.Default.SourceServerAutoCompleteEntries.Length - 1).Split("|".ToCharArray())); cboTargetServer.DataSource = ComparisonControl.ReverseArray <string>(Settings.Default.TargetServerAutoCompleteEntries.Substring(0, Settings.Default.TargetServerAutoCompleteEntries.Length - 1).Split("|".ToCharArray())); cboSourceDatabase.Text = Settings.Default.SourceCatalog; cboTargetDatabase.Text = Settings.Default.TargetCatalog; cboSourceProject.Items.Clear(); cboTargetProject.Items.Clear(); BindingSource projectsBindingSource = new BindingSource(); BindingSource projectsBindingTarget = new BindingSource(); _projects = new SortedList(); if (_dte != null) { foreach (EnvDTE.Project project in _dte.Solution) { IterateProject(_projects, project); } } if (_projects.Count == 0) { rdoSourceProject.Enabled = false; rdoTargetProject.Enabled = false; pnlSourceProject.Enabled = false; pnlTargetProject.Enabled = false; rdoSourceDb.Checked = true; rdoTargetDb.Checked = true; } else { rdoSourceProject.Enabled = true; rdoTargetProject.Enabled = true; projectsBindingSource.DataSource = _projects; projectsBindingTarget.DataSource = _projects; cboSourceProject.DataSource = projectsBindingSource; cboSourceProject.ValueMember = "Value"; cboSourceProject.DisplayMember = "Key"; cboTargetProject.DataSource = projectsBindingTarget; cboTargetProject.ValueMember = "Value"; cboTargetProject.DisplayMember = "Key"; bool boundTargetDatabase = false; if (!(BindSourceConnectionInfo() && BindTargetConnectionInfo(out boundTargetDatabase))) { // Either new comparison with no existing connection info, or loaded from file but project not present if (_projects.Count == 1) { //if only one project, default to only the source project dropdown active rdoSourceProject.Checked = true; pnlSourceProject.Enabled = true; rdoTargetDb.Checked = true; pnlTargetProject.Enabled = false; } else { //if more than one project, default to both project dropdowns active rdoSourceProject.Checked = true; pnlSourceProject.Enabled = true; rdoTargetProject.Checked = true; pnlTargetProject.Enabled = true; cboTargetProject.SelectedIndex = 1; } } // We know there is at least 1 project, so unless bound target db from BSMN file, set target from source project configuration if (!boundTargetDatabase) { SetTargetDatabaseFromSourceProjectConfiguration(); } } _SetTargetDatabaseFromSourceProjectConfigurationAllowed = true; }