public static void Process(string newConnection, Guid jobID) { Guid newJobID = jobID; // Get server from internal cache // ------------------------------ Sql.RegisteredServer rServer = Program.gController.Repository.GetServer(newConnection); if (rServer == null) { Program.gController.Repository.RefreshRegisteredServers(); rServer = Program.gController.Repository.GetServer(newConnection); } if (rServer != null) { int snapshotID = rServer.GetLatestSnapshotId(); Form mainForm = null; FormCollection fc = Application.OpenForms; foreach (Form f in fc) { if (f.Name == "MainForm") { mainForm = f; break; } } Form_StartSnapshotJobAndShowProgress form = new Forms.Form_StartSnapshotJobAndShowProgress(mainForm, rServer, snapshotID); Guid realJobID; if (rServer.StartJob(out realJobID)) { rServer.SetJobId(realJobID); form.m_jobID = realJobID; form.m_rServer.SetStartSnapshotForm(form); form.timer_Status.Start(); form.Show(mainForm); } else { form.Close(); } } }
private void SetProgressImages(ref bool bStateChange, ref Image FinalImage, ref string FinalText) { string comment; m_snapshotID = m_rServer.GetLatestSnapshotId(); if (m_savedsnapshotID != m_snapshotID) { if (!m_snapshotAddedToTree) { Program.gController.AddSnapshotToServer(m_rServer.ConnectionName, m_snapshotID); m_snapshotAddedToTree = true; button_OK.Enabled = true; button_HideandNotify.Enabled = true; m_currentStep = 2; bStateChange = true; } string status = m_rServer.GetCurrentJobStatus(out comment, m_snapshotID); if (string.Compare(status, Utility.Snapshot.StatusInProgress, true) == 0) { string stepFmt = ("In Progress - completed steps {0} of 7"); string stepText = string.Format(stepFmt, 1); int x = 1; for (x = 1; x < 8; x++) { stepText = string.Format(stepFmt, x); if (string.Compare(comment, stepText, true) == 0) { if (x > m_currentStep) { m_currentStep = x; bStateChange = true; } break; } } } else if ((string.Compare(status, Utility.Snapshot.StatusSuccessful, true) == 0)) { SetStepImageToComplete(); FinalImage = global::Idera.SQLsecure.UI.Console.Properties.Resources.check_50; FinalText = Utility.ErrorMsgs.JobSucceededMsg; m_jobFinished = true; } else if (string.Compare(status, Utility.Snapshot.StatusError, true) == 0) { SetStepImageToError(); FinalImage = global::Idera.SQLsecure.UI.Console.Properties.Resources.error_50; FinalText = Utility.ErrorMsgs.JobFailedMsg; FinalText += string.Format("\r\n\r\nError: {0}", comment); m_jobFinished = true; } else if (string.Compare(status, Utility.Snapshot.StatusWarning, true) == 0) { SetStepImageToComplete(); FinalImage = global::Idera.SQLsecure.UI.Console.Properties.Resources.warning_50; FinalText = Sql.Snapshot.GetFormattedWarnings(comment); m_jobFinished = true; } } }