Пример #1
0
        public Fellow(IFellow fellow, string machineTypename)
        {
            _fellow = fellow;

            _machineTypename = machineTypename;

            var stateData = _fellow.StateData();

            if (stateData != null)
            {
                ContextStateData = ContextInfo.Deserialize(stateData);
            }

            CheckAttributes();
        }
Пример #2
0
        public void Bind(IFellow fellow)
        {
            if (IsBound)
            {
                FloomeenException.Raise(_machineName, "AlreadyBound");
            }

            BoundFellow = new Fellow(fellow, _machineName);

            if (!BoundFellow.IsSet())
            {
                FloomeenException.Raise(_machineName, "CannotBindFellowBecauseNotSet.TryPlugging");
            }

            BoundFellow.CheckMachineType();

            Flow.StatesContains(BoundFellow.State);
        }
Пример #3
0
        public void Plug(IFellow fellow)
        {
            if (IsBound)
            {
                FloomeenException.Raise(_machineName, "AlreadyBound");
            }

            BoundFellow = new Fellow(fellow, _machineName);

            if (BoundFellow.IsSet())
            {
                FloomeenException.Raise(_machineName, "CannotPlugFellowBecauseAlreadySet.TryBinding");
            }

            var startState = Flow.StartState();

            BoundFellow.Plug(_machineName, startState);

            EnterNewState(startState, CreateContext());
        }
Пример #4
0
 public static string GetPropNameByAttribute <TAttribute>(this IFellow fellow) where TAttribute : Attribute
 {
     return(FloomeenExtensions.GetPropNameByAttribute <TAttribute>(fellow));
 }
Пример #5
0
 public static void ChangedOn(this IFellow fellow, object value)
 {
     fellow.SetPropValueByAttribute <FloomeenChangedOn>(value);
 }
Пример #6
0
 public static DateTime ChangedOn(this IFellow fellow)
 {
     return((DateTime)fellow.GetPropValueByAttribute <FloomeenChangedOn>());
 }
Пример #7
0
 public static void StateData(this IFellow fellow, object value)
 {
     fellow.SetPropValueByAttribute <FloomeenStateData>(value);
 }
Пример #8
0
 public static string StateData(this IFellow fellow)
 {
     return(fellow.GetPropValueByAttribute <FloomeenStateData>()?.ToString());
 }
Пример #9
0
 public static void Machine(this IFellow fellow, object value)
 {
     fellow.SetPropValueByAttribute <FloomeenMachine>(value);
 }
Пример #10
0
 public static string Machine(this IFellow fellow)
 {
     return(fellow.GetPropValueByAttribute <FloomeenMachine>()?.ToString());
 }
Пример #11
0
 public static void Id(this IFellow fellow, object value)
 {
     fellow.SetPropValueByAttribute <FloomeenId>(value);
 }
Пример #12
0
 public static object Id(this IFellow fellow)
 {
     return(fellow.GetPropValueByAttribute <FloomeenId>());
 }
Пример #13
0
 public static void SetPropValueByAttribute <TAttribute>(this IFellow fellow, object value) where TAttribute : Attribute
 {
     FloomeenExtensions.SetPropValueByAttribute <TAttribute>(fellow, value);
 }
Пример #14
0
 public static object GetPropValueByAttribute <TAttribute>(this IFellow fellow) where TAttribute : Attribute
 {
     return(FloomeenExtensions.GetPropValueByAttribute <TAttribute>(fellow));
 }
Пример #15
0
        static void PlugFlipperFloomeen(out FlipperFloomeen flipper, IFellow customer)
        {
            flipper = Factory <FlipperFloomeen> .Create();

            flipper.Plug(customer);
        }