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();
     }));
 }