예제 #1
0
파일: App.cs 프로젝트: TellOP/APP
        /// <summary>
        /// Initializes a new instance of the <see cref="App"/> class.
        /// </summary>
        public App()
        {
            // Localize the app.
            LocalizationUtils = DependencyService.Get <ILocalize>();
            if (Device.OS != TargetPlatform.WinPhone)
            {
                LocalizationUtils.SetLocale();
            }

            // Set the certificate verifier
            DependencyService.Get <ICertificateVerifier>().SetCertificateVerifier();

            // Automatically mark all unobserved task exceptions as observed after logging them.
            // TODO: this is a temporary fix put in place until more extensive investigation reveals why some
            // INotifyTaskCompletion exceptions are not caught by NotifyTaskCompletion (maybe because they are inside
            // inner tasks?)
            TaskScheduler.UnobservedTaskException += (sender, args) =>
            {
                foreach (Exception ex in args.Exception.InnerExceptions)
                {
                    Tools.Logger.Log(sender.GetType().ToString(), "Unhandled task exception", ex);
                }

                args.SetObserved();
            };

            // Show the main page
            loginPage     = new NavigationPage(new Login());
            this.MainPage = loginPage;
        }
예제 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="App"/> class.
        /// </summary>
        public App()
        {
            // Localize the app.
            LocalizationUtils = DependencyService.Get <ILocalize>();
            if (Device.OS != TargetPlatform.WinPhone)
            {
                LocalizationUtils.SetLocale();
            }

            // Set the certificate verifier
            DependencyService.Get <ICertificateVerifier>().SetCertificateVerifier();

            // Show the main page
            loginPage     = new NavigationPage(new Login());
            this.MainPage = loginPage;
        }