public MainPage() { InitializeComponent(); if (Width <= 641) { AutoSuggestButton.Visibility = Visibility.Visible; SearchAutoSuggestBox.Visibility = Visibility.Collapsed; } else { AutoSuggestButton.Visibility = Visibility.Collapsed; SearchAutoSuggestBox.Visibility = Visibility.Visible; } //订阅后退按钮事件 SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible; SystemNavigationManager.GetForCurrentView().BackRequested += App_BackRequested; //Global类里的一些设定 Global.RootGrid = RootGrid; Global.FrameTitle = Global.GetOsVersion() >= 16299 ? FrameTitleAcrylic : FrameTitle; Global.AutoSuggestGrid = AutoSuggestGrid; Global.RootFrame = RootFrame; Global.IconsListViewGameData = IconsListViewGameData; Global.IconsListViewSettingAndAbout = IconsListViewSettingAndAbout; // 设置Frame标题Margin属性 SetFrameTitleMargin(); // 汉堡菜单边框 //HamburgerGrid.BorderBrush = new SolidColorBrush(Global.AccentColor); //亚克力背景颜色及透明度设置读取 Global.TinkOpacity = SettingSet.AcrylicOpacitySettingRead(); Global.TinkColor = StringProcess.StringToColor(SettingSet.AcrylicColorSettingRead()); // 默认页 RootFrame.SourcePageType = typeof(CharacterPage); Global.PageStack.Push(new PageStackItem { TypeName = typeof(CharacterPage) }); // 设置SearchAutoSuggestBox的ItemSource属性 SearchAutoSuggestBox.ItemsSource = Global.AutoSuggestBoxItem; // 设置主题 if (Global.GetOsVersion() >= 16299) { ((Frame)Window.Current.Content).RequestedTheme = ElementTheme.Dark; } else { ((Frame)Window.Current.Content).RequestedTheme = SettingSet.ThemeSettingRead() ? ElementTheme.Dark : ElementTheme.Light; } }
/// <summary> /// 在应用程序由最终用户正常启动时进行调用。 /// 将在启动应用程序以打开特定文件等情况下使用。 /// </summary> /// <param name="e">有关启动请求和过程的详细信息。</param> protected override void OnLaunched(LaunchActivatedEventArgs e) { Frame rootFrame = Window.Current.Content as Frame; // 不要在窗口已包含内容时重复应用程序初始化, // 只需确保窗口处于活动状态 if (rootFrame == null) { // 创建要充当导航上下文的框架,并导航到第一页 rootFrame = new Frame(); rootFrame.NavigationFailed += OnNavigationFailed; if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) { //TODO: 从之前挂起的应用程序加载状态 } // 将框架放在当前窗口中 Window.Current.Content = rootFrame; } if (e.PrelaunchActivated == false) { if (rootFrame.Content == null) { // 当导航堆栈尚未还原时,导航到第一页, // 并通过将所需信息作为导航参数传入来配置 // 参数 rootFrame.Navigate(typeof(MainPage), e.Arguments); } // 确保当前窗口处于活动状态 Window.Current.Activate(); } if (SettingSet.ThemeSettingRead() == 0) { ((Frame)Window.Current.Content).RequestedTheme = ElementTheme.Light; } else { ((Frame)Window.Current.Content).RequestedTheme = ElementTheme.Dark; } }
public SettingChildPage() { _gameVersionSelectIndex = Global.GameVersion; this.InitializeComponent(); ThemeToggleSwitch.IsOn = SettingSet.ThemeSettingRead(); }
public SettingPage() { this.InitializeComponent(); Theme.SelectedIndex = SettingSet.ThemeSettingRead(); }