public async void GetGameProcess(AppActivationResult v)
        {
            await Task.Run(() =>
            {
                try
                {
                    var result = v.AppResourceGroupInfo.GetProcessDiagnosticInfos();
                    if (result != null && result.Count > 0)
                    {
                        var ProcessId = (int)result.First().ProcessId;
                        var Process = System.Diagnostics.Process.GetProcessById(ProcessId);

                        ViewModels.LauncherModel.Default.IsGameRunning = true;
                        GameProcess = Process;
                        Process.EnableRaisingEvents = true;
                        Process.Exited += GameProcessExited;
                    }
                }
                catch (Exception ex)
                {
                    Debug.WriteLine(ex);
                    throw ex;
                }



            });
        }
 private async Task<bool> LaunchGame(MCVersion v, bool KeepLauncherOpen)
 {
     try
     {
         ViewModels.LauncherModel.Default.CurrentState = ViewModels.LauncherModel.StateChange.isLaunching;
         var pkg = await AppDiagnosticInfo.RequestInfoForPackageAsync(MINECRAFT_PACKAGE_FAMILY);
         AppActivationResult activationResult = null;
         if (pkg.Count > 0) activationResult = await pkg[0].LaunchAsync();
         System.Diagnostics.Debug.WriteLine("App launch finished!");
         if (KeepLauncherOpen && activationResult != null) GetGameProcess(activationResult);
         if (KeepLauncherOpen == false)
         {
             await Application.Current.Dispatcher.InvokeAsync(() =>
             {
                 Application.Current.MainWindow.Close();
             });
             return true;
         }
         else
         {
             ViewModels.LauncherModel.Default.CurrentState = ViewModels.LauncherModel.StateChange.None;
             return false;
         }
     }
     catch (Exception e)
     {
         ViewModels.LauncherModel.Default.CurrentState = ViewModels.LauncherModel.StateChange.None;
         System.Diagnostics.Debug.WriteLine("App launch failed:\n" + e.ToString());
         ErrorScreenShow.errormsg("Error_AppLaunchFailed_Title", "Error_AppLaunchFailed", e);
         throw e;
     }
 }