private void HandleDeploymentComplete(object sender, DeploymentCompleteEventArgs e)
        {
            switch (e.DeploymentStatus)
            {
            case DeploymentStatus.Success:
                picStatus.Image = (_dpiScaleFactor > 1 ? HighDPIUtils.ScaleByDpi(Resources.ProgressSuccess) : Resources.ProgressSuccess);
                lblStatus.Text  = "Success";
                _deployStatus   = DeploymentStatus.Success;
                break;

            case DeploymentStatus.Cancel:
                picStatus.Image = (_dpiScaleFactor > 1 ? HighDPIUtils.ScaleByDpi(Resources.ProgressCancel) : Resources.ProgressCancel);
                lblStatus.Text  = "Cancelled";
                _deployStatus   = DeploymentStatus.Cancel;
                break;

            case DeploymentStatus.Error:
                SetErrorStatus(e.ErrorMessage);
                break;

            default:
                break;
            }

            btnStopProcessing.Enabled = false;
            btnClose.Enabled          = true;
            //btnClose.Select();
        }
        private void SetErrorStatus(string errorMessage)
        {
            //might not be on UI thread
            if (this.InvokeRequired || _errorMessageForm.InvokeRequired)
            {
                SetErrorStatusDelegate SetErrorStatusCallback = new SetErrorStatusDelegate(SetErrorStatus);
                this.Invoke(SetErrorStatusCallback, new object[] { errorMessage });
            }
            else
            {
                picStatus.Image = (_dpiScaleFactor > 1 ? HighDPIUtils.ScaleByDpi(Resources.ProgressError) : Resources.ProgressError);
                lblStatus.Text  = "Error";
                _deployStatus   = DeploymentStatus.Error;

                if (!String.IsNullOrEmpty(errorMessage) && String.IsNullOrEmpty(_errorMessageForm.ErrorMessage)) //just in case already shown
                {
                    _errorMessageForm.ErrorMessage   = errorMessage;
                    _errorMessageForm.StartPosition  = FormStartPosition.CenterParent;
                    _errorMessageForm.DpiScaleFactor = _dpiScaleFactor;
                    _errorMessageForm.ShowDialog();
                }

                btnStopProcessing.Enabled = false;
                btnClose.Enabled          = true;
                btnClose.Select();
            }
        }
Esempio n. 3
0
        private void BlobCredentials_Load(object sender, EventArgs e)
        {
            if (_dpiScaleFactor > 1)
            {
                //DPI
                float dpiScaleFactorFudged = _dpiScaleFactor * HighDPIUtils.PrimaryFudgeFactor;

                this.Scale(new SizeF(dpiScaleFactorFudged * 0.44f, dpiScaleFactorFudged * 0.38f));
                this.Width = Convert.ToInt32(this.Width * dpiScaleFactorFudged * 0.6f);
                foreach (Control control in HighDPIUtils.GetChildInControl(this))
                {
                    control.Font = new Font(control.Font.FontFamily,
                                            control.Font.Size * dpiScaleFactorFudged * HighDPIUtils.PrimaryFudgeFactor,
                                            control.Font.Style);
                }
            }

            this.KeyPreview = true;

            txtConnectionName.Text = _connectionName;
            txtAccountKey.Text     = _accountKey;
            cboPrivacyLevel.Text   = "None";

            this.ActiveControl = txtAccountKey;
        }
Esempio n. 4
0
        private void BlobCredentials_Load(object sender, EventArgs e)
        {
            if (_dpiScaleFactor > 1)
            {
                //DPI
                float dpiScaleFactorFudged = _dpiScaleFactor * HighDPIUtils.PrimaryFudgeFactor;

                if (Settings.Default.OptionHighDpiLocal)
                {
                    this.Scale(new SizeF(dpiScaleFactorFudged * 0.44f, dpiScaleFactorFudged * 0.38f));
                    this.Width = Convert.ToInt32(this.Width * dpiScaleFactorFudged * 0.8f);
                    foreach (Control control in HighDPIUtils.GetChildInControl(this))
                    {
                        if (control is Button)
                        {
                            control.Font = new Font(control.Font.FontFamily,
                                                    control.Font.Size * dpiScaleFactorFudged * 1.1f * HighDPIUtils.PrimaryFudgeFactor,
                                                    control.Font.Style);
                            control.Left = control.Left - 90;
                            if (control.Name == "btnCancel")
                            {
                                control.Left = control.Left - 60;
                            }
                        }
                        else
                        {
                            control.Font = new Font(control.Font.FontFamily,
                                                    //cbw todo check * 1.4f works on remote desktop setting
                                                    control.Font.Size * dpiScaleFactorFudged * 1.4f * HighDPIUtils.PrimaryFudgeFactor,
                                                    control.Font.Style);
                        }

                        if (control is Button || control is TextBox || control is ComboBox)
                        {
                            control.Width = Convert.ToInt32(control.Width * 0.78);
                        }
                    }
                }
                else
                {
                    this.Scale(new SizeF(dpiScaleFactorFudged * 0.44f, dpiScaleFactorFudged * 0.38f));
                    this.Width = Convert.ToInt32(this.Width * dpiScaleFactorFudged * 0.6f);
                    foreach (Control control in HighDPIUtils.GetChildInControl(this))
                    {
                        control.Font = new Font(control.Font.FontFamily,
                                                control.Font.Size * dpiScaleFactorFudged * HighDPIUtils.PrimaryFudgeFactor,
                                                control.Font.Style);
                    }
                }
            }

            this.KeyPreview = true;

            txtConnectionName.Text = _connectionName;
            txtAccountKey.Text     = _accountKey;
            cboPrivacyLevel.Text   = "None";

            this.ActiveControl = txtAccountKey;
        }
Esempio n. 5
0
        private void Rescale()
        {
            this._dpiScaleFactor = HighDPIUtils.GetDpiFactor();
            if (this._dpiScaleFactor == 1)
            {
                return;
            }
            float fudgedDpiScaleFactor = _dpiScaleFactor * HighDPIUtils.PrimaryFudgeFactor;

            this.Scale(new SizeF(fudgedDpiScaleFactor, fudgedDpiScaleFactor));

            this.Font = new Font(this.Font.FontFamily,
                                 this.Font.Size * fudgedDpiScaleFactor,
                                 this.Font.Style);
            //foreach (Control c in HighDPIUtils.GetChildInControl(this)) //.OfType<Button>())
            //{
            //    if (c is SplitContainer)
            //    {
            //        c.Font = new Font(c.Font.FontFamily,
            //                          c.Font.Size * scaleFactor,
            //                          c.Font.Style);
            //    }
            //}
            pnlHeader.Font = new Font(pnlHeader.Font.FontFamily,
                                      pnlHeader.Font.Size * fudgedDpiScaleFactor,
                                      pnlHeader.Font.Style);
            scDifferenceResults.Font = new Font(scDifferenceResults.Font.FontFamily,
                                                scDifferenceResults.Font.Size * fudgedDpiScaleFactor,
                                                scDifferenceResults.Font.Style);

            // set up splitter distance/widths/visibility
            spltSourceTarget.SplitterDistance    = Convert.ToInt32(Convert.ToDouble(spltSourceTarget.Width) * 0.5);
            scDifferenceResults.SplitterDistance = Convert.ToInt32(Convert.ToDouble(scDifferenceResults.Height) * 0.74);
            scObjectDefinitions.SplitterDistance = Convert.ToInt32(Convert.ToDouble(scObjectDefinitions.Width) * 0.5);
            scDifferenceResults.IsSplitterFixed  = false;

            pnlHeader.Height = Convert.ToInt32(toolStrip1.Height * 2.3); // Convert.ToInt32(pnlHeader.Height * fudgedDpiScaleFactor * 0.68);
            txtSource.Width  = Convert.ToInt32(Convert.ToDouble(scObjectDefinitions.Panel1.Width) * 0.8);
            txtSource.Left   = Convert.ToInt32(txtSource.Left * fudgedDpiScaleFactor * 0.9);
            txtTarget.Width  = Convert.ToInt32(Convert.ToDouble(scObjectDefinitions.Panel2.Width) * 0.8);
            txtTarget.Left   = Convert.ToInt32(txtTarget.Left * fudgedDpiScaleFactor * 0.9);
            txtSourceObjectDefinition.Width  = scObjectDefinitions.Panel1.Width;
            txtSourceObjectDefinition.Height = Convert.ToInt32(Convert.ToDouble(scObjectDefinitions.Panel1.Height) * 0.86);
            txtTargetObjectDefinition.Width  = scObjectDefinitions.Panel2.Width;
            txtTargetObjectDefinition.Height = Convert.ToInt32(Convert.ToDouble(scObjectDefinitions.Panel2.Height) * 0.86);

            if (_dpiScaleFactor > 1)
            {
                HighDPIUtils.ScaleStreamedImageListByDpi(TreeGridImageList);
            }

            treeGridComparisonResults.ResetColumnWidths(fudgedDpiScaleFactor);
            if (_comparison != null && _bismNormalizerPackage.ValidationOutput != null)
            {
                _bismNormalizerPackage.ValidationOutput.Rescale(fudgedDpiScaleFactor);
            }
        }
Esempio n. 6
0
        private void ImpersonationCredentials_Load(object sender, EventArgs e)
        {
            //if (_dpiScaleFactor > 1)
            //{
            //    //DPI
            //    _dpiScaleFactor = _dpiScaleFactor * HighDPIUtils.PrimaryFudgeFactor;
            //    float fudgeFactor = HighDPIUtils.SecondaryFudgeFactor;
            //    this.Scale(new SizeF(_dpiScaleFactor, _dpiScaleFactor * fudgeFactor));
            //    this.Width = Convert.ToInt32(this.Width * _dpiScaleFactor);
            //    foreach (Control control in HighDPIUtils.GetChildInControl(this))
            //    {
            //        control.Font = new Font(control.Font.FontFamily,
            //                                control.Font.Size * _dpiScaleFactor * fudgeFactor,
            //                                control.Font.Style);
            //    }
            //}

            if (_dpiScaleFactor > 1)
            {
                //DPI
                float dpiScaleFactorFudged = _dpiScaleFactor * HighDPIUtils.PrimaryFudgeFactor;

                this.Scale(new SizeF(dpiScaleFactorFudged * 0.44f, dpiScaleFactorFudged * 0.38f));
                this.Width = Convert.ToInt32(this.Width * dpiScaleFactorFudged * 0.6f);
                foreach (Control control in HighDPIUtils.GetChildInControl(this))
                {
                    control.Font = new Font(control.Font.FontFamily,
                                            control.Font.Size * dpiScaleFactorFudged * HighDPIUtils.PrimaryFudgeFactor,
                                            control.Font.Style);
                }
            }


            this.KeyPreview = true;

            switch (_authenticationKind)
            {
            case "Windows":
                this.Text = "Impersonation Credentials";
                break;

            default:
                this.Text = "Database Username & Password";
                break;
            }

            txtConnectionName.Text = _connectionName;
            txtUsername.Text       = _username;
            txtPassword.Text       = _password;

            this.ActiveControl = txtPassword;
        }
        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);
        }
Esempio n. 8
0
        /// <summary>
        /// Scales an ImageList which is already populated with an ImageStream. Scaling occurs on the object iteself.
        /// </summary>
        /// <param name="imageList">Target ImageList</param>
        public static void ScaleStreamedImageListByDpi(ImageList imageList)
        {
            // Need to store the images before setting ImageSize as this completely wipes the Images collection
            Dictionary <string, Image> originalImages = new Dictionary <string, Image>();

            for (int i = 0; i < imageList.Images.Count; i++)
            {
                originalImages.Add(imageList.Images.Keys[i], imageList.Images[i]);
            }

            // According to MSDN, setting a new size resets the Images collection
            imageList.ImageSize = HighDPIUtils.ScaleByDpi(imageList.ImageSize);
            foreach (KeyValuePair <string, Image> entry in originalImages)
            {
                imageList.Images.Add(entry.Key, entry.Value);
            }
        }
        private void ImpersonationCredentials_Load(object sender, EventArgs e)
        {
            if (_dpiScaleFactor > 1)
            {
                //DPI
                float dpiScaleFactorFudged = _dpiScaleFactor * HighDPIUtils.PrimaryFudgeFactor;

                this.Scale(new SizeF(dpiScaleFactorFudged * 0.44f, dpiScaleFactorFudged * 0.38f));
                this.Width = Convert.ToInt32(this.Width * dpiScaleFactorFudged * 0.6f);
                foreach (Control control in HighDPIUtils.GetChildInControl(this))
                {
                    control.Font = new Font(control.Font.FontFamily,
                                            control.Font.Size * dpiScaleFactorFudged * HighDPIUtils.PrimaryFudgeFactor,
                                            control.Font.Style);
                }
            }

            this.KeyPreview = true;

            switch (_authenticationKind)
            {
            case "Windows":
                this.Text = "Impersonation Credentials";
                break;

            default:
                this.Text = "Database Username & Password";
                break;
            }

            txtConnectionName.Text = _connectionName;
            txtUsername.Text       = _username;
            txtPassword.Text       = _password;
            cboPrivacyLevel.Text   = "None";

            if (_privacyLevel == "NA")
            { //Fudge for provider data sources
                lblPrivacyLevel.Enabled = false;
                cboPrivacyLevel.Enabled = false;
            }

            this.ActiveControl = txtPassword;
        }
Esempio n. 10
0
        private void Options_Load(object sender, EventArgs e)
        {
            if (_dpiScaleFactor > 1)
            {
                float dpiScaleFactorFudged = _dpiScaleFactor * HighDPIUtils.PrimaryFudgeFactor;
                //DPI
                this.Scale(new SizeF(dpiScaleFactorFudged * (_dpiScaleFactor > 1.7 ? 1 : HighDPIUtils.SecondaryFudgeFactor), dpiScaleFactorFudged * HighDPIUtils.SecondaryFudgeFactor));
                this.Width = Convert.ToInt32(this.Width * dpiScaleFactorFudged);
                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);
                    }
                }
                this.cboProcessingOption.Left = label1.Right + Convert.ToInt32(12 * dpiScaleFactorFudged);
            }

            this.KeyPreview             = true;
            chkMeasureDependencies.Text = "Display warnings for measure dependencies (DAX\nreference to missing measure/column)";

            chkPerspectives.Checked      = _comparisonInfo.OptionsInfo.OptionPerspectives;
            chkMergePerspectives.Checked = _comparisonInfo.OptionsInfo.OptionMergePerspectives;
            chkCultures.Checked          = _comparisonInfo.OptionsInfo.OptionCultures;
            chkMergeCultures.Checked     = _comparisonInfo.OptionsInfo.OptionMergeCultures;
            chkRoles.Checked             = _comparisonInfo.OptionsInfo.OptionRoles;
            //chkActions.Checked = _comparisonInfo.OptionsInfo.OptionActions;
            chkPartitions.Checked             = _comparisonInfo.OptionsInfo.OptionPartitions;
            chkRetainPartitions.Checked       = _comparisonInfo.OptionsInfo.OptionRetainPartitions;
            chkRetainPolicyPartitions.Checked = _comparisonInfo.OptionsInfo.OptionRetainPolicyPartitions;
            chkRetainStorageMode.Checked      = _comparisonInfo.OptionsInfo.OptionRetainStorageMode;
            chkMeasureDependencies.Checked    = _comparisonInfo.OptionsInfo.OptionMeasureDependencies;
            string processingOption = _comparisonInfo.OptionsInfo.OptionProcessingOption.ToString();

            cboProcessingOption.Text = processingOption == "DoNotProcess" ? "Do Not Process" : processingOption;
            //chkTransaction.Checked = _comparisonInfo.OptionsInfo.OptionTransaction;
            chkAffectedTables.Checked = _comparisonInfo.OptionsInfo.OptionAffectedTables;
        }
Esempio n. 11
0
        private void ErrorMessage_Load(object sender, EventArgs e)
        {
            if (_dpiScaleFactor > 1)
            {
                //DPI
                _dpiScaleFactor = _dpiScaleFactor * HighDPIUtils.PrimaryFudgeFactor;
                float fudgeFactor = HighDPIUtils.SecondaryFudgeFactor;
                this.Scale(new SizeF(_dpiScaleFactor, _dpiScaleFactor * fudgeFactor));
                this.Width = Convert.ToInt32(this.Width * _dpiScaleFactor);
                foreach (Control control in HighDPIUtils.GetChildInControl(this))
                {
                    control.Font = new Font(control.Font.FontFamily,
                                            control.Font.Size * _dpiScaleFactor * fudgeFactor,
                                            control.Font.Style);
                }
            }

            txtErrorMessage.Text = _errorMessage;

            //do not want the OK button selected (closes inadvertently)
            txtErrorMessage.Focus();
            txtErrorMessage.SelectionStart  = 0;
            txtErrorMessage.SelectionLength = 0;
        }
Esempio n. 12
0
        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;
        }
Esempio n. 13
0
        private void Deploy_Load(object sender, EventArgs e)
        {
            try
            {
                //DPI
                if (_dpiScaleFactor > 1)
                {
                    float fudgedDpiScaleFactor = _dpiScaleFactor * HighDPIUtils.PrimaryFudgeFactor;

                    this.Scale(new SizeF(fudgedDpiScaleFactor, fudgedDpiScaleFactor));
                    picStatus.Scale(new SizeF(fudgedDpiScaleFactor, fudgedDpiScaleFactor));
                    gridProcessing.Scale(new SizeF(fudgedDpiScaleFactor * HighDPIUtils.SecondaryFudgeFactor, fudgedDpiScaleFactor * HighDPIUtils.SecondaryFudgeFactor));
                    this.Font = new Font(this.Font.FontFamily,
                                         this.Font.Size * fudgedDpiScaleFactor,
                                         this.Font.Style);
                    foreach (Control control in HighDPIUtils.GetChildInControl(this)) //.OfType<Button>())
                    {
                        if (control is DataGridView || control is Button)
                        {
                            control.Font = new Font(control.Font.FontFamily,
                                                    control.Font.Size * fudgedDpiScaleFactor,
                                                    control.Font.Style);
                        }
                    }
                    foreach (DataGridViewColumn col in gridProcessing.Columns)
                    {
                        col.Width = Convert.ToInt32(col.Width * fudgedDpiScaleFactor * 1.5f);
                    }
                    HighDPIUtils.ScaleStreamedImageListByDpi(DeployImageList);
                }

                this.KeyPreview = true;
                AddRow(_deployRowWorkItem, "Deploying ...");
                _deployStatus = DeploymentStatus.Deploying;

                _comparison.PasswordPrompt     += HandlePasswordPrompt;
                _comparison.BlobKeyPrompt      += HandleBlobPrompt;
                _comparison.DeploymentMessage  += HandleDeploymentMessage;
                _comparison.DeploymentComplete += HandleDeploymentComplete;

                btnStopProcessing.Enabled = false;
                btnClose.Enabled          = false;
                _errorMessageForm         = new ProcessingErrorMessage();

                ProcessingTableCollection tablesToProcess = _comparison.GetTablesToProcess();
                foreach (ProcessingTable table in tablesToProcess)
                {
                    AddRow(table.Name, "Processing in progress ...");
                }
                if (tablesToProcess.Count > 0)
                {
                    btnStopProcessing.Enabled = true;
                    lblStatus.Text            = "Processing ...";
                }
                _comparison.DatabaseDeployAndProcess(tablesToProcess);
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message, _comparisonInfo.AppName, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 14
0
        protected override void Paint(Graphics graphics, Rectangle clipBounds, Rectangle cellBounds, int rowIndex, DataGridViewElementStates cellState, object value, object formattedValue, string errorText, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle, DataGridViewPaintParts paintParts)
        {
            TreeGridNode node = this.OwningNode;

            if (node == null)
            {
                return;
            }

            Image image = node.Image;

            if (this._imageHeight == 0 && image != null)
            {
                this.UpdateStyle();
            }

            // paint the cell normally
            base.Paint(graphics, clipBounds, cellBounds, rowIndex, cellState, value, formattedValue, errorText, cellStyle, advancedBorderStyle, paintParts);

            float dpiFactor = HighDPIUtils.GetDpiFactor();
            int   scaleBack = (dpiFactor > 1 ? Convert.ToInt32(dpiFactor) : 0);

            // TO_DO: Indent width needs to take image size into account
            Rectangle glyphRect = new Rectangle(cellBounds.X + this.GlyphMargin - scaleBack, cellBounds.Y - scaleBack, INDENT_WIDTH, cellBounds.Height - 1);
            int       glyphHalf = glyphRect.Width / 2;

            //TO_DO: This painting code needs to be rehashed to be cleaner
            int level = this.Level;

            //TO_DO: Rehash this to take different Imagelayouts into account. This will speed up drawing
            //		for images of the same size (ImageLayout.None)
            if (image != null)
            {
                Point pp;
                if (_imageHeight > cellBounds.Height)
                {
                    pp = new Point(glyphRect.X + this.glyphWidth, cellBounds.Y + _imageHeightOffset);
                }
                else
                {
                    pp = new Point(glyphRect.X + this.glyphWidth, (cellBounds.Height / 2 - _imageHeight / 2) + cellBounds.Y);
                }

                // Graphics container to push/pop changes. This enables us to set clipping when painting
                // the cell's image -- keeps it from bleeding outsize of cells.
                System.Drawing.Drawing2D.GraphicsContainer gc = graphics.BeginContainer();
                {
                    graphics.SetClip(cellBounds);
                    graphics.DrawImageUnscaled(image, pp);
                }
                graphics.EndContainer(gc);
            }

            // Paint tree lines
            if (node._grid.ShowLines)
            {
                using (Pen linePen = new Pen(SystemBrushes.ControlDark, 1.0f))
                {
                    linePen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dot;
                    bool isLastSibling  = node.IsLastSibling;
                    bool isFirstSibling = node.IsFirstSibling;
                    if (node.Level == 1)
                    {
                        // the Root nodes display their lines differently
                        if (isFirstSibling && isLastSibling)
                        {
                            // only node, both first and last. Just draw horizontal line
                            graphics.DrawLine(linePen, glyphRect.X + 4, cellBounds.Top + cellBounds.Height / 2, glyphRect.Right, cellBounds.Top + cellBounds.Height / 2);
                        }
                        else if (isLastSibling)
                        {
                            // last sibling doesn't draw the line extended below. Paint horizontal then vertical
                            graphics.DrawLine(linePen, glyphRect.X + 4, cellBounds.Top + cellBounds.Height / 2, glyphRect.Right, cellBounds.Top + cellBounds.Height / 2);
                            graphics.DrawLine(linePen, glyphRect.X + 4, cellBounds.Top, glyphRect.X + 4, cellBounds.Top + cellBounds.Height / 2);
                        }
                        else if (isFirstSibling)
                        {
                            // first sibling doesn't draw the line extended above. Paint horizontal then vertical
                            graphics.DrawLine(linePen, glyphRect.X + 4, cellBounds.Top + cellBounds.Height / 2, glyphRect.Right, cellBounds.Top + cellBounds.Height / 2);
                            graphics.DrawLine(linePen, glyphRect.X + 4, cellBounds.Top + cellBounds.Height / 2, glyphRect.X + 4, cellBounds.Bottom);
                        }
                        else
                        {
                            // normal drawing draws extended from top to bottom. Paint horizontal then vertical
                            graphics.DrawLine(linePen, glyphRect.X + 4, cellBounds.Top + cellBounds.Height / 2, glyphRect.Right, cellBounds.Top + cellBounds.Height / 2);
                            graphics.DrawLine(linePen, glyphRect.X + 4, cellBounds.Top, glyphRect.X + 4, cellBounds.Bottom);
                        }
                    }
                    else
                    {
                        if (isLastSibling)
                        {
                            // last sibling doesn't draw the line extended below. Paint horizontal then vertical
                            graphics.DrawLine(linePen, glyphRect.X + 4, cellBounds.Top + cellBounds.Height / 2, glyphRect.Right, cellBounds.Top + cellBounds.Height / 2);
                            graphics.DrawLine(linePen, glyphRect.X + 4, cellBounds.Top, glyphRect.X + 4, cellBounds.Top + cellBounds.Height / 2);
                        }
                        else
                        {
                            // normal drawing draws extended from top to bottom. Paint horizontal then vertical
                            graphics.DrawLine(linePen, glyphRect.X + 4, cellBounds.Top + cellBounds.Height / 2, glyphRect.Right, cellBounds.Top + cellBounds.Height / 2);
                            graphics.DrawLine(linePen, glyphRect.X + 4, cellBounds.Top, glyphRect.X + 4, cellBounds.Bottom);
                        }

                        // paint lines of previous levels to the root
                        TreeGridNode previousNode   = node.Parent;
                        int          horizontalStop = (glyphRect.X + 4) - INDENT_WIDTH;

                        while (!previousNode.IsRoot)
                        {
                            if (previousNode.HasChildren && !previousNode.IsLastSibling)
                            {
                                // paint vertical line
                                graphics.DrawLine(linePen, horizontalStop, cellBounds.Top, horizontalStop, cellBounds.Bottom);
                            }
                            previousNode   = previousNode.Parent;
                            horizontalStop = horizontalStop - INDENT_WIDTH;
                        }
                    }
                }
            }

            //Commented out after found KPI Lake performance issue
            //         if (dpiFactor > 1) dpiFactor = dpiFactor * HighDPIUtils.PrimaryFudgeFactor;
            //         float size = 10 * dpiFactor;

            //if (node.HasChildren || node._grid.VirtualNodes)
            //{
            //	if (((TreeGridView)this.DataGridView).ImageList.Images.Count > 0)
            //	{
            //                 // Paint node glyphs
            //                 if (node.IsExpanded)
            //                 {
            //                     graphics.DrawImage(((TreeGridView)this.DataGridView).ImageList.Images[10], glyphRect.X, glyphRect.Y + (glyphRect.Height / 2) - 4, size, size);
            //                 }
            //                 else
            //                 {
            //                     graphics.DrawImage(((TreeGridView)this.DataGridView).ImageList.Images[9], glyphRect.X, glyphRect.Y + (glyphRect.Height / 2) - 4, size, size);
            //                 }
            //             }
            //}
        }