public override void OnInitialized() { var frame = new Frame(); Window.Current.Content = new ShellPage { Frame = frame }; Window.Current.Activate(); _nav = NavigationFactory .Create(frame, Guid.Empty.ToString()) .AttachGestures(Window.Current, Gesture.Back, Gesture.Forward, Gesture.Refresh); }
public override void OnInitialized() { var shell = (ShellPage)Container.Resolve(typeof(ShellPage)); var frame = shell.Frame = new Frame(); Window.Current.Content = shell; Window.Current.Activate(); _nav = NavigationFactory .Create(frame, Guid.Empty.ToString()) .AttachGestures(Window.Current, Gesture.Back, Gesture.Forward, Gesture.Refresh); }
public SignupPageViewModel(INavigationService navigationService, ISignupService signupService, IPageDialogService pageDialogService) : base(navigationService) { _signupService = signupService; _pageDialogService = pageDialogService; Title = "サインアップ"; Email = _signupService.Email; Name = _signupService.Name; Password = _signupService.Password; _signupService.Image.Value = "user.png"; _signupService.SignupCompletedNotifier .ObserveOn(SynchronizationContext.Current) .SelectMany(_ => { var navigation = NavigationFactory.Create <MainPageViewModel>() .Add(NavigationNameProvider.DefaultNavigationPageName) .Add <HomePageViewModel>(); return(NavigateAsync(navigation, noHistory: true)); }) .Subscribe() .AddTo(_disposables); _signupService.SignupErrorNotifier .ObserveOn(SynchronizationContext.Current) .Subscribe(_ => _pageDialogService.DisplayAlertAsync("エラー", "サインアップに失敗しました", "OK")) .AddTo(_disposables); _signupService.IsSigningUp .Skip(1) .Where(b => b) .ObserveOn(SynchronizationContext.Current) .SelectMany(_ => NavigateAsync <LoadingPageViewModel>()) .Subscribe() .AddTo(_disposables); _signupService.IsSigningUp .Skip(1) .Where(b => !b) .ObserveOn(SynchronizationContext.Current) .SelectMany(_ => GoBackAsync()) .Subscribe() .AddTo(_disposables); SignupCommand = _signupService.CanSignup .ToAsyncReactiveCommand() .AddTo(_disposables); SignupCommand.Subscribe(async() => await _signupService.Signup()); }
public NavViewEx() { DefaultStyleKey = typeof(NavigationView); if (win.ApplicationModel.DesignMode.DesignModeEnabled || win.ApplicationModel.DesignMode.DesignMode2Enabled) { return; } Content = _frame = new Frame(); _dispatcher = _frame.Dispatcher; _frame.Navigated += (s, e) => { if (TryFindItem(e.SourcePageType, e.Parameter, out var item)) { SetSelectedItem(item); } }; NavigationService = NavigationFactory .Create(_frame) .AttachGestures(Window.Current, Gesture.Back, Gesture.Forward, Gesture.Refresh); ItemInvoked += (s, e) => { SelectedItem = (e.IsSettingsInvoked) ? SettingsItem : Find(e.InvokedItem.ToString()); }; RegisterPropertyChangedCallback(IsPaneOpenProperty, (s, e) => { UpdateAppTitleVisibility(); UpdatePaneHeadersVisibility(); }); Window.Current.CoreWindow.SizeChanged += (s, e) => { UpdatePageHeaderContent(); }; Loaded += (s, e) => { UpdateAppTitleVisibility(); UpdatePaneHeadersVisibility(); UpdatePageHeaderContent(); SetupBackButton(); }; }
protected EmailLoginPageViewModel(INavigationService navigationService, IEmailLoginService emailLoginService, IPageDialogService pageDialogService) : base(navigationService) { _emailLoginService = emailLoginService; _pageDialogService = pageDialogService; Title = "ログイン"; Email = _emailLoginService.Email; Password = _emailLoginService.Password; _emailLoginService.LoginCompletedNotifier .ObserveOn(SynchronizationContext.Current) .SelectMany(_ => { var navigation = NavigationFactory.Create <MainPageViewModel>() .Add(NavigationNameProvider.DefaultNavigationPageName) .Add <HomePageViewModel>(); return(NavigateAsync(navigation, noHistory: true)); }) .Subscribe() .AddTo(_disposables); _emailLoginService.LoginErrorNotifier .ObserveOn(SynchronizationContext.Current) .Subscribe(_ => _pageDialogService.DisplayAlertAsync("エラー", "ログインに失敗しました", "OK")) .AddTo(_disposables); _emailLoginService.IsLoggingIn .Skip(1) .Where(b => b) .ObserveOn(SynchronizationContext.Current) .SelectMany(_ => NavigateAsync <LoadingPageViewModel>()) .Subscribe() .AddTo(_disposables); _emailLoginService.IsLoggingIn .Skip(1) .Where(b => !b) .ObserveOn(SynchronizationContext.Current) .SelectMany(_ => GoBackAsync()) .Subscribe() .AddTo(_disposables); LoginCommand = _emailLoginService.CanLogin .ToAsyncReactiveCommand() .AddTo(_disposables); LoginCommand.Subscribe(async() => await _emailLoginService.Login()); }
public LoginPageViewModel(INavigationService navigationService, IGoogleLoginService googleLoginService, IPageDialogService pageDialogService) : base(navigationService) { _googleLoginService = googleLoginService; _pageDialogService = pageDialogService; _googleLoginService.LoginCompletedNotifier .ObserveOn(SynchronizationContext.Current) .SelectMany(_ => { var navigation = NavigationFactory.Create <MainPageViewModel>() .Add(NavigationNameProvider.DefaultNavigationPageName) .Add <HomePageViewModel>(); return(NavigateAsync(navigation, noHistory: true)); }) .Subscribe() .AddTo(_disposables); _googleLoginService.LoginErrorNotifier .ObserveOn(SynchronizationContext.Current) .Subscribe(_ => _pageDialogService.DisplayAlertAsync("エラー", "ログインに失敗しました", "OK")) .AddTo(_disposables); _googleLoginService.IsLoggingIn .Skip(1) .Where(b => b) .ObserveOn(SynchronizationContext.Current) .SelectMany(_ => NavigateAsync <LoadingPageViewModel>()) .Subscribe() .AddTo(_disposables); _googleLoginService.IsLoggingIn .Skip(1) .Where(b => !b) .ObserveOn(SynchronizationContext.Current) .SelectMany(_ => GoBackAsync()) .Subscribe() .AddTo(_disposables); LoginWithGoogleCommand = _isIdle.ToAsyncReactiveCommand(); LoginWithGoogleCommand.Subscribe(async() => await _googleLoginService.Login()); LoginWithEmailCommand = _isIdle.ToAsyncReactiveCommand(); LoginWithEmailCommand.Subscribe(async() => await NavigateAsync <EmailLoginPageViewModel>()); SignupCommand = _isIdle.ToAsyncReactiveCommand(); SignupCommand.Subscribe(async() => await NavigateAsync <SignupPageViewModel>()); }
public override async Task OnStartAsync(IStartArgs args) { if (args.StartKind == StartKinds.Launch && args.Arguments is ILaunchActivatedEventArgs e && e != null) { var shell = new ShellPage(e.SplashScreen); Window.Current.Content = shell; Window.Current.Activate(); await Task.Delay(1000); var frame = shell.MainFrame; var nav = NavigationFactory.Create(frame) .AttachGestures(Window.Current, Gesture.Refresh); await nav.NavigateAsync(nameof(SettingsPage)); } }
public SplashScreenPageViewModel(INavigationService navigationService, IAccountService accountService) : base(navigationService) { _accountService = accountService; _accountService.IsInitialized .Where(b => b) .ObserveOn(SynchronizationContext.Current) .SelectMany(_ => { if (_accountService.IsLoggedIn.Value) { var navigation = NavigationFactory.Create <MainPageViewModel>() .Add(NavigationNameProvider.DefaultNavigationPageName) .Add <HomePageViewModel>(); return(NavigateAsync(navigation, noHistory: true)); } return(NavigateAsync <LoginPageViewModel>(wrapInNavigationPage: true, noHistory: true)); }) .Subscribe() .AddTo(_disposables); _accountService.Initialize(); }
public override void OnInitialized() { NavigationService = NavigationFactory.Create(Gesture.Back, Gesture.Forward, Gesture.Refresh); Window.Current.Content = NavigationService.GetXamlFrame(); Window.Current.Activate(); }
public ShellPage() { InitializeComponent(); _navManager = SystemNavigationManager.GetForCurrentView(); _settingsNavigationStr = "SettingPage?PivotItem=0"; string title = Windows.ApplicationModel.Package.Current.DisplayName; // determine and set if the app is started in debug mode Title = System.Diagnostics.Debugger.IsAttached ? "[Debug] " + title : title; // Hide default title bar. CoreApplicationViewTitleBar coreTitleBar = CoreApplication.GetCurrentView().TitleBar; coreTitleBar.IsVisibleChanged += CoreTitleBar_IsVisibleChanged; SetTitleBarAsDraggable(); // Register a handler for when the size of the overlaid caption control changes. // For example, when the app moves to a screen with a different DPI. coreTitleBar.LayoutMetricsChanged += CoreTitleBar_LayoutMetricsChanged; if (WindowDisplayInfo.GetForCurrentView() == WindowDisplayMode.FullScreenTabletMode) { AppTitleBar.Visibility = Visibility.Collapsed; } ShellViewInternal = ShellView; ShellView.Content = _frame = new Frame(); NavigationService = NavigationFactory.Create(_frame).AttachGestures(Window.Current, Gesture.Back, Gesture.Forward, Gesture.Refresh); SetupGestures(); SetupBackButton(); NavigationService.CanGoBackChanged += (s, args) => { //Backbutton setting if (SettingsService.Instance.UseHeaderBackButton) { _navManager.AppViewBackButtonVisibility = NavigationService.CanGoBack() ? AppViewBackButtonVisibility.Visible : AppViewBackButtonVisibility.Collapsed; } else { if (ShellView.IsBackEnabled != NavigationService.CanGoBack()) { ShellView.IsBackEnabled = NavigationService.CanGoBack(); if (ShellView.IsBackButtonVisible == NavigationViewBackButtonVisible.Collapsed) { ShellView.IsBackButtonVisible = NavigationViewBackButtonVisible.Auto; } } } }; _frame.Navigated += (s, e) => { if (TryFindItem(e.SourcePageType, e.Parameter, out object item)) { SetSelectedItem(item, false); // TODO test if nessasary if (item == null) { return; } } }; ShellView.ItemInvoked += (sender, args) => { SelectedItem = args.IsSettingsInvoked ? ShellView.SettingsItem : Find(args.InvokedItemContainer as NavigationViewItem); }; if (System.Diagnostics.Debugger.IsAttached) { Windows.UI.ViewManagement.ApplicationView.GetForCurrentView().IsScreenCaptureEnabled = true; } else { //prevent screenshot capture for the app Windows.UI.ViewManagement.ApplicationView.GetForCurrentView().IsScreenCaptureEnabled = false; } Loaded += ShellPage_Loaded; }