public DashboardViewModel() { if (DesignMode.DesignModeEnabled) { Shades.Add(new ShadeItemViewModel(hat.MotorA, 5, "Office Left")); } }
private async Task Init() { hat = await FEZHAT.CreateAsync(); Shades.Add(new ShadeItemViewModel(hat.MotorA, 5, "Left Window", hat.D2)); Shades.Add(new ShadeItemViewModel(hat.MotorB, 5, "Right Window", hat.D3)); // Main Timer - For Temp, light reading and status LEDs timer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(100) }; timer.Tick += OnTick; IsMonitoring = true; }
public static Color GetMaterialColor(Shades shade) { Color fillBrush; switch (shade) { case Shades.Primary: fillBrush = _instance.ColorScheme.PrimaryColor; break; case Shades.PrimaryDark: fillBrush = _instance.ColorScheme.DarkPrimaryColor; break; case Shades.PrimaryLight: fillBrush = _instance.ColorScheme.LightPrimaryColor; break; case Shades.Accent: fillBrush = _instance.ColorScheme.AccentColor; break; case Shades.Danger: fillBrush = _instance.ColorScheme.DangerColor; break; case Shades.Warning: fillBrush = _instance.ColorScheme.WarningColor; break; case Shades.Success: fillBrush = _instance.ColorScheme.SuccessColor; break; case Shades.LightGray: fillBrush = _instance.ColorScheme.LightGrayColor; break; default: fillBrush = _instance.ColorScheme.PrimaryColor; break; } return(fillBrush); }
/// <summary> /// Sets the given slot's color to the appropriate color, shading it if necessary. /// Then, iterates through all other rules(that are this rule's dependents) to update them accordingly. /// isCustomization= true means it's a user provided color, set it to that raw color /// isCustomization= false means the rule it's inheriting from changed, so updated using asShade /// </summary> /// <param name="rule"></param> /// <param name="color"></param> /// <param name="isInverted"></param> /// <param name="isCustomization"></param> /// <param name="overwriteCustomColor"></param> private static void SetSlotInternal(IThemeSlotRule rule, IColor color, Boolean isInverted, Boolean isCustomization, Boolean overwriteCustomColor = true) { //if (rule.color == null && String.IsNullOrEmpty(rule.value)) //{ // // not a color rule // return; //} if (overwriteCustomColor || rule.color == null || !rule.isCustomized || rule.inherits == null) { // set the rule's color under these conditions if ((overwriteCustomColor || !rule.isCustomized) && !isCustomization && rule.inherits != null && Shades.IsValidShade(rule.asShade)) { // it's inheriting by shade if (rule.isBackgroundShade) { rule.color = Shades.GetBackgroundShade(color, rule.asShade, isInverted); } else { rule.color = Shades.GetShade(color, rule.asShade, isInverted); } rule.isCustomized = false; } else { rule.color = color; rule.isCustomized = true; } // then update dependent colors foreach (var ruleToUpdate in rule.dependentRules) { ThemeGenerator.SetSlotInternal(ruleToUpdate, rule.color, isInverted, false, overwriteCustomColor); } } }
public ShadePrototype this[string key] { get { return(Shades[key]); } set { Shades.Add(key, value); } }
public void SetDesign(int Seed) { //Colour is Seed/3 //Shade is Colour/3 //Shape is Shade/3 //Number is Shape/3 MySeed = Seed; //Choose Colour. int ImportantPart = Seed; int ColourNum = Mathf.FloorToInt(ImportantPart / 27f); if (ColourNum == 0) { Colour = Colours.Red; } else if (ColourNum == 1) { Colour = Colours.Green; } else { Colour = Colours.Purple; } //Choose Shade. ImportantPart = ImportantPart - (ColourNum * 27); int ShadeNum = Mathf.FloorToInt(ImportantPart / 9); if (ShadeNum == 0) { Shade = Shades.Empty; } else if (ShadeNum == 1) { Shade = Shades.Half; } else { Shade = Shades.Filled; } //Choose Shape. ImportantPart = ImportantPart - (ShadeNum * 9); int ShapeNum = Mathf.FloorToInt(ImportantPart / 3); if (ShapeNum == 0) { Shape = Shapes.Diamond; } else if (ShapeNum == 1) { Shape = Shapes.Capsule; } else { Shape = Shapes.Squiggle; } //Choose Number. ImportantPart = ImportantPart - (ShapeNum * 3); int NumberNum = ImportantPart; if (NumberNum == 0) { Number = Numbers.One; } else if (NumberNum == 1) { Number = Numbers.Two; } else { Number = Numbers.Three; } ChooseSprite(ShapeNum, ShadeNum); //Debug.Log ("Seed: " + Seed + " >>> Design: " + Colour + ", " + Shade + ", " + Shape + ", " + Number); }
public static Pen GetMaterialPen(Shades shade) { return(new Pen(GetMaterialColor(shade))); }
public static Brush GetMaterialBrush(Shades shade) { return(new SolidBrush(GetMaterialColor(shade))); }