Ejemplo n.º 1
0
        private void OnItemClick(object sender, ItemClickEventArgs e)
        {
            if (e.ClickedItem is ISessionService session)
            {
                if (session.IsActive)
                {
                    return;
                }

                Switch(session);
            }
            else if (e.ClickedItem is RootDestination destination)
            {
                if (destination == RootDestination.AddAccount)
                {
                    Switch(_lifetime.Create());
                }
                else if (_navigationService?.Frame?.Content is IRootContentPage content)
                {
                    content.NavigationView_ItemClick(destination);
                }
            }

            Navigation.IsPaneOpen = false;

            var scroll = NavigationViewList.GetScrollViewer();

            if (scroll != null)
            {
                scroll.ChangeView(null, 0, null, true);
            }
        }
Ejemplo n.º 2
0
        private async void OnItemClick(object sender, ItemClickEventArgs e)
        {
            if (e.ClickedItem is ISessionService session)
            {
                if (session.IsActive)
                {
                    return;
                }

                Switch(session);
            }
            else if (e.ClickedItem is RootDestination destination)
            {
                if (destination == RootDestination.AddAccount)
                {
#if DEBUG
                    var dialog = new MessagePopup();
                    dialog.Title               = "Environment";
                    dialog.Message             = "Choose your environment";
                    dialog.PrimaryButtonText   = "Live";
                    dialog.SecondaryButtonText = "Test";
                    dialog.CloseButtonText     = "Cancel";

                    var confirm = await dialog.ShowQueuedAsync();

                    if (confirm == ContentDialogResult.None)
                    {
                        return;
                    }

                    Switch(_lifetime.Create(test: confirm == ContentDialogResult.Secondary));
#else
                    Switch(_lifetime.Create());
#endif
                }
                else if (_navigationService?.Frame?.Content is IRootContentPage content)
                {
                    content.NavigationView_ItemClick(destination);
                }
            }

            Navigation.IsPaneOpen = false;

            var scroll = NavigationViewList.GetScrollViewer();
            if (scroll != null)
            {
                scroll.ChangeView(null, 0, null, true);
            }
        }