public static void StartAsync()
 {
     AndroidService.androidThread = new Thread((ThreadStart)(() =>
     {
         if (!Utils.CheckIfAndroidBstkExistAndValid(Strings.CurrentDefaultVmName))
         {
             Utils.CreateBstkFileFromPrev(MultiInstanceStrings.VmName);
         }
         ServiceManager.StartService(Strings.BlueStacksDriverName, true);
         ServiceHelper.FindAndSyncConfig();
         MonitorLocator.Publish(Strings.CurrentDefaultVmName, (uint)Process.GetCurrentProcess().Id);
         AndroidService.mAndroidService = new AndroidService(true, Strings.CurrentDefaultVmName);
         ThreadPool.QueueUserWorkItem((WaitCallback)(stateInfo =>
         {
             AndroidService.HDQuitEvent = new EventWaitHandle(false, EventResetMode.AutoReset, string.Format("HD-Plus-{0}", (object)Process.GetCurrentProcess().Id));
             AndroidService.HDQuitEvent.WaitOne();
             AndroidService.mAndroidService.OnStop();
         }));
         AndroidService.mAndroidService.RunDebug();
     }))
     {
         IsBackground = true
     };
     AndroidService.androidThread.Start();
 }
        private static void SetupAndRunApplication(Opt opt)
        {
            Program.CheckIfAlreadyRunning(Opt.Instance.h);
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            if (!VMWindow.CheckAndroidFilesIntegrity())
            {
                Logger.Error("Android File Integrity check failed");
                Environment.Exit(-2);
            }
            TimelineStatsSender.HandleEngineBootEvent(EngineStatsEvent.android_file_integrity_passed.ToString());
            InputMapper.RegisterGuestBootLogsHandler();
            AndroidService.StartAsync();
            HTTPHandler.StartServer();
            Program.InitAudioLogger(Logger.GetHdLoggerCallback());
            VMWindow vmWindow = new VMWindow(opt.h, opt.w);

            Application.Run();
        }