示例#1
0
 /// <summary>
 /// Deploy database to target server and perform processing if required.
 /// </summary>
 /// <param name="tablesToProcess"></param>
 public abstract void DatabaseDeployAndProcess(ProcessingTableCollection tablesToProcess);
        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);
            }
        }