示例#1
0
        protected override async void OnInitialized()
        {
            InitializeComponent();

            LoggerService = Container.Resolve <ILoggerService>();
            LoggerService.StartMethod();
            LogFileService = Container.Resolve <ILogFileService>();
            LogFileService.AddSkipBackupAttribute();

            // Local Notification tap event listener
            //NotificationCenter.Current.NotificationTapped += OnNotificationTapped;
            LogUnobservedTaskExceptions();

            INavigationResult result = await NavigationService.NavigateAsync("/" + nameof(SplashPage));

            if (!result.Success)
            {
                LoggerService.Info($"Failed transition.");

                MainPage = new ExceptionPage
                {
                    BindingContext = new ExceptionPageViewModel()
                    {
                        Message = result.Exception.Message
                    }
                };
                System.Diagnostics.Debugger.Break();
            }

            LoggerService.EndMethod();
        }
示例#2
0
        protected override async void OnInitialized()
        {
            InitializeComponent();

            LoggerService = Container.Resolve <ILoggerService>();
            LoggerService.StartMethod();
            LogFileService = Container.Resolve <ILogFileService>();
            LogFileService.AddSkipBackupAttribute();

#if USE_MOCK
            // For debug mode, set the mock api provider to interact
            // with some fake data
            Xamarin.ExposureNotifications.ExposureNotification.OverrideNativeImplementation(new Services.TestNativeImplementation());
#endif
            Xamarin.ExposureNotifications.ExposureNotification.Init();

            // var enabled = await Xamarin.ExposureNotifications.ExposureNotification.IsEnabledAsync();
            // App.LoggerService.Info($"IsEnabledAsync is {enabled}");

            // Local Notification tap event listener
            //NotificationCenter.Current.NotificationTapped += OnNotificationTapped;
            LogUnobservedTaskExceptions();

            INavigationResult result = await NavigationService.NavigateAsync("/" + nameof(SplashPage));

            if (!result.Success)
            {
                LoggerService.Info($"Failed transition.");

                MainPage = new ExceptionPage
                {
                    BindingContext = new ExceptionPageViewModel()
                    {
                        Message = result.Exception.Message
                    }
                };
                System.Diagnostics.Debugger.Break();
            }

            LoggerService.EndMethod();
        }
示例#3
0
        protected override async void OnInitialized()
        {
            InitializeComponent();

            LoggerService = Container.Resolve <ILoggerService>();
            LoggerService.StartMethod();
            LogFileService = Container.Resolve <ILogFileService>();
            LogFileService.AddSkipBackupAttribute();

#if USE_MOCK
            // For debug mode, set the mock api provider to interact
            // with some fake data
            Xamarin.ExposureNotifications.ExposureNotification.OverrideNativeImplementation(new Services.TestNativeImplementation());
#endif
            Xamarin.ExposureNotifications.ExposureNotification.Init();

            // Local Notification tap event listener
            //NotificationCenter.Current.NotificationTapped += OnNotificationTapped;
            LogUnobservedTaskExceptions();

            INavigationResult result;
            // Check user data and skip tutorial
            IUserDataService userDataService = Container.Resolve <IUserDataService>();

            if (userDataService.IsExistUserData)
            {
                LoggerService.Info("User data exists");
                var userData = userDataService.Get();
                LoggerService.Info($"userData.IsOptined: {userData.IsOptined}");
                LoggerService.Info($"userData.IsPolicyAccepted: {userData.IsPolicyAccepted}");
                if (userData.IsOptined && userData.IsPolicyAccepted)
                {
                    LoggerService.Info($"Transition to SplashPage");
                    result = await NavigationService.NavigateAsync("/" + nameof(SplashPage));
                }
                else
                {
                    LoggerService.Info($"Transition to TutorialPage1");
                    result = await NavigationService.NavigateAsync("/" + nameof(TutorialPage1));
                }
            }
            else
            {
                LoggerService.Info("No user data exists");
                LoggerService.Info($"Transition to TutorialPage1");
                result = await NavigationService.NavigateAsync("/" + nameof(TutorialPage1));
            }

            if (!result.Success)
            {
                LoggerService.Info($"Failed transition.");

                MainPage = new ExceptionPage
                {
                    BindingContext = new ExceptionPageViewModel()
                    {
                        Message = result.Exception.Message
                    }
                };
                System.Diagnostics.Debugger.Break();
            }

            LoggerService.EndMethod();
        }