public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { Rule.RuleType type = (Rule.RuleType)value; String typeString = type.ToString(); return(typeString.ElementAt(0) + typeString.Substring(1).ToLower()); }
public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture) { Rule.RuleType type = (Rule.RuleType)values[0]; BitmapImage image = new BitmapImage(); image.BeginInit(); String temp; switch (type) { case Rule.RuleType.DYNAMIC: temp = "../icons/violations/dynamic"; break; case Rule.RuleType.SANITY: temp = "../icons/violations/sanity"; break; default: temp = "../icons/violations/static"; break; } if (values[1] is bool && !(bool)values[1]) { temp = temp + "_unread"; } image.UriSource = new Uri(temp + ".png", UriKind.Relative); image.EndInit(); return(image); }
public void Tick(object sender, GameState state) { if (!IsStarted) { return; } if (Timer <= 0) { if (!state.Location.GetEntities <Banner>().Any()) { Program.Engine.AddEntity(Banner.Create("time expired")); } return; } if (state.Location.GetEntities <Banner>().Any() || state.Location.GetEntities <DialogBox>().Any()) { return; } Timer--; foreach (Stack <Rule> stack in Piles.Values) { if (stack.Any()) { if (stack.Peek().Type == Rule.RuleType.POP) { Rule.RuleType popType = (Rule.RuleType)Enum.Parse(typeof(Rule.RuleType), stack.Peek().Name.Split(' ')[1]); if (Piles[popType].Any()) { Piles[popType].Pop(); } if (stack.Any()) { stack.Pop(); } } else if (stack.Peek().Type != Rule.RuleType.SPAWN || Timer % Program.TPS == 0) { stack.Peek().Action(state.Location, null); } } } if (OutofControl) { if (Timer % Program.TPS == 0) { state.Location.AddEntity(Powerup.Create(Rule.GetNameRandomRule(), Program.Random.Next(16, Program.ScreenWidth - 16), Program.Random.Next(16, Program.ScreenWidth - 16))); } if (Timer % Program.TPS * 3 == 0) { // scroll through the list of rule types one by one string name = Rule.GetNameRandomRule(ruleTypes[ruleIndex++ % ruleTypes.Count]); if (name != null) { AddRule(name); } } } }
/// <summary> /// Constructeur. /// </summary> /// <param name="typeRegle"> Type de la règle. </param> /// <param name="PropertyName"> Propriété visée par l'exception. </param> /// <param name="objectType"> Type de l'objet validé. </param> /// <param name="ex"> Exception qui a déclenchée l'erreur. </param> public ValidationException(Rule.RuleType typeRegle, string PropertyName, Type objectType, Exception ex) : base(string.Format(CoreResources.EX0023, typeRegle, PropertyName, objectType.Name), ex) { }