/// <summary> /// Add Settings button to the toolbar. /// </summary> protected virtual void SetToolbarItems() { // Add Settings ToolbarItem settings = new ToolbarItem() { Text = AppResources.Settings }; if (Device.OS == TargetPlatform.iOS) { settings.Order = ToolbarItemOrder.Primary; settings.Icon = "settings.png"; } else { settings.Order = ToolbarItemOrder.Secondary; } settings.Clicked += async(sender, args) => { BaseApp app = (BaseApp)Application.Current; await this.Navigation.PushAsync(app.GetSettingsPage()); }; this.ToolbarItems.Add(settings); }
/// <summary> /// Log out event handler /// </summary> /// <param name="sender"></param> /// <param name="eventArgs"></param> private void ViewModel_OnLogOutCompleted(object sender, EventArgs eventArgs) { // Need to make this page the only one on the stack, so back button exits BaseApp app = (BaseApp)Application.Current; app.switchToSettingsPage(); }
/// <summary> /// After LogIn finished correctly go back to main page. /// </summary> /// <param name="sender"></param> /// <param name="eventArgs"></param> private void ViewModel_OnLogInCompleted(object sender, EventArgs eventArgs) { MessagingCenter.Send <Page>(this, Message.RefreshMainPage); if (this.Navigation.NavigationStack.Count == 1) { // This is the only page on the stack, so transition to main page BaseApp app = (BaseApp)Application.Current; app.switchToMainPage(); } }
/// <summary> /// Register ServiceUrlMissingHandler and call CreateContent. /// </summary> protected virtual void Initialize() { Authentication.Current.RegisterServiceUrlMissingHandler(() => { BaseApp app = (BaseApp)Application.Current; app.switchToSettingsPage(); return(Task.FromResult(true)); }); this.SetBindingContext(); this.CreateContent(); }