public bool LogIn(Windows.UI.Xaml.Controls.WebView webView, Windows.UI.Xaml.Controls.Frame parentFrame) { var uri = driveLink.GetStartUri(); webView.Navigate(uri); webView.NavigationCompleted += (s, e) => { if (driveLink.CheckRedirectUrl(e.Uri.AbsoluteUri)) { driveLink.ContinueGetTokens(e.Uri); var dialog = new Windows.UI.Popups.MessageDialog("You are authenticated!", "Success!"); dialog.ShowAsync(); parentFrame.GoBack(); } }; webView.NavigationFailed += (s, e) => { driveLink.ContinueGetTokens(null); var dialog = new Windows.UI.Popups.MessageDialog("There problems authenticating you. Please try again :(", "Fail!"); dialog.ShowAsync(); parentFrame.GoBack(); }; return(true); }
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; if (rootFrame == null) { rootFrame = new Frame(); rootFrame.NavigationFailed += OnNavigationFailed; #region XamSvg init //Tells XamSvg in which assembly to search for svg when "res:" is used //XamSvg.Shared.Config.ResourceAssemblies = new List<Assembly> { typeof(App).GetTypeInfo().Assembly }; XamSvg.Shared.Config.ResourceAssembly = typeof(App).GetTypeInfo().Assembly; #endregion Xamarin.Forms.Forms.Init(e); Window.Current.Content = rootFrame; } if (rootFrame.Content == null) { rootFrame.Navigate(typeof(MainPage), e.Arguments); } Window.Current.Activate(); }
private async void CancelFunc() { if (!_ringContentVisibility) { using (var db = new PrototypingContext()) { User user = db.Users.Single(u => u.UserId == userId); Record record = db.Records.Last(); db.Entry(user).Reference(u => u.Prototype).Load(); try { StorageFolder prototypeFolder = await ApplicationData.Current.LocalFolder.GetFolderAsync(user.Prototype.Name + "_" + user.PrototypeId); StorageFolder userFolder = await prototypeFolder.GetFolderAsync(user.Name + "_" + user.UserId); StorageFolder recordFolder = await userFolder.GetFolderAsync("Record_" + recordSettings.RecordId); await recordFolder.DeleteAsync(); } catch (System.IO.FileNotFoundException) { } db.Records.Remove(record); db.SaveChanges(); } Windows.UI.Xaml.Controls.Frame frame = (Windows.UI.Xaml.Controls.Frame)Windows.UI.Xaml.Window.Current.Content; frame.BackStack.Clear(); frame.Navigate(typeof(DetailsUserPage), userId); } }
/// <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) { var 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; Forms.Init(e); // requires the `e` parameter if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) { //TODO: Load state from previously suspended application } // Place the frame in the current Window Window.Current.Content = rootFrame; } if (e.PrelaunchActivated == false) { if (rootFrame.Content == null) { 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 override void OnLaunched(LaunchActivatedEventArgs e) { // Do not repeat app initialization when the Window already has content, // just ensure that the window is active if (!(Window.Current.Content is Frame rootFrame)) { // Create a Frame to act as the navigation context and navigate to the first page rootFrame = new Frame(); rootFrame.NavigationFailed += OnNavigationFailed; var assembliesToInclude = new List <Assembly> { typeof(CachedImage).GetTypeInfo().Assembly, typeof(CachedImageRenderer).GetTypeInfo().Assembly, typeof(ContactManager).GetTypeInfo().Assembly }; Forms.Init(e, assembliesToInclude); if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) { //TODO: Load state from previously suspended application } // Place the frame in the current Window Window.Current.Content = rootFrame; } if (rootFrame.Content == null) { rootFrame.Navigate(typeof(MainPage), e.Arguments); } // Ensure the current window is active Window.Current.Activate(); }
protected override void OnLaunched(LaunchActivatedEventArgs e) { var rootFrame = Window.Current.Content as Frame; if (rootFrame == null) { rootFrame = new Frame(); rootFrame.NavigationFailed += this.OnNavigationFailed; Rg.Plugins.Popup.Popup.Init(); Forms.SetFlags( "SwipeView_Experimental", "Expander_Experimental" ); Forms.Init(e); Window.Current.Content = rootFrame; } if (rootFrame.Content == null) { rootFrame.Navigate(typeof(MainPage), e.Arguments); } Window.Current.Activate(); }
public UwpHalProxy(object context, Windows.UI.Xaml.Controls.Frame act) { this.appContext = context; this.activity = act; //AndroidHalProxy.swipeRecognizer = new DroidSwipeGestureRecognizer(context); try { this.logPath = Path.Combine(appData.Path, "log.txt"); } catch { doLog = false; } Clipboard.ContentChanged += async(s, e) => { DataPackageView dataPackageView = Clipboard.GetContent(); if (dataPackageView.Contains(StandardDataFormats.Text)) { string text = await dataPackageView.GetTextAsync(); // To output the text from this example, you need a TextBlock control this.clipBoardText = text.Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries).ToList(); } }; }
protected override void Dispose(bool disposing) { try { if (disposing) { if (frame != null) { frame.NavigationFailed -= Frame_NavigationFailed; frame.Navigated -= Frame_Navigated; frame.Navigating -= Frame_Navigating; frame.NavigationStopped -= Frame_NavigationStopped; frame = null; } if (authenticator != null) { authenticator.Completed -= Authenticator_Completed; authenticator.Error -= Authenticator_Error; authenticator = null; } } } catch (Exception ex) { throw new Xamarin.Auth.AuthException("UWP Dispose"); } base.Dispose(disposing); }
protected override void OnLaunched(LaunchActivatedEventArgs e) { // Do not repeat app initialization when the Window already has content, // just ensure that the window is active if (!(Window.Current.Content is Windows.UI.Xaml.Controls.Frame rootFrame)) { // Create a Frame to act as the navigation context and navigate to the first page rootFrame = new Windows.UI.Xaml.Controls.Frame(); rootFrame.NavigationFailed += OnNavigationFailed; Forms.SetFlags("Shell_UWP_Experimental", "AppTheme_Experimental"); Forms.Init(e); if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) { //TODO: Load state from previously suspended application } // Place the frame in the current Window Window.Current.Content = rootFrame; } if (rootFrame.Content == null) { rootFrame.Navigate(typeof(MainPage), e.Arguments); } // Ensure the current window is active Window.Current.Activate(); }
protected override void OnLaunched(LaunchActivatedEventArgs e) { var rootFrame = Window.Current.Content as Windows.UI.Xaml.Controls.Frame; if (rootFrame == null) { rootFrame = new Windows.UI.Xaml.Controls.Frame(); rootFrame.NavigationFailed += OnNavigationFailed; Forms.Init(e); if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) { //TODO: Load state from previously suspended application } Window.Current.Content = rootFrame; } if (rootFrame.Content == null) { rootFrame.Navigate(typeof(MainPage), e.Arguments); } Window.Current.Activate(); }
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; if (rootFrame == null) { rootFrame = new Frame(); rootFrame.NavigationFailed += OnNavigationFailed; #region XamSvg init //Initialize xamsvg for forms XamSvg.XamForms.Uw.SvgImageRenderer.InitializeForms(); //Tells XamSvg in which assembly to search for svg when "res:" is used //XamSvg.Shared.Config.ResourceAssemblies = new List<Assembly> { typeof(App).GetTypeInfo().Assembly }; XamSvg.Shared.Config.ResourceAssembly = typeof(App).GetTypeInfo().Assembly; XamSvg.Shared.Config.NativeLogger = new SvgLogger(); #endregion Xamarin.Forms.Forms.Init(e); Window.Current.Content = rootFrame; } if (rootFrame.Content == null) rootFrame.Navigate(typeof(MainPage), e.Arguments); 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 void OnLaunched(LaunchActivatedEventArgs e) { // Do not repeat app initialization when the Window already has content, // just ensure that the window is active if (!(Window.Current.Content is Frame rootFrame)) { // Create a Frame to act as the navigation context and navigate to the first page rootFrame = new Frame(); rootFrame.NavigationFailed += OnNavigationFailed; Forms.Init(e); if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) { //TODO: Load state from previously suspended application } // 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 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 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; var otherAssemblies = new[] { typeof(MR.Gestures.ContentPage).GetTypeInfo().Assembly, typeof(MR.Gestures.UWP.Renderers.PageRenderer).GetTypeInfo().Assembly, }; Xamarin.Forms.Forms.Init(e, otherAssemblies); // TODO:Replace this licence key by your own MR GESTURES licence key. // This licence key will only work, if your app is called "GestureSample". // We use the Test-LicenceKey from the MR GESTURES SAMPLE APP (https://github.com/MichaelRumpler/GestureSample). // Details, see: http://www.mrgestures.com/ MR.Gestures.UWP.Settings.LicenseKey = "ALZ9-BPVU-XQ35-CEBG-5ZRR-URJQ-ED5U-TSY8-6THP-3GVU-JW8Z-RZGE-CQW6"; if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) { //TODO: Load state from previously suspended application } // 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 rootFrame.Navigate(typeof(MainPage), e.Arguments); } // Ensure the current window is active Window.Current.Activate(); var windowsDeviceService = new WindowsDeviceService() { DeviceWidth = Window.Current.Bounds.Width, DeviceHeight = Window.Current.Bounds.Height }; SimpleIoc.Default.Register <IDeviceService>(() => windowsDeviceService, true); }
/// <summary> /// Invoked when the application is launched normally by the end user. Other entry points /// will be used when the application is launched to open a specific file, to display /// search results, and so forth. /// </summary> /// <param name="e">Details about the launch request and process.</param> protected override void OnLaunched(LaunchActivatedEventArgs e) { #if DEBUG if (Debugger.IsAttached) { DebugSettings.EnableFrameRateCounter = true; } #endif var 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(); // TODO: change this value to a cache size that is appropriate for your application rootFrame.CacheSize = 1; Forms.Init(e); if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) { // TODO: Load state from previously suspended application } // Place the frame in the current Window Window.Current.Content = rootFrame; } if (rootFrame.Content == null) { // Removes the turnstile navigation for startup. if (rootFrame.ContentTransitions != null) { transitions = new TransitionCollection(); foreach (var c in rootFrame.ContentTransitions) { transitions.Add(c); } } rootFrame.ContentTransitions = null; rootFrame.Navigated += RootFrame_FirstNavigated; // When the navigation stack isn't restored navigate to the first page, // configuring the new page by passing required information as a navigation // parameter if (!rootFrame.Navigate(typeof(MainPage), e.Arguments)) { throw new Exception("Failed to create initial page"); } } // 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 when the application is launched to open a specific file, to display /// search results, and so forth. /// </summary> /// <param name="e">Details about the launch request and process.</param> protected override void OnLaunched(LaunchActivatedEventArgs e) { #if DEBUG if (Debugger.IsAttached) { DebugSettings.EnableFrameRateCounter = true; } #endif var 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(); // TODO: change this value to a cache size that is appropriate for your application rootFrame.CacheSize = 1; Forms.Init(e); if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) { // TODO: Load state from previously suspended application } // Place the frame in the current Window Window.Current.Content = rootFrame; } if (rootFrame.Content == null) { // Removes the turnstile navigation for startup. if (rootFrame.ContentTransitions != null) { transitions = new TransitionCollection(); foreach (var c in rootFrame.ContentTransitions) { transitions.Add(c); } } rootFrame.ContentTransitions = null; rootFrame.Navigated += RootFrame_FirstNavigated; // When the navigation stack isn't restored navigate to the first page, // configuring the new page by passing required information as a navigation // parameter if (!rootFrame.Navigate(typeof (MainPage), e.Arguments)) { throw new Exception("Failed to create initial page"); } } // Ensure the current window is active Window.Current.Activate(); }
protected override void OnElementChanged(ElementChangedEventArgs <Page> e) { base.OnElementChanged(e); OAuthProviderSetting oauth = new OAuthProviderSetting(); var auth = oauth.LoginWithProvider("Facebook"); Windows.UI.Xaml.Controls.Frame rootFrame = Windows.UI.Xaml.Window.Current.Content as Windows.UI.Xaml.Controls.Frame; rootFrame.Navigate(auth.GetUI(), auth); }
private void OnBackRequested(object sender, BackRequestedEventArgs e) { Frame rootFrame = Window.Current.Content as Frame; if (rootFrame.CanGoBack) { e.Handled = true; rootFrame.GoBack(); } }
/// <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) { var 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; // you'll need to add `using System.Reflection;` var assembliesToInclude = new List <Assembly> { //Now, add all the assemblies your app uses typeof(SfMapsRenderer).GetTypeInfo().Assembly, typeof(SfCardViewRenderer).GetTypeInfo().Assembly, typeof(SfSegmentedControlRenderer).GetTypeInfo().Assembly, typeof(SfRotatorRenderer).GetTypeInfo().Assembly, typeof(SfExpanderRenderer).GetTypeInfo().Assembly, typeof(SfCheckBoxRenderer).GetTypeInfo().Assembly, typeof(SfBadgeViewRenderer).GetTypeInfo().Assembly, typeof(SfGradientViewRenderer).GetTypeInfo().Assembly, typeof(SfRatingRenderer).GetTypeInfo().Assembly, typeof(SfComboBoxRenderer).GetTypeInfo().Assembly, typeof(SfListViewRenderer).GetTypeInfo().Assembly, typeof(SfBorderRenderer).GetTypeInfo().Assembly, typeof(SfButtonRenderer).GetTypeInfo().Assembly, typeof(SfBusyIndicatorRenderer).GetTypeInfo().Assembly }; Forms.Init(e, assembliesToInclude); if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) { //TODO: Load state from previously suspended application } // 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 rootFrame.Navigate(typeof(MainPage), e.Arguments); } // Ensure the current window is active Window.Current.Activate(); }
public static bool NavigateToLocation(this Windows.UI.Xaml.Controls.Frame frame, string location) { try { return(frame.Navigate(PageMap[location])); } catch (KeyNotFoundException) { return(frame.Navigate(typeof(NotAvailablePage))); } }
public XUWPFrameNavigator(ILifetimeScope scope, XFrame rootFrame, Frame rootElement, IUWPViewResolver viewResolver, Type rootPageType) { _scope = scope; _rootFrame = rootFrame; _rootElement = rootElement; _xNavigation = rootFrame.Navigation; _container = rootFrame.Container; _viewResolver = viewResolver; _configure(rootPageType); }
public void goToPage(Type page) { Windows.UI.Xaml.Window window = Windows.UI.Xaml.Window.Current; if (window != null) { Windows.UI.Xaml.Controls.Frame frame = window.Content as Windows.UI.Xaml.Controls.Frame; if (frame != null) { frame.Navigate(page); } } }
/// <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; rootFrame.Navigated += OnNavigated; Forms.Init(e); if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) { //TODO: Load state from previously suspended application } // Place the frame in the current Window Window.Current.Content = rootFrame; // Register a handler for BackRequested events and set the // visibility of the Back button SystemNavigationManager.GetForCurrentView().BackRequested += OnBackRequested; SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = rootFrame.CanGoBack ? AppViewBackButtonVisibility.Visible : AppViewBackButtonVisibility.Collapsed; } if (e.PrelaunchActivated == false) { 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(); } }
public static bool Navigate(this Windows.UI.Xaml.Controls.Frame frame, ContentPage page) { if (page == null) { throw new ArgumentNullException(nameof(page)); } Guid id = Guid.NewGuid(); FormsEmbeddedPageWrapper.Pages.Add(id, page); return(frame.Navigate(typeof(FormsEmbeddedPageWrapper), id)); }
public void Login(Authenticator authenticator) { authenticator.Completed += AuthenticatorCompleted; System.Type page_type = authenticator.GetUI(); Windows.UI.Xaml.Controls.Frame root_frame = null; root_frame = Windows.UI.Xaml.Window.Current.Content as Windows.UI.Xaml.Controls.Frame; root_frame.Navigate(page_type, authenticator); return; }
public Service(Windows.UI.Xaml.Controls.Frame frame, IViewMapper vm, Func <ViewModel.Base, bool> isFirstPage) { Contract.AssertNotNull(() => frame, frame); Contract.AssertNotNull(() => vm, vm); Contract.AssertNotNull(() => isFirstPage, isFirstPage); m_frame = frame; m_vm = vm; m_isFirstPage = isFirstPage; m_frame.Navigated += m_frame_Navigated; }
public static void Navigate(Type typeOfPage) { Windows.UI.Xaml.Window window = Windows.UI.Xaml.Window.Current; if (window != null) { Windows.UI.Xaml.Controls.Frame frame = window.Content as Windows.UI.Xaml.Controls.Frame; if (frame != null) { frame.Navigate(typeOfPage); } } }
public void TabView_AddTabButtonClick(TabView sender, object args) { var frame = new Windows.UI.Xaml.Controls.Frame(); frame.Navigate(typeof(TestPage)); var tab = new TabViewItem { Header = "Broken", Content = frame }; Tabs.Add(tab); }
private void GoBackFunc() { Windows.UI.Xaml.Controls.Frame frame = (Windows.UI.Xaml.Controls.Frame)Windows.UI.Xaml.Window.Current.Content; frame.BackStack.Clear(); if (prototype != null && prototype.Name != null) { frame.Navigate(typeof(DetailsPrototypePage), prototype.PrototypeId); } else { frame.Navigate(typeof(PrototypesPage)); } }
public XUWPFrameNavigator(ILifetimeScope scope, XFrame rootFrame, Frame rootElement, IUWPViewResolver viewResolver, Type rootPageType) { _scope = scope; _rootFrame = rootFrame; _rootElement = rootElement; _xNavigation = rootFrame.Navigation; _container = rootFrame.Container; _viewResolver = viewResolver; _configure(rootPageType); }
/// <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 (Debugger.IsAttached) { this.DebugSettings.EnableFrameRateCounter = false; } #endif var 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 += this.OnNavigationFailed; List <Assembly> assembliesToInclude = new List <Assembly>(); assembliesToInclude.Add(typeof(SfPopupLayoutRenderer).GetTypeInfo().Assembly); assembliesToInclude.Add(typeof(SfDataGridRenderer).GetTypeInfo().Assembly); assembliesToInclude.Add(typeof(SfListViewRenderer).GetTypeInfo().Assembly); assembliesToInclude.Add(typeof(SfRotatorRenderer).GetTypeInfo().Assembly); assembliesToInclude.Add(typeof(SfTextInputLayoutRenderer).GetTypeInfo().Assembly); assembliesToInclude.Add(typeof(SampleBrowserUWP).GetTypeInfo().Assembly); assembliesToInclude.Add(typeof(SfButtonRenderer).GetTypeInfo().Assembly); Forms.Init(e, assembliesToInclude); if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) { ////TODO: Load state from previously suspended application } // 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 rootFrame.Navigate(typeof(MainPage), e.Arguments); } // Ensure the current window is active Window.Current.Activate(); }
public FramePageViewModel() { MainFrame = new Windows.UI.Xaml.Controls.Frame(); string navigationState = MainFrame.GetNavigationState(); MainFrame.Navigated += (sender, args) => { SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = MainFrame.CanGoBack ? AppViewBackButtonVisibility.Visible : AppViewBackButtonVisibility.Collapsed; }; MainFrame.Navigate(typeof(HomePage)); SystemNavigationManager.GetForCurrentView().BackRequested += OnBackRequested; NavigateCommand = new DelegateCommand(NavigateCommandImpl, NavigateCommandCanExecute); }
/// <summary> /// 프레임 등록 /// </summary> /// <param name="frame"></param> /// <param name="sessionStateKey"></param> public override void RegisterFrame(object frame, string sessionStateKey = null) { if (_frame == null) { _frame = frame as Windows.UI.Xaml.Controls.Frame; _secondFrame = null; if (_frame == null) return; _frame.Navigated -= Frame_Navigated; _frame.Navigating -= Frame_Navigating; _frame.Navigated += Frame_Navigated; _frame.Navigating += Frame_Navigating; SuspensionManager.RegisterFrame(_frame, sessionStateKey ?? DEFAULT_KEY); } }
public async Task OpenSecondaryWindow(ContentPage page) { CoreApplicationView newView = CoreApplication.CreateNewView(); int newViewId = 0; await newView.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { var frame = new Windows.UI.Xaml.Controls.Frame(); frame.Navigate(page); Window.Current.Content = frame; Window.Current.Activate(); newViewId = ApplicationView.GetForCurrentView().Id; }); bool viewShown = await ApplicationViewSwitcher.TryShowAsStandaloneAsync(newViewId); }
internal static bool Navigate(this Windows.UI.Xaml.Controls.Frame frame, ContentPage page, Windows.UI.Xaml.Media.Animation.NavigationTransitionInfo infoOverride) { if (page == null) { throw new ArgumentNullException(nameof(page)); } Guid id = Guid.NewGuid(); FormsEmbeddedPageWrapper.Pages.Add(id, page); if (infoOverride != null) { return(frame.Navigate(typeof(FormsEmbeddedPageWrapper), id, infoOverride)); } return(frame.Navigate(typeof(FormsEmbeddedPageWrapper), id)); }
/// <summary> /// Invoqué lorsque l'application est lancée normalement par l'utilisateur final. D'autres points d'entrée /// seront utilisés par exemple au moment du lancement de l'application pour l'ouverture d'un fichier spécifique. /// </summary> /// <param name="e">Détails concernant la requête et le processus de lancement.</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; // Ne répétez pas l'initialisation de l'application lorsque la fenêtre comporte déjà du contenu, // assurez-vous juste que la fenêtre est active if (rootFrame == null) { // Créez un Frame utilisable comme contexte de navigation et naviguez jusqu'à la première page rootFrame = new Frame(); rootFrame.NavigationFailed += OnNavigationFailed; // Init Xamarin Forms Forms.Init(e); // Init Ams plugin InitAzureForMobilePlugin(); if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) { //TODO: chargez l'état de l'application précédemment suspendue } // Placez le frame dans la fenêtre active Window.Current.Content = rootFrame; } if (rootFrame.Content == null) { // Quand la pile de navigation n'est pas restaurée, accédez à la première page, // puis configurez la nouvelle page en transmettant les informations requises en tant que // paramètre rootFrame.Navigate(typeof(MainPage), e.Arguments); } // Vérifiez que la fenêtre actuelle est 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 void OnLaunched(LaunchActivatedEventArgs e) { #if DEBUG if (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(); // Set the default language //rootFrame.Language = Windows.Globalization.ApplicationLanguages.Languages[0]; rootFrame.NavigationFailed += OnNavigationFailed; // add this line Forms.Init(e); if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) { //TODO: Load state from previously suspended application } // 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 rootFrame.Navigate(typeof(MainPage), e.Arguments); } // Ensure the current window is active Window.Current.Activate(); }
/// <summary> /// Invoqué lorsque l'application est lancée normalement par l'utilisateur final. D'autres points d'entrée /// sont utilisés lorsque l'application est lancée pour ouvrir un fichier spécifique, pour afficher /// des résultats de recherche, etc. /// </summary> /// <param name="e">Détails concernant la requête et le processus de lancement.</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; // Ne répétez pas l'initialisation de l'application lorsque la fenêtre comporte déjà du contenu, // assurez-vous juste que la fenêtre est active if (rootFrame == null) { // Créez un Frame utilisable comme contexte de navigation et naviguez jusqu'à la première page rootFrame = new Frame(); // TODO: modifier cette valeur à une taille de cache qui contient à votre application rootFrame.CacheSize = 1; // Init Xamarin Forms Forms.Init(e); // Init Ams plugin InitAzureForMobilePlugin(); if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) { // TODO: chargez l'état de l'application précédemment suspendue } // Placez le frame dans la fenêtre active Window.Current.Content = rootFrame; } if (rootFrame.Content == null) { #if WINDOWS_PHONE_APP // Supprime la navigation tourniquet pour le démarrage. if (rootFrame.ContentTransitions != null) { this.transitions = new TransitionCollection(); foreach (var c in rootFrame.ContentTransitions) { this.transitions.Add(c); } } rootFrame.ContentTransitions = null; rootFrame.Navigated += this.RootFrame_FirstNavigated; #endif // Quand la pile de navigation n'est pas restaurée, accédez à la première page, // puis configurez la nouvelle page en transmettant les informations requises en tant que // paramètre if (!rootFrame.Navigate(typeof(MainPage), e.Arguments)) { throw new Exception("Failed to create initial page"); } } // Vérifiez que la fenêtre actuelle est active Window.Current.Activate(); }
public FrameFacadeAdapter(Windows.UI.Xaml.Controls.Frame frame) { _frame = frame; }