示例#1
0
        /// <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);
        }
示例#2
0
        /// <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();
        }
示例#3
0
        /// <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();
            }
        }
示例#4
0
        /// <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();
        }