/// <summary> /// InitializeFrameAsync creates a default Frame preceeded by the optional /// splash screen, then OnInitialzieAsync, then the new frame (if necessary). /// This is private because there's no reason for the developer to call this. /// </summary> private async Task InitializeFrameAsync(IActivatedEventArgs e) { DebugWrite($"{nameof(IActivatedEventArgs)}:{e.Kind}"); // first show the splash FrameworkElement splash = null; if (SplashFactory != null && e.PreviousExecutionState != ApplicationExecutionState.Suspended) { Window.Current.Content = splash = SplashFactory(e.SplashScreen); Window.Current.Activate(); } // allow the user to do things, even when restoring _HasOnInitializeAsync = true; await OnInitializeAsync(e); // this "unused" bit is very important because of a quirk in ResourceThemes try { if (Application.Current.Resources.ContainsKey("ExtendedSplashBackground")) { var unused = Application.Current.Resources["ExtendedSplashBackground"]; } } catch { /* this is okay */ } // this wonky style of loop is important due to a platform bug int count = Application.Current.Resources.Count; foreach (var resource in Application.Current.Resources) { var k = resource.Key; if (k == typeof(Controls.CustomTitleBar)) { var s = resource.Value as Style; var t = new Controls.CustomTitleBar(); t.Style = s; } count--; if (count == 0) { break; } } // create the default frame only if there's nothing already there // if it is not null, by the way, then the developer injected something & they win if (Window.Current.Content == null || Window.Current.Content == splash) { // build the default frame var frame = CreateRootFrame(e); var modal = new Controls.ModalDialog { DisableBackButtonWhenModal = true, Content = (NavigationServiceFactory(BackButton.Attach, ExistingContent.Include, frame)).FrameFacade.Frame }; Window.Current.Content = modal; } }
private void SetupCustomTitleBar() { // this needless test is important due to a platform bug try { if (Application.Current.Resources.ContainsKey("ExtendedSplashBackground")) { var unused = Application.Current.Resources["ExtendedSplashBackground"]; } } catch { /* this is okay */ } // this wonky style of loop is important due to a platform bug int count = Application.Current.Resources.Count; foreach (var resource in Application.Current.Resources) { var key = resource.Key; if (key == typeof(Controls.CustomTitleBar)) { var style = resource.Value as Style; var title = new Controls.CustomTitleBar(); title.Style = style; } count--; if (count == 0) { break; } } }
/// <summary> /// InitializeFrameAsync creates a default Frame preceeded by the optional /// splash screen, then OnInitialzieAsync, then the new frame (if necessary). /// This is private because there's no reason for the developer to call this. /// </summary> private async Task InitializeFrameAsync(IActivatedEventArgs e) { // first show the splash FrameworkElement splash = null; if (SplashFactory != null) { Window.Current.Content = splash = SplashFactory(e.SplashScreen); Window.Current.Activate(); } // allow the user to do things, even when restoring await OnInitializeAsync(e); // setup custom titlebar foreach (var resource in Application.Current.Resources .Where(x => x.Key.Equals(typeof(Controls.CustomTitleBar)))) { var control = new Controls.CustomTitleBar(); control.Style = resource.Value as Style; } // create the default frame only if there's nothing already there // if it is not null, by the way, then the developer injected something & they win if (Window.Current.Content == null || Window.Current.Content == splash) { // build the default frame var frame = CreateRootFrame(e); Window.Current.Content = NavigationServiceFactory(BackButton.Attach, ExistingContent.Include, frame).Frame; } }
private void SetupCustomTitleBar() { /* * this "unused" bit is very important because of a quirk in ResourceThemes */ try { if (Application.Current.Resources.ContainsKey("ExtendedSplashBackground")) { var unused = Application.Current.Resources["ExtendedSplashBackground"]; } } catch { /* this is okay */ } // this wonky style of loop is important due to a platform bug int count = Application.Current.Resources.Count; foreach (var resource in Application.Current.Resources) { var k = resource.Key; if (k == typeof(Controls.CustomTitleBar)) { var s = resource.Value as Style; var t = new Controls.CustomTitleBar(); t.Style = s; } count--; if (count == 0) { break; } } }
/// <summary> /// InitializeFrameAsync creates a default Frame preceeded by the optional /// splash screen, then OnInitialzieAsync, then the new frame (if necessary). /// This is private because there's no reason for the developer to call this. /// </summary> private async Task InitializeFrameAsync(IActivatedEventArgs e) { DebugWrite($"IActivatedEventArgs.Kind:{e.Kind}"); // first show the splash FrameworkElement splash = null; if (SplashFactory != null && e.PreviousExecutionState != ApplicationExecutionState.Suspended) { Window.Current.Content = splash = SplashFactory(e.SplashScreen); Window.Current.Activate(); } // allow the user to do things, even when restoring await OnInitializeAsync(e); // this "unused" bit is very important because of a quirk in ResourceThemes try { var unused = Application.Current.Resources["ExtendedSplashBackground"]; } catch { /* this is okay */ } // setup custom titlebar foreach (var resource in Application.Current.Resources .Where(x => x.Key.Equals(typeof(Controls.CustomTitleBar)))) { var control = new Controls.CustomTitleBar(); control.Style = resource.Value as Style; } // create the default frame only if there's nothing already there // if it is not null, by the way, then the developer injected something & they win if (Window.Current.Content == null || Window.Current.Content == splash) { // build the default frame var frame = CreateRootFrame(e); var modal = new Controls.ModalDialog { Content = NavigationServiceFactory(BackButton.Attach, ExistingContent.Include, frame).Frame }; Window.Current.Content = modal; } }
private void SetupCustomTitleBar() { SpinUpResources(); // this wonky style of loop is important due to a platform bug int count = Application.Current.Resources.Count; foreach (var resource in Application.Current.Resources) { var key = resource.Key; if (key == typeof(Controls.CustomTitleBar)) { var style = resource.Value as Style; var title = new Controls.CustomTitleBar(); title.Style = style; } count--; if (count == 0) { break; } } }
public static void Setup() { // this "unused" bit is very important because of a quirk in ResourceThemes try { if (Application.Current.Resources.ContainsKey("ExtendedSplashBackground")) { var unused = Application.Current.Resources["ExtendedSplashBackground"]; } } catch { /* this is okay */ } // this wonky style of loop is important due to a platform bug int count = Application.Current.Resources.Count; foreach (var resource in Application.Current.Resources) { var k = resource.Key; if (k == typeof(Controls.CustomTitleBar)) { var s = resource.Value as Style; var t = new Controls.CustomTitleBar(); t.Style = s; } count--; if (count == 0) break; } }