/// <summary> /// Adds the core navigation services to the <see cref="IServiceCollection"/>. /// </summary> /// <param name="services">Service collection.</param> /// <returns><see cref="IServiceCollection"/>.</returns> public static IServiceCollection AddNavigationCore(this IServiceCollection services) { //-:cnd:noEmit #if NETFRAMEWORK //+:cnd:noEmit services.AddSingleton <ISectionsNavigator>(s => new BlindSectionsNavigator("Home", "Posts", "Settings")); //-:cnd:noEmit #endif //+:cnd:noEmit return(services .AddSingleton <IStackNavigator>(s => new SectionsNavigatorToStackNavigatorAdapter(s.GetService <ISectionsNavigator>())) .AddSingleton <IBackButtonManager>(s => { var manager = new BackButtonManager(); var sectionsNavigator = s.GetRequiredService <ISectionsNavigator>(); manager.AddHandler(new BackButtonHandler( name: "DefaultSectionsNavigatorHandler", canHandle: () => sectionsNavigator.CanNavigateBackOrCloseModal(), handle: async ct => await sectionsNavigator.NavigateBackOrCloseModal(ct) )); return manager; })); }
protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); _backButtonManager = new BackButtonManager(Frame); ReceivedContent = e.Parameter?.ToString() ?? string.Empty; Bindings.Update(); }
public void BackButtonVisibleOnFirstPage() { var frame = App.Frame; BackButtonManager.RegisterFrame(frame); frame.Navigate(typeof(VisibleButtonPage)); SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility.ShouldBeEquivalentTo(AppViewBackButtonVisibility.Visible); }
public void BackButtonCollapsedOnSecondPage() { var frame = App.Frame; BackButtonManager.RegisterFrame(frame); frame.Navigate(typeof(UnsetButtonPage)); frame.Navigate(typeof(CollapsedButtonPage)); SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility.ShouldBeEquivalentTo(AppViewBackButtonVisibility.Collapsed); }
void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } }
private void Awake() { if (!instance) { instance = this; } else if (instance != this) { Destroy(gameObject); } DontDestroyOnLoad(gameObject); }
public void BackButtonCollapsedThenVisibleOnFirstPage() { var frame = App.Frame; BackButtonManager.RegisterFrame(frame); frame.Navigate(typeof(BindingButtonPage)); (frame.Content as BindingButtonPage).Vm.IsBackButtonEnabled = false; SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility.ShouldBeEquivalentTo(AppViewBackButtonVisibility.Collapsed); (frame.Content as BindingButtonPage).Vm.IsBackButtonEnabled = true; SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility.ShouldBeEquivalentTo(AppViewBackButtonVisibility.Visible); }
protected override void InitializeUi() { Frame rootFrame = Window.Current.Content as Frame; if (rootFrame == null) { rootFrame = new Frame(); } Window.Current.Content = rootFrame; Window.Current.Activate(); BackButtonManager.RegisterFrame(rootFrame, true, true, true); }
/// <summary> /// Invoked when the application is launched normally by the end user. Other entry points /// will be used such as when the application is launched to open a specific file. /// </summary> /// <param name="e">Details about the launch request and process.</param> protected override void OnLaunched(LaunchActivatedEventArgs e) { #if DEBUG if (System.Diagnostics.Debugger.IsAttached) { this.DebugSettings.EnableFrameRateCounter = true; } #endif Frame rootFrame = Window.Current.Content as Frame; // Do not repeat app initialization when the Window already has content, // just ensure that the window is active if (rootFrame == null) { // Create a Frame to act as the navigation context and navigate to the first page rootFrame = new Frame(); rootFrame.NavigationFailed += OnNavigationFailed; if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) { //TODO: Load state from previously suspended application } // Place the frame in the current Window Window.Current.Content = rootFrame; // Initialize BackKeyHelper BackButtonManager.RegisterFrame(rootFrame); } if (rootFrame.Content == null) { // When the navigation stack isn't restored navigate to the first page, // configuring the new page by passing required information as a navigation // parameter rootFrame.Navigate(typeof(MainPage), e.Arguments); } // Ensure the current window is active Window.Current.Activate(); }
/// <summary> /// Invoked when the application is launched normally by the end user. Other entry points /// will be used such as when the application is launched to open a specific file. /// </summary> /// <param name="e">Details about the launch request and process.</param> protected async override void OnLaunched(LaunchActivatedEventArgs e) { Frame rootFrame = Window.Current.Content as Frame; ViewModelLocator.Init(); // Do not repeat app initialization when the Window already has content, // just ensure that the window is active if (rootFrame == null) { // Create a Frame to act as the navigation context and navigate to the first page rootFrame = new Frame(); rootFrame.NavigationFailed += OnNavigationFailed; BackButtonManager.RegisterFrame(rootFrame, true, false, false); if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) { await ServiceLocator.Current.GetInstance <INavigationService>().RestoreApplicationStateAsync(); } else { ServiceLocator.Current.GetInstance <IStatePersistor>().ClearAllStates(); } // Place the frame in the current Window Window.Current.Content = rootFrame; } if (rootFrame.Content == null) { // When the navigation stack isn't restored navigate to the first page, // configuring the new page by passing required information as a navigation // parameter ServiceLocator.Current.GetInstance <INavigationService>().Navigate <MainViewModel>(); } // Ensure the current window is active Window.Current.Activate(); }
/// <summary> /// Invoked when the application is launched normally by the end user. Other entry points /// will be used such as when the application is launched to open a specific file. /// </summary> /// <param name="e">Details about the launch request and process.</param> protected override async void OnLaunched(LaunchActivatedEventArgs e) { #if DEBUG if (System.Diagnostics.Debugger.IsAttached) { this.DebugSettings.EnableFrameRateCounter = false; } #endif DispatcherHelper.Initialize(); if (TextSecurePreferences.getLocalNumber() == string.Empty) { Debug.WriteLine("Launching first launch experience"); OnFirstLaunched(e); return; } Debug.WriteLine("Launching..."); /*if (TextSecurePreferences.isPushRegistered() == true) * { * TaskHelper.getInstance().RegisterPushReceiver(); * * if (channel == null) * { * var response = await PushHelper.getInstance().OpenChannelAndUpload(); * channel = response.Channel; * } * * }*/ accountManager = TextSecureCommunicationFactory.createManager(); Worker = new TaskWorker(); Worker.Start(); //await DirectoryHelper.refreshDirectory(); // var task = new EchoActivity("ASDFFDSA"); var websocketTask = new WebsocketTask(); Task.Factory.StartNew(() => { try { var messageReceiver = TextSecureCommunicationFactory.createReceiver(); var pipe = messageReceiver.createMessagePipe(); pipe.MessageReceived += OnMessageRecevied; } catch (Exception ex) { Debug.WriteLine("Failed asd:" + ex.Message); } }); //Worker.AddTaskActivities(websocketTask); /*if (rootFrame.Content == null) * { * // When the navigation stack isn't restored navigate to the first page, * // configuring the new page by passing required information as a navigation * // parameter * rootFrame.Navigate(typeof(MainPage), e.Arguments); * }*/ // Ensure the current window is active Frame rootFrame = Window.Current.Content as Frame; _frame = rootFrame; if (rootFrame == null) { rootFrame = new Frame(); } rootFrame.Navigate(typeof(ExtendedSplash), e.Arguments); Window.Current.Content = rootFrame; Window.Current.Activate(); BackButtonManager.RegisterFrame(rootFrame, true, true, true); }
protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); _backButtonManager = new BackButtonManager(Frame); }