Пример #1
0
 public virtual Case ElseIf(Condition condition, object result)
 {
     if (condition == null)
     {
         throw new System.ArgumentNullException("condition");
     }
     Whens.Add(new Case(condition, result));
     return(this);
 }
Пример #2
0
 private void UpdateWhensList()
 {
     Whens.Clear();
     foreach (When when in Rule.Whens)
     {
         Type          whenModelType = typeof(WhenViewModel <>).MakeGenericType(when.GetType());
         WhenViewModel whenViewModel = Container.GetExports(typeof(WhenViewModel <>).MakeGenericType(when.GetType()), null, null).FirstOrDefault()?.Value as WhenViewModel;
         if (whenViewModel != null)
         {
             whenModelType.GetMethod("SetModels").Invoke(whenViewModel, new object[] { this, when });
             Whens.Add(whenViewModel);
         }
     }
 }
Пример #3
0
        public void When(When when, Act action, Unless unless = null)
        {
            foreach (var cw in Whens)
            {
                if (cw.When == when && cw.Action == action && cw.Unless == unless)
                {
                    return;
                }
            }
            WhenInfo wi = new WhenInfo();

            wi.When   = when;
            wi.Action = action;
            wi.Unless = unless;
            Whens.Add(wi);
        }
Пример #4
0
 public void AddWhen(string text, when method)
 {
     Whens.Add(method, text);
 }