public static void GuestBootCompletedEvent(object sender, EventArgs e)
 {
     if (AndroidBootUp.sHasNotifiedClientForGuestBooted)
     {
         return;
     }
     lock (AndroidBootUp.sSendBootCompleteLockObject)
     {
         if (AndroidBootUp.sHasNotifiedClientForGuestBooted)
         {
             return;
         }
         try
         {
             Logger.Info("BOOT_STAGE: Sending boot completed event");
             AndroidBootUp.sHasNotifiedClientForGuestBooted = true;
             try
             {
                 if (!Opt.Instance.sysPrep)
                 {
                     if (Oem.Instance.IsSendGameManagerRequest)
                     {
                         HTTPUtils.SendRequestToClientAsync("guestBootCompleted", (Dictionary <string, string>)null, MultiInstanceStrings.VmName, 0, (Dictionary <string, string>)null, false, 1, 0, "bgp");
                     }
                 }
             }
             catch (Exception ex)
             {
                 Logger.Error("An exception in sending boot completed request to client: {0}", (object)ex.ToString());
             }
             if (LoadingScreen.mLoadingScreen != null)
             {
                 LoadingScreen.RemoveLoadingScreen();
             }
             AndroidBootUp.isAndroidBooted      = true;
             StateMachine.mForceShutdownDueTime = 60000;
             Stats.SendFrontendStatusUpdate("frontend-ready", MultiInstanceStrings.VmName);
             AndroidBootUp.SendSecurityMessageToAndroidOnBootFinish();
             if (AndroidBootUp.HideBootProgress())
             {
                 AndroidBootUp.ShowConnectedView();
                 AndroidBootUp.PerformDeferredSetup();
                 AndroidBootUp.CheckVtxAndShowPopup();
             }
             UIHelper.RunOnUIThread((Control)VMWindow.Instance, (UIHelper.Action)(() =>
             {
                 --VMWindow.Instance.Width;
                 ++VMWindow.Instance.Width;
             }));
             Utils.SyncAppJson(MultiInstanceStrings.VmName);
         }
         catch (Exception ex)
         {
             Logger.Error("Exception on GuestBootCompletedEvent. Err : " + ex.ToString());
         }
     }
 }
 private static void AttachMonitor()
 {
     UIHelper.RunOnUIThread((Control)VMWindow.Instance, (UIHelper.Action)(() =>
     {
         if (AndroidBootUp.mManager != null)
         {
             throw new SystemException("A connection to the manager is already open");
         }
         if (AndroidBootUp.mMonitor != null)
         {
             throw new SystemException("Another monitor is already attached");
         }
         uint id          = MonitorLocator.Lookup(MultiInstanceStrings.VmName);
         Manager manager  = (Manager)null;
         Monitor monitor1 = (Monitor)null;
         bool verbose     = false;
         try
         {
             verbose = AndroidBootUp.mFirstMonitorAttachAttempt;
             AndroidBootUp.mFirstMonitorAttachAttempt = false;
             manager  = Manager.Open();
             monitor1 = manager.Attach(id, verbose, false);
         }
         catch (Exception ex)
         {
             if (!AndroidBootUp.IsExceptionFileNotFound(ex))
             {
                 Logger.Error(ex.ToString());
             }
             if (manager != null)
             {
                 manager = (Manager)null;
             }
         }
         if (monitor1 == null)
         {
             return;
         }
         Monitor monitor2 = manager.Attach(id, verbose, true);
         if (monitor2 == null)
         {
             Logger.Info("Could not Attach to a monitor");
         }
         AndroidBootUp.forceVideoModeChange = true;
         AndroidBootUp.mMonitor             = monitor2;
         AndroidBootUp.mManager             = manager;
         if (AndroidBootUp.HideBootProgress())
         {
             return;
         }
         AndroidBootUp.ShowConnectedView();
     }));
 }