Пример #1
0
        private static LauncherErrorCode RunSingleInstance(bool shouldStartHidden)
        {
            try
            {
                // Only needed for Stride up to 2.x (and possibly 3.0): setup the StrideDir to make sure that it is passed to the underlying process (msbuild...etc.)
                Environment.SetEnvironmentVariable("SiliconStudioStrideDir", AppDomain.CurrentDomain.BaseDirectory);
                Environment.SetEnvironmentVariable("StrideDir", AppDomain.CurrentDomain.BaseDirectory);

                // We need to do that before starting recording metrics
                // TODO: we do not display Privacy Policy anymore from launcher, because it's either accepted from installer or shown again when a new version of GS with new Privacy Policy starts. Might want to reconsider that after the 2.0 free period
                PrivacyPolicyHelper.RestartApplication = SelfUpdater.RestartApplication;
                PrivacyPolicyHelper.EnsurePrivacyPolicyStride40();

                // Install Metrics for the launcher
                using (Metrics = new MetricsClient(CommonApps.StrideLauncherAppId))
                {
                    // HACK: force resolve the presentation assembly prior to initializing the app. This is to fix an issue with XAML themes.
                    // see issue PDX-2899
                    var txt = new Core.Presentation.Controls.TextBox();
                    GC.KeepAlive(txt); // prevent aggressive optimization from removing the line where we create the dummy TextBox.

                    var instance = new LauncherInstance();
                    return(instance.Run(shouldStartHidden));
                }
            }
            catch (Exception exception)
            {
                CrashReportHelper.HandleException(Dispatcher.CurrentDispatcher, exception);
                return(LauncherErrorCode.ErrorWhileRunningServer);
            }
        }
Пример #2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            SetTheme(Resource.Style.MainTheme);
            base.OnCreate(savedInstanceState);

            // Setup crash report
            //AppDomain.CurrentDomain.UnhandledException += (sender, args) =>
            //    CrashReportHelper.LogException(args.ExceptionObject as Exception);
            TaskScheduler.UnobservedTaskException += (_, args) =>
                                                     CrashReportHelper.LogException(args.Exception);
            AndroidEnvironment.UnhandledExceptionRaiser += (_, args) =>
                                                           CrashReportHelper.LogException(args.Exception);

            // Database
            SQLitePCL.Batteries_V2.Init();

            // Service
            deviceManager = new DeviceManager(this);

            // Components
            UserDialogs.Init(this);
            Rg.Plugins.Popup.Popup.Init(this);

            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            Xamarin.Forms.Forms.Init(this, savedInstanceState);

            // Boot
            LoadApplication(new App(new ComponentProvider(this)));
        }
Пример #3
0
        protected override async void OnStart()
        {
            var dialogs = resolver.Get <IApplicationDialog>();

            // Crash report
            await CrashReportHelper.ShowReport();

            // Permission
            while (await Permissions.IsPermissionRequired())
            {
                await Permissions.RequestPermissions();

                if (await Permissions.IsPermissionRequired())
                {
                    await dialogs.Information("Permission required.");
                }
            }

            // TODO Initialize

            // Navigate
            await navigator.ForwardAsync(ViewId.Menu);
        }