Ejemplo n.º 1
0
        public UserInterfaceModalResult ShowMaintenance(UserInterfaceInfo info, MaintenanceInfo maintenanceInfo)
        {
            this.WaitReady();
            ManualResetEvent manualResetEvent = new ManualResetEvent(false);
            MaintenancePiece maintenancePiece = (MaintenancePiece)this._uiForm.Invoke((Delegate) new UserInterfaceForm.ConstructMaintenancePieceDelegate(this._uiForm.ConstructMaintenancePiece), (object)info, (object)maintenanceInfo, (object)manualResetEvent);

            manualResetEvent.WaitOne();
            return(maintenancePiece.ModalResult);
        }
        public UserInterfaceModalResult ShowMaintenance(UserInterfaceInfo info, MaintenanceInfo maintenanceInfo)
        {
            this.WaitReady();
            ManualResetEvent event2 = new ManualResetEvent(false);
            MaintenancePiece piece  = (MaintenancePiece)this._uiForm.Invoke(new UserInterfaceForm.ConstructMaintenancePieceDelegate(this._uiForm.ConstructMaintenancePiece), new object[] { info, maintenanceInfo, event2 });

            event2.WaitOne();
            return(piece.ModalResult);
        }
Ejemplo n.º 3
0
 public MaintenancePiece(UserInterfaceForm parentForm, UserInterfaceInfo info, MaintenanceInfo maintenanceInfo, ManualResetEvent modalEvent)
 {
     this._modalResult     = UserInterfaceModalResult.Cancel;
     this._info            = info;
     this._maintenanceInfo = maintenanceInfo;
     this._modalEvent      = modalEvent;
     this.SuspendLayout();
     this.InitializeComponent();
     this.InitializeContent();
     this.ResumeLayout(false);
     parentForm.SuspendLayout();
     parentForm.SwitchUserInterfacePiece((FormPiece)this);
     parentForm.Text          = this._info.formTitle;
     parentForm.MinimizeBox   = false;
     parentForm.MaximizeBox   = false;
     parentForm.ControlBox    = true;
     this.lblHeader.Font      = new Font(this.lblHeader.Font, this.lblHeader.Font.Style | FontStyle.Bold);
     parentForm.ActiveControl = (Control)this.btnCancel;
     parentForm.ResumeLayout(false);
     parentForm.PerformLayout();
     parentForm.Visible = true;
 }
 public MaintenancePiece(UserInterfaceForm parentForm, UserInterfaceInfo info, MaintenanceInfo maintenanceInfo, ManualResetEvent modalEvent)
 {
     base._modalResult = UserInterfaceModalResult.Cancel;
     this._info = info;
     this._maintenanceInfo = maintenanceInfo;
     base._modalEvent = modalEvent;
     base.SuspendLayout();
     this.InitializeComponent();
     this.InitializeContent();
     base.ResumeLayout(false);
     parentForm.SuspendLayout();
     parentForm.SwitchUserInterfacePiece(this);
     parentForm.Text = this._info.formTitle;
     parentForm.MinimizeBox = false;
     parentForm.MaximizeBox = false;
     parentForm.ControlBox = true;
     this.lblHeader.Font = new Font(this.lblHeader.Font, this.lblHeader.Font.Style | FontStyle.Bold);
     parentForm.ActiveControl = this.btnCancel;
     parentForm.ResumeLayout(false);
     parentForm.PerformLayout();
     parentForm.Visible = true;
 }
Ejemplo n.º 5
0
        private void MaintainSubscriptionInternal(string textualSubId)
        {
            bool flag1 = false;

            string[] strArray = new string[4]
            {
                "Maintain_Exception",
                "Maintain_Completed",
                "Maintain_Failed",
                "Maintain_FailedMsg"
            };
            bool      flag2          = false;
            Exception exception      = (Exception)null;
            bool      flag3          = false;
            string    linkUrlMessage = Resources.GetString("ErrorMessage_GenericLinkUrlMessage");
            string    linkUrl        = (string)null;
            string    str            = (string)null;

            Logger.StartCurrentThreadLogging();
            Logger.SetTextualSubscriptionIdentity(textualSubId);
            using (UserInterface userInterface = new UserInterface())
            {
                MaintenanceInfo maintenanceInfo = new MaintenanceInfo();
                try
                {
                    UserInterfaceInfo info = new UserInterfaceInfo();
                    Logger.AddPhaseInformation(Resources.GetString("PhaseLog_StoreQueryForMaintenanceInfo"));
                    SubscriptionState subscriptionState = this.GetSubscriptionState(textualSubId);
                    bool flag4;
                    try
                    {
                        subscriptionState.SubscriptionStore.CheckInstalledAndShellVisible(subscriptionState);
                        if (subscriptionState.RollbackDeployment == null)
                        {
                            maintenanceInfo.maintenanceFlags |= MaintenanceFlags.RemoveSelected;
                        }
                        else
                        {
                            maintenanceInfo.maintenanceFlags |= MaintenanceFlags.RestorationPossible;
                            maintenanceInfo.maintenanceFlags |= MaintenanceFlags.RestoreSelected;
                        }
                        AssemblyManifest deploymentManifest = subscriptionState.CurrentDeploymentManifest;
                        if (deploymentManifest != null && deploymentManifest.Description != null)
                        {
                            str = deploymentManifest.Description.ErrorReportUrl;
                        }
                        Description effectiveDescription = subscriptionState.EffectiveDescription;
                        info.productName = effectiveDescription.Product;
                        info.supportUrl  = effectiveDescription.SupportUrl;
                        info.formTitle   = string.Format((IFormatProvider)CultureInfo.CurrentUICulture, Resources.GetString("UI_MaintenanceTitle"), new object[1]
                        {
                            (object)info.productName
                        });
                        flag4 = true;
                    }
                    catch (DeploymentException ex)
                    {
                        flag4 = false;
                        Logger.AddErrorInformation(Resources.GetString("MaintainLogMsg_FailedStoreLookup"), (Exception)ex);
                        maintenanceInfo.maintenanceFlags |= MaintenanceFlags.RemoveSelected;
                    }
                    catch (FormatException ex)
                    {
                        flag4 = false;
                        Logger.AddErrorInformation(Resources.GetString("MaintainLogMsg_FailedStoreLookup"), (Exception)ex);
                        maintenanceInfo.maintenanceFlags |= MaintenanceFlags.RemoveSelected;
                    }
                    bool flag5 = false;
                    if (flag4)
                    {
                        if (userInterface.ShowMaintenance(info, maintenanceInfo) == UserInterfaceModalResult.Ok)
                        {
                            flag5 = true;
                        }
                    }
                    else
                    {
                        maintenanceInfo.maintenanceFlags = MaintenanceFlags.RemoveSelected;
                        flag5 = true;
                    }
                    if (!flag5)
                    {
                        return;
                    }
                    flag2 = true;
                    if ((maintenanceInfo.maintenanceFlags & MaintenanceFlags.RestoreSelected) != MaintenanceFlags.ClearFlag)
                    {
                        strArray = new string[4]
                        {
                            "Rollback_Exception",
                            "Rollback_Completed",
                            "Rollback_Failed",
                            "Rollback_FailedMsg"
                        };
                        subscriptionState.SubscriptionStore.RollbackSubscription(subscriptionState);
                        flag2 = false;
                        userInterface.ShowMessage(Resources.GetString("UI_RollbackCompletedMsg"), Resources.GetString("UI_RollbackCompletedTitle"));
                    }
                    else if ((maintenanceInfo.maintenanceFlags & MaintenanceFlags.RemoveSelected) != MaintenanceFlags.ClearFlag)
                    {
                        strArray = new string[4]
                        {
                            "Uninstall_Exception",
                            "Uninstall_Completed",
                            "Uninstall_Failed",
                            "Uninstall_FailedMsg"
                        };
                        try
                        {
                            subscriptionState.SubscriptionStore.UninstallSubscription(subscriptionState);
                            flag2 = false;
                        }
                        catch (DeploymentException ex)
                        {
                            Logger.AddErrorInformation(Resources.GetString("MaintainLogMsg_UninstallFailed"), (Exception)ex);
                            flag3 = true;
                            ShellExposure.RemoveSubscriptionShellExposure(subscriptionState);
                            flag3 = false;
                        }
                    }
                    flag1 = true;
                }
                catch (DeploymentException ex)
                {
                    Logger.AddErrorInformation((Exception)ex, Resources.GetString(strArray[0]), new object[1]
                    {
                        (object)textualSubId
                    });
                    exception = (Exception)ex;
                }
                finally
                {
                    Logger.AddPhaseInformation(Resources.GetString(flag1 ? strArray[1] : strArray[2]), new object[1]
                    {
                        (object)textualSubId
                    });
                    if ((uint)(maintenanceInfo.maintenanceFlags & MaintenanceFlags.RestoreSelected) > 0U & flag2 || (maintenanceInfo.maintenanceFlags & MaintenanceFlags.RemoveSelected) != MaintenanceFlags.ClearFlag && flag3 & flag2)
                    {
                        string logFileLocation = Logger.GetLogFilePath();
                        if (!Logger.FlushCurrentThreadLogs())
                        {
                            logFileLocation = (string)null;
                        }
                        if (str != null && exception != null)
                        {
                            Exception innerMostException = this.GetInnerMostException(exception);
                            linkUrl = string.Format("{0}?outer={1}&&inner={2}&&msg={3}", new object[4]
                            {
                                (object)str,
                                (object)exception.GetType().ToString(),
                                (object)innerMostException.GetType().ToString(),
                                (object)innerMostException.Message
                            });
                            if (linkUrl.Length > 2048)
                            {
                                linkUrl = linkUrl.Substring(0, 2048);
                            }
                        }
                        userInterface.ShowError(Resources.GetString("UI_MaintenceErrorTitle"), Resources.GetString(strArray[3]), logFileLocation, linkUrl, linkUrlMessage);
                    }
                    Logger.EndCurrentThreadLogging();
                }
            }
        }
 public UserInterfaceModalResult ShowMaintenance(UserInterfaceInfo info, MaintenanceInfo maintenanceInfo)
 {
     this.WaitReady();
     ManualResetEvent event2 = new ManualResetEvent(false);
     MaintenancePiece piece = (MaintenancePiece) this._uiForm.Invoke(new UserInterfaceForm.ConstructMaintenancePieceDelegate(this._uiForm.ConstructMaintenancePiece), new object[] { info, maintenanceInfo, event2 });
     event2.WaitOne();
     return piece.ModalResult;
 }
Ejemplo n.º 7
0
 public MaintenancePiece ConstructMaintenancePiece(UserInterfaceInfo info, MaintenanceInfo maintenanceInfo, ManualResetEvent modalEvent)
 {
     return(new MaintenancePiece(this, info, maintenanceInfo, modalEvent));
 }
 public MaintenancePiece ConstructMaintenancePiece(UserInterfaceInfo info, MaintenanceInfo maintenanceInfo, ManualResetEvent modalEvent)
 {
     return new MaintenancePiece(this, info, maintenanceInfo, modalEvent);
 }
 private void MaintainSubscriptionInternal(string textualSubId)
 {
     bool flag = false;
     string[] strArray = new string[] { "Maintain_Exception", "Maintain_Completed", "Maintain_Failed", "Maintain_FailedMsg" };
     bool flag2 = false;
     Exception exception = null;
     bool flag3 = false;
     bool flag4 = false;
     string linkUrlMessage = Resources.GetString("ErrorMessage_GenericLinkUrlMessage");
     string linkUrl = null;
     string errorReportUrl = null;
     Logger.StartCurrentThreadLogging();
     Logger.SetTextualSubscriptionIdentity(textualSubId);
     using (UserInterface interface2 = new UserInterface())
     {
         MaintenanceInfo maintenanceInfo = new MaintenanceInfo();
         try
         {
             UserInterfaceInfo info = new UserInterfaceInfo();
             Logger.AddPhaseInformation(Resources.GetString("PhaseLog_StoreQueryForMaintenanceInfo"));
             SubscriptionState subscriptionState = this.GetSubscriptionState(textualSubId);
             try
             {
                 subscriptionState.SubscriptionStore.CheckInstalledAndShellVisible(subscriptionState);
                 if (subscriptionState.RollbackDeployment == null)
                 {
                     maintenanceInfo.maintenanceFlags |= MaintenanceFlags.RemoveSelected;
                 }
                 else
                 {
                     maintenanceInfo.maintenanceFlags |= MaintenanceFlags.RestorationPossible;
                     maintenanceInfo.maintenanceFlags |= MaintenanceFlags.RestoreSelected;
                 }
                 AssemblyManifest currentDeploymentManifest = subscriptionState.CurrentDeploymentManifest;
                 if ((currentDeploymentManifest != null) && (currentDeploymentManifest.Description != null))
                 {
                     errorReportUrl = currentDeploymentManifest.Description.ErrorReportUrl;
                 }
                 Description effectiveDescription = subscriptionState.EffectiveDescription;
                 info.productName = effectiveDescription.Product;
                 info.supportUrl = effectiveDescription.SupportUrl;
                 info.formTitle = string.Format(CultureInfo.CurrentUICulture, Resources.GetString("UI_MaintenanceTitle"), new object[] { info.productName });
                 flag3 = true;
             }
             catch (DeploymentException exception2)
             {
                 flag3 = false;
                 Logger.AddErrorInformation(Resources.GetString("MaintainLogMsg_FailedStoreLookup"), exception2);
                 maintenanceInfo.maintenanceFlags |= MaintenanceFlags.RemoveSelected;
             }
             catch (FormatException exception3)
             {
                 flag3 = false;
                 Logger.AddErrorInformation(Resources.GetString("MaintainLogMsg_FailedStoreLookup"), exception3);
                 maintenanceInfo.maintenanceFlags |= MaintenanceFlags.RemoveSelected;
             }
             bool flag5 = false;
             if (flag3)
             {
                 if (interface2.ShowMaintenance(info, maintenanceInfo) == UserInterfaceModalResult.Ok)
                 {
                     flag5 = true;
                 }
             }
             else
             {
                 maintenanceInfo.maintenanceFlags = MaintenanceFlags.RemoveSelected;
                 flag5 = true;
             }
             if (flag5)
             {
                 flag2 = true;
                 if ((maintenanceInfo.maintenanceFlags & MaintenanceFlags.RestoreSelected) != MaintenanceFlags.ClearFlag)
                 {
                     strArray = new string[] { "Rollback_Exception", "Rollback_Completed", "Rollback_Failed", "Rollback_FailedMsg" };
                     subscriptionState.SubscriptionStore.RollbackSubscription(subscriptionState);
                     flag2 = false;
                     interface2.ShowMessage(Resources.GetString("UI_RollbackCompletedMsg"), Resources.GetString("UI_RollbackCompletedTitle"));
                 }
                 else if ((maintenanceInfo.maintenanceFlags & MaintenanceFlags.RemoveSelected) != MaintenanceFlags.ClearFlag)
                 {
                     strArray = new string[] { "Uninstall_Exception", "Uninstall_Completed", "Uninstall_Failed", "Uninstall_FailedMsg" };
                     try
                     {
                         subscriptionState.SubscriptionStore.UninstallSubscription(subscriptionState);
                         flag2 = false;
                     }
                     catch (DeploymentException exception4)
                     {
                         Logger.AddErrorInformation(Resources.GetString("MaintainLogMsg_UninstallFailed"), exception4);
                         flag4 = true;
                         ShellExposure.RemoveSubscriptionShellExposure(subscriptionState);
                         flag4 = false;
                     }
                 }
                 flag = true;
             }
         }
         catch (DeploymentException exception5)
         {
             Logger.AddErrorInformation(exception5, Resources.GetString(strArray[0]), new object[] { textualSubId });
             exception = exception5;
         }
         finally
         {
             Logger.AddPhaseInformation(Resources.GetString(flag ? strArray[1] : strArray[2]), new object[] { textualSubId });
             if ((((maintenanceInfo.maintenanceFlags & MaintenanceFlags.RestoreSelected) != MaintenanceFlags.ClearFlag) && flag2) || ((((maintenanceInfo.maintenanceFlags & MaintenanceFlags.RemoveSelected) != MaintenanceFlags.ClearFlag) && flag4) && flag2))
             {
                 string logFilePath = Logger.GetLogFilePath();
                 if (!Logger.FlushCurrentThreadLogs())
                 {
                     logFilePath = null;
                 }
                 if ((errorReportUrl != null) && (exception != null))
                 {
                     Exception innerMostException = this.GetInnerMostException(exception);
                     linkUrl = string.Format("{0}?outer={1}&&inner={2}&&msg={3}", new object[] { errorReportUrl, exception.GetType().ToString(), innerMostException.GetType().ToString(), innerMostException.Message });
                     if (linkUrl.Length > 0x800)
                     {
                         linkUrl = linkUrl.Substring(0, 0x800);
                     }
                 }
                 interface2.ShowError(Resources.GetString("UI_MaintenceErrorTitle"), Resources.GetString(strArray[3]), logFilePath, linkUrl, linkUrlMessage);
             }
             Logger.EndCurrentThreadLogging();
         }
     }
 }