Ejemplo n.º 1
0
 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;
     }
 }
Ejemplo n.º 2
0
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     if (Global.GetOsVersion() >= 16299)
     {
         var dimGrayAcrylicBrush = new AcrylicBrush
         {
             BackgroundSource = AcrylicBackgroundSource.HostBackdrop,
             FallbackColor    = Colors.Transparent,
             TintColor        = Global.TinkColor,
             TintOpacity      = Global.TinkOpacity
         };
         RootStackPanel.Background = dimGrayAcrylicBrush;
         //隐藏主题设置
         ThemeStackPanel.Visibility = Visibility.Collapsed;
         //显示亚克力背景设置
         AcrylicOpacityStackPanel.Visibility    = Visibility.Visible;
         AcrylicBackgroundStackPanel.Visibility = Visibility.Visible;
         //添加ColorPicker控件
         var colorPicker = new ColorPicker
         {
             HorizontalAlignment = HorizontalAlignment.Left,
             Color = Color.FromArgb(255, 105, 105, 105),
             RenderTransformOrigin = new Point(0, 0),
             RenderTransform       = new CompositeTransform
             {
                 ScaleX = 0.7,
                 ScaleY = 0.7
             }
         };
         colorPicker.ColorChanged += ColorPicker_ColorChanged;
         AcrylicBackgroundStackPanel.Children.Add(colorPicker);
         AcrylicOpacitySlider.Value = SettingSet.AcrylicOpacitySettingRead();
         _acrylicOpacitySetted      = true;
         colorPicker.Color          = StringProcess.StringToColor(SettingSet.AcrylicColorSettingRead());
     }
 }