示例#1
0
        public async void OnSettings(object sender, EventArgs e)
        {
            viewModel.ShowInputControl = false;

            var settingsView = new SettingsView(App.Instance);
            await Navigation.PushModalAsync(settingsView);

            var urlChanged = await settingsView.ShowDialog();

            if (urlChanged)
            {
                await App.Instance.ResetAsync();

                this.Dispose();
            }
        }
示例#2
0
        internal async Task InitMobileService(bool showSettingsPage, bool showLoginDialog)
        {
            if (showSettingsPage) {
                var settingsView = new SettingsView(this);
                await MainPage.Navigation.PushModalAsync(settingsView);
                await settingsView.ShowDialog();
            }

            var authHandler = new AuthHandler();
            MobileService = 
                new MobileServiceClient(Settings.Current.MobileAppUrl, new LoggingHandler(true), authHandler);

            authHandler.Client = MobileService;
            AuthenticatedUser = MobileService.CurrentUser;

            await InitLocalStoreAsync(LocalDbFilename);
            InitLocalTables();

            IPlatform platform = DependencyService.Get<IPlatform>();
            DataFilesPath = await platform.GetDataFilesPath();

#if __DROID__ && PUSH
            Droid.GcmService.RegisterWithMobilePushNotifications();
#elif __IOS__ && PUSH
           iOS.AppDelegate.IsAfterLogin = true;
           await iOS.AppDelegate.RegisterWithMobilePushNotifications();
#elif __WP__ && PUSH
           ContosoMoments.WinPhone.App.AcquirePushChannel(App.Instance.MobileService);
#endif

            if (showLoginDialog) {
                await Utils.PopulateDefaultsAsync();

                await DoLoginAsync();

                Debug.WriteLine("*** DoLoginAsync complete");

                MainPage = new NavigationPage(new AlbumsListView());
            }
            else {
                // user has already chosen an authentication type, so re-authenticate
                await AuthHandler.DoLoginAsync(Settings.Current.AuthenticationType);

                MainPage = new NavigationPage(new AlbumsListView());
            }
        }
        public async void OnSettings(object sender, EventArgs e)
        {
            viewModel.ShowInputControl = false;

            var settingsView = new SettingsView(App.Instance);
            await Navigation.PushModalAsync(settingsView);
            var urlChanged = await settingsView.ShowDialog();

            if (urlChanged) {
                await App.Instance.ResetAsync();
                this.Dispose(); 
            }
        }