/// <summary> /// /// </summary> /// <returns></returns> protected override NWidget CreateExampleContent() { NStackPanel stack = new NStackPanel(); NStackPanel controlStack = new NStackPanel(); controlStack.Direction = ENHVDirection.LeftToRight; stack.Add(controlStack); m_LinearGauge = new NLinearGauge(); m_LinearGauge.Orientation = ENLinearGaugeOrientation.Vertical; m_LinearGauge.PreferredSize = defaultLinearVerticalGaugeSize; m_LinearGauge.BackgroundFill = new NStockGradientFill(NColor.DarkGray, NColor.Black); m_LinearGauge.CapEffect = new NGelCapEffect(); m_LinearGauge.Border = base.CreateBorder(); m_LinearGauge.Padding = new NMargins(20); m_LinearGauge.BorderThickness = new NMargins(6); controlStack.Add(m_LinearGauge); NMarkerValueIndicator markerIndicator = new NMarkerValueIndicator(); m_LinearGauge.Indicators.Add(markerIndicator); InitSections(m_LinearGauge); // create the radial gauge m_RadialGauge = new NRadialGauge(); m_RadialGauge.PreferredSize = defaultRadialGaugeSize; NEdgeDialRim dialRim = new NEdgeDialRim(); dialRim.OuterBevelWidth = 2.0; dialRim.InnerBevelWidth = 2.0; dialRim.MiddleBevelWidth = 2.0; m_RadialGauge.Dial = new NDial(ENDialShape.CutCircle, dialRim); m_RadialGauge.Dial.BackgroundFill = new NStockGradientFill(NColor.DarkGray, NColor.Black); m_RadialGauge.InnerRadius = 15; NGlassCapEffect glassCapEffect = new NGlassCapEffect(); glassCapEffect.LightDirection = new NAngle(130, NUnit.Degree); glassCapEffect.EdgeOffset = 0; glassCapEffect.EdgeDepth = 0.30; m_RadialGauge.CapEffect = glassCapEffect; controlStack.Add(m_RadialGauge); NNeedleValueIndicator needleIndicator = new NNeedleValueIndicator(); m_RadialGauge.Indicators.Add(needleIndicator); m_RadialGauge.SweepAngle = new NAngle(180, NUnit.Degree); InitSections(m_RadialGauge); m_DataFeedTimer = new NTimer(); m_DataFeedTimer.Tick += new Function(OnDataFeedTimerTick); m_DataFeedTimer.Start(); return(stack); }
protected override void OnRegistered() { base.OnRegistered(); m_Timer = new NTimer(); m_Timer.Tick += OnTimerTick; m_Timer.Start(); }
protected override void AttachToEvents() { base.AttachToEvents(); m_PreviousTickTime = DateTime.Now; m_Timer = new NTimer(); m_Timer.Interval = 10; m_Timer.Tick += new EventHandler(OnTimerTick); m_Timer.Start(); }
public void UpdateAssets(Size s) { lock ( PFSim ) { PFSim.Reapers.Clear(); PFSim.Reapers.Add(Age.Instance); PFSim.Reapers.Add(new Boundary(new Rect(-0.1 * s.Width, -0.1 * s.Height, s.Width * 1.2, s.Height * 1.2))); float SW = ( float )s.Width; float SH = ( float )s.Height; float HSW = 0.5f * SW; float HSH = 0.5f * SH; PFSim.Spawners.Clear(); PFSim.Spawners.Add(new LinearSpawner(new Vector2(HSW, HSH), new Vector2(HSW, HSH), new Vector2(10, 10)) { Chaos = new Vector2(1, 1) , otMin = 5, otMax = 10 , Texture = tCircle , SpawnTrait = PFTrait.IMMORTAL , SpawnEx = (P) => { P.Tint.M11 = ThemeTint.X; P.Tint.M22 = ThemeTint.Y; P.Tint.M33 = ThemeTint.Z; P.Tint.M44 = ThemeTint.W * NTimer.LFloat(); P.mf *= NTimer.LFloat(); P.Scale = new Vector2(0.5f, 0.5f) + Vector2.One * (NTimer.LFloat() - 0.25f); P.vt.Y += 5 * NTimer.RFloat(); } }); ScrollWind.A = new Vector2(SW, 0); ScrollWind.B = new Vector2(SW, SH); ScrollWind.MaxDist = SW; PFSim.Fields.Clear(); PFSim.AddField(GenericForce.EARTH_GRAVITY); PFSim.AddField(ScrollWind); } }
protected override NWidget CreateExampleContent() { NStackPanel stack = new NStackPanel(); stack.HorizontalPlacement = Layout.ENHorizontalPlacement.Left; m_NumericDisplay1 = CreateNumericLedDisplay(); stack.Add(m_NumericDisplay1); m_NumericDisplay2 = CreateNumericLedDisplay(); stack.Add(m_NumericDisplay2); m_NumericDisplay3 = CreateNumericLedDisplay(); stack.Add(m_NumericDisplay3); m_DataFeedTimer = new NTimer(); m_DataFeedTimer.Tick += new Function(OnDataFeedTimerTick); m_DataFeedTimer.Start(); return(stack); }
protected override NWidget CreateExampleContent() { NStackPanel stack = new NStackPanel(); stack.HorizontalPlacement = Layout.ENHorizontalPlacement.Left; NStackPanel controlStack = new NStackPanel(); stack.Add(controlStack); // create the radial gauge m_RadialGauge = new NRadialGauge(); m_RadialGauge.SweepAngle = new NAngle(270, NUnit.Degree); m_RadialGauge.BeginAngle = new NAngle(-225, NUnit.Degree); m_RadialGauge.PreferredSize = defaultRadialGaugeSize; m_RadialGauge.CapEffect = new NGlassCapEffect(); m_RadialGauge.Dial = new NDial(ENDialShape.CutCircle, new NEdgeDialRim()); m_RadialGauge.Dial.BackgroundFill = new NStockGradientFill(NColor.DarkGray, NColor.Black); // configure scale NGaugeAxis axis = new NGaugeAxis(); m_RadialGauge.Axes.Add(axis); NLinearScale scale = (NLinearScale)axis.Scale; scale.SetPredefinedScale(ENPredefinedScaleStyle.Presentation); scale.Labels.Style.TextStyle.Font = new NFont("Arimo", 10, ENFontStyle.Bold); scale.Labels.Style.TextStyle.Fill = new NColorFill(NColor.White); scale.Labels.Style.Angle = new NScaleLabelAngle(ENScaleLabelAngleMode.Scale, 90.0); scale.MinorTickCount = 4; scale.Ruler.Stroke.Width = 0; scale.Ruler.Fill = new NColorFill(NColor.DarkGray); // add radial gauge indicators m_ValueIndicator = new NNeedleValueIndicator(); m_ValueIndicator.Fill = new NStockGradientFill(ENGradientStyle.Horizontal, ENGradientVariant.Variant1, NColor.White, NColor.Red); m_ValueIndicator.Stroke.Color = NColor.Red; m_ValueIndicator.Width = 15; m_ValueIndicator.OffsetFromScale = -10; m_RadialGauge.Indicators.Add(m_ValueIndicator); NStackPanel verticalStack = new NStackPanel(); verticalStack.Direction = Layout.ENHVDirection.TopToBottom; verticalStack.Padding = new NMargins(80, 200, 80, 0); m_NumericLedDisplay = new NNumericLedDisplay(); m_NumericLedDisplay.Value = 0.0; m_NumericLedDisplay.CellCountMode = ENDisplayCellCountMode.Fixed; m_NumericLedDisplay.CellCount = 7; m_NumericLedDisplay.BackgroundFill = new NColorFill(NColor.Black); m_NumericLedDisplay.Border = NBorder.CreateSunken3DBorder(new NUIThemeColorMap(ENUIThemeScheme.WindowsClassic)); m_NumericLedDisplay.BorderThickness = new NMargins(6); m_NumericLedDisplay.Margins = new NMargins(5); m_NumericLedDisplay.Padding = new NMargins(5); NGelCapEffect gelCap = new NGelCapEffect(); gelCap.Shape = ENCapEffectShape.RoundedRect; m_NumericLedDisplay.CapEffect = gelCap; m_NumericLedDisplay.PreferredHeight = 60; verticalStack.Add(m_NumericLedDisplay); m_RadialGauge.Content = verticalStack; // add radial gauge controlStack.Add(m_RadialGauge); m_DataFeedTimer = new NTimer(); m_DataFeedTimer.Tick += new Function(OnDataFeedTimerTick); m_DataFeedTimer.Start(); return(stack); }
public async void ApplyBackgrounds() { string BgType = Conf.BgType; // Default value if (BgType == null) { SetBackground("System"); return; } string BgValue = Conf.BgValue; bool UseDefault = false; switch (BgType) { case "None": ApplyImage(null); break; case "Custom": if (BgValue == null) { return; } IStorageFolder ISD = null; try { ISD = await AppStorage.FutureAccessList.GetFolderAsync(BgValue); } catch (Exception) { } if (ISD == null) { return; } // Randomly pick an image string[] Acceptables = new string[] { ".JPG", ".PNG", ".GIF" }; IEnumerable <IStorageFile> ISFs = await ISD.GetFilesAsync(); IStorageFile[] ISImgs = ISFs.Where(x => Acceptables.Contains(x.FileType.ToUpper()) && x.Path != CurrLocation).ToArray(); if (ISImgs.Length == 0) { return; } ApplyImage(NTimer.RandChoice(ISImgs)); break; case "Preset": UseDefault = true; try { List <string> ImagePaths = new List <string>(); if (Book != null) { foreach (ChapterImage C in Shared.BooksDb.GetBookImages(Book.Id)) { ImagePaths.AddRange(C.Urls); } } if (0 < ImagePaths.Count) { string Url = ImagePaths[NTimer.RandInt(ImagePaths.Count())]; TryUseImage(Url); UseDefault = false; } } catch (Exception ex) { Logger.Log("BgContext", ex.Message, LogType.ERROR); } break; default: case "System": UseDefault = true; break; } if (UseDefault) { ApplyImage(BgValue, true); } }