private void SetTemplate() { Indicators.RenderTransform = new TranslateTransform(); HeaderPanel.RenderTransform = new TranslateTransform(); StatusPanel.RenderTransform = new TranslateTransform(); IntroText.RenderTransform = new TranslateTransform(); InfoBgContext = new BgContext(GRConfig.BookInfoView.BgContext); InfoBgContext.ApplyBackgrounds(); InitAppBar(); CacheStateStory = new Storyboard(); ReloadIcon.RenderTransform = new RotateTransform() { CenterX = 7.5, CenterY = 7.5 }; SimpleStory.DoubleAnimation(CacheStateStory, ReloadIcon.RenderTransform, "Angle", 0, 360, 2000, 0, new SineEase()); CacheStateStory.RepeatBehavior = RepeatBehavior.Forever; }
private void SetTemplate() { ReaderContext = new ReaderView(); ContentGrid.DataContext = ReaderContext; ContextGrid.DataContext = new ESContext(); RBgContext = new BgContext(GRConfig.ContentReader.BgContext); ContentBg.DataContext = RBgContext; RBgContext.ApplyBackgrounds(); if (Paragraph.Translator == null) { Paragraph.Translator = new libtranslate.Translator(); } StringResources stx = StringResources.Load("Settings"); ExpContent = new Paragraph[] { new Paragraph(stx.Text("Appearance_ContentReader_Exp1")) , new Paragraph(stx.Text("Appearance_ContentReader_Exp2")) , new Paragraph(stx.Text("Appearance_ContentReader_Exp3")) , new Paragraph(stx.Text("Appearance_ContentReader_Exp4")) }; XTitleStepper.Text = YTitleStepper.Text = stx.Text("Appearance_ContentReader_Exp2"); ColorList.ItemsSource = new ColorItem[] { new ColorItem( stx.Text("Appearance_ContentReader_Background") , GRConfig.ContentReader.BackgroundColor ) { BindAction = (c) => { GRConfig.ContentReader.BackgroundColor = c; UpdateExampleFc(); } } , new ColorItem( stx.Text("Appearance_ContentReader_ScrollBar") , GRConfig.ContentReader.ScrollBarColor ) { BindAction = (c) => { GRConfig.ContentReader.ScrollBarColor = c; UpdateScrollBar(); } } , new ColorItem( stx.Text("Appearance_ContentReader_FontColor") , GRConfig.ContentReader.FontColor ) { BindAction = (c) => { GRConfig.ContentReader.FontColor = c; } } , new ColorItem( stx.Text("Appearance_ContentReader_TapBrushColor") , GRConfig.ContentReader.TapBrushColor ) { BindAction = (c) => { GRConfig.ContentReader.TapBrushColor = c; } } , new ColorItem( stx.Text("Appearance_ContentReader_NavBg") , GRConfig.ContentReader.BgColorNav ) { BindAction = (c) => { GRConfig.ContentReader.BgColorNav = c; } } , new ColorItem( stx.Text("Appearance_ContentReader_AssistHelper") , GRConfig.ContentReader.BgColorAssist ) { BindAction = (c) => { GRConfig.ContentReader.BgColorAssist = c; } } }; ClockColorList.ItemsSource = new ColorItem[] { new ColorItem( stx.Text("Appearance_ContentReader_Clock_ARColor") , GRConfig.ContentReader.Clock.ARColor ) { BindAction = (c) => { GRConfig.ContentReader.Clock.ARColor = c; } } , new ColorItem( stx.Text("Appearance_ContentReader_Clock_HHColor") , GRConfig.ContentReader.Clock.HHColor ) { BindAction = (c) => { GRConfig.ContentReader.Clock.HHColor = c; } } , new ColorItem( stx.Text("Appearance_ContentReader_Clock_MHColor") , GRConfig.ContentReader.Clock.MHColor ) { BindAction = (c) => { GRConfig.ContentReader.Clock.MHColor = c; } } , new ColorItem( stx.Text("Appearance_ContentReader_Clock_SColor") , GRConfig.ContentReader.Clock.SColor ) { BindAction = (c) => { GRConfig.ContentReader.Clock.SColor = c; } } , new ColorItem( stx.Text("Appearance_ContentReader_EStepper_DColor") , GRConfig.ContentReader.EpStepper.DColor ) { BindAction = (c) => { GRConfig.ContentReader.EpStepper.DColor = c; } } , new ColorItem( stx.Text("Appearance_ContentReader_EStepper_SColor") , GRConfig.ContentReader.EpStepper.SColor ) { BindAction = (c) => { GRConfig.ContentReader.EpStepper.SColor = c; } } , new ColorItem( stx.Text("Appearance_ContentReader_Background") , GRConfig.ContentReader.EpStepper.BackgroundColor ) { BindAction = (c) => { GRConfig.ContentReader.EpStepper.BackgroundColor = c; } } }; BatteryReport Report = Battery.AggregateBattery.GetReport(); if (Report.RemainingCapacityInMilliwattHours != null) { YClock.Progress = XClock.Progress = ( float )Report.RemainingCapacityInMilliwattHours / ( float )Report.FullChargeCapacityInMilliwattHours; } SSliders[FontSizeInput.Name] = FontSizeSlider; SSliders[BlockHeightInput.Name] = BlockHeightSlider; SSliders[LineSpacingInput.Name] = LineSpacingSlider; SSliders[ParaSpacingInput.Name] = ParaSpacingSlider; FontSizeSlider.Value = GRConfig.ContentReader.FontSize; LineSpacingSlider.Value = GRConfig.ContentReader.LineHeight; ParaSpacingSlider.Value = 2 * GRConfig.ContentReader.ParagraphSpacing; FontSizeInput.Text = FontSizeSlider.Value.ToString(); LineSpacingInput.Text = LineSpacingSlider.Value.ToString(); ParaSpacingInput.Text = ParaSpacingSlider.Value.ToString(); double BlockHeight = GRConfig.ContentReader.BlockHeight; if (0 < BlockHeight) { BlockHeightSlider.Value = BlockHeight; } FontWeight FWeight = GRConfig.ContentReader.FontWeight; // Set font weights Dictionary <string, FontWeight> ForReflection = new Dictionary <string, FontWeight>() { { "Thin", FontWeights.Thin } , { "ExtraLight", FontWeights.ExtraLight } , { "Light", FontWeights.Light } , { "SemiLight", FontWeights.SemiLight } , { "Normal", FontWeights.Normal } , { "Medium", FontWeights.Medium } , { "SemiBold", FontWeights.SemiBold } , { "Bold", FontWeights.Bold } , { "ExtraBold", FontWeights.ExtraBold } , { "Black", FontWeights.Black } , { "ExtraBlack", FontWeights.ExtraBlack } }; Logger.Log(ID, "Default FontWeight is " + FWeight.Weight); List <PInfoWrapper> PIW = new List <PInfoWrapper>(); foreach (KeyValuePair <string, FontWeight> K in ForReflection) { PInfoWrapper PWrapper = new PInfoWrapper(K.Key, K.Value); PIW.Add(PWrapper); } FontWeightCB.ItemsSource = PIW; FontWeightCB.SelectedItem = PIW.First(x => x.Weight.Weight == FWeight.Weight); YClock.Time = XClock.Time = DateTime.Now; XDayofWeek.Text = YDayofWeek.Text = YClock.Time.ToString("dddd"); XDayofMonth.Text = YDayofMonth.Text = YClock.Time.Day.ToString(); XMonth.Text = YMonth.Text = YClock.Time.ToString("MMMM"); SetLayoutAware(); UpdateExampleLs(); UpdateExamplePs(); UpdateExampleFc(); UpdateExampleFs(); UpdateExampleBh(); for (int i = 0; i < 3; i++) { var j = ContentGrid.Dispatcher.RunIdleAsync((x) => { UpdateExampleFs(); UpdateExampleBh(); }); } }