Ejemplo n.º 1
0
 public frmTransitionParams(List<Parameter> transitionParams, Transition transition)
 {
     InitializeComponent();
     _transitionParams = transitionParams;
     _transition = transition;
     LoadTransitionGrid(transitionParams);
 }
Ejemplo n.º 2
0
 private Transition DefaultTransition(Event myEvent, State state, Mode mode)
 {
     var transition = new Transition();
     transition.TranistionID = 0;
     transition.Event = myEvent;
     transition.Mode = mode;
     transition.State = state;
     transition.NextStateID = 0; // This will fail in the future
     transition.NextStateReturnMax = 0;
     transition.TransitionName = "Ignored";
     transition.Description = "This Event/State has no Transition defined";
     
     return transition;
 }
Ejemplo n.º 3
0
        public void DeleteTransitionFunctions(Transition transition)
        {

            var transitionFunctions = from TransitionFunction tf in _db.TransitionFunctions
                                      where tf.TranstitonID == transition.TranistionID
                                      select tf;

            foreach (var transitionFunction in transitionFunctions)
            {
                _db.TransitionFunctions.DeleteObject(transitionFunction);
            }

            SaveChanges();
        }
Ejemplo n.º 4
0
        public void AddUpdateTransitionFunctions(Dictionary<int, Function> functionDict, Transition transition)
        {
            DeleteTransitionFunctions(transition);

            foreach (var callOrder in functionDict.Keys)
            {
                var tf = new TransitionFunction();
                tf.CallOrder = callOrder;
                tf.Function = functionDict[callOrder];
                tf.Transition = transition;
                tf.ReturnMask = "";
                _db.TransitionFunctions.AddObject(tf);
            }
            SaveChanges();
        }
Ejemplo n.º 5
0
        public void AddUpdateTransition(Transition transition)
        {
            // Make sure it doesn't already exist
            var testTransition = GetTransition(transition.EventID, transition.StateID, transition.ModeID);

            if(testTransition.TranistionID == 0)
            {
                _db.Transitions.AddObject(transition);
            }
            else
            {
                testTransition.TransitionName = transition.TransitionName;
                testTransition.Description = transition.Description;
                testTransition.NextStateID = transition.NextStateID;
                testTransition.NextStateReturnMax = transition.NextStateReturnMax;
            }
            SaveChanges();
        }
Ejemplo n.º 6
0
        public SortedDictionary<int, Function> GetTrasnsitionFunctions(Transition transition)
        {
            //var functionIDs = from TransitionFunction tf in _db.TransitionFunctions
            //               where tf.TranstitonID == transition.TranistionID
            //               select tf.FunctionID;

            //return from Function f in _db.Functions
            //       join TransitionFunction tf in _db.TransitionFunctions
            //           on f.FunctionID equals tf.FunctionID
            //       where functionIDs.Contains(f.FunctionID)
            //       orderby tf.CallOrder
            //       select f;

            var orderedFunctions = (from TransitionFunction tf in _db.TransitionFunctions
                                    where tf.TranstitonID == transition.TranistionID
                                    select tf).ToDictionary(tf => tf.CallOrder, tf => tf.Function);

            return new SortedDictionary<int, Function>(orderedFunctions);
        }
Ejemplo n.º 7
0
        public static Dictionary<string, string> GetTransitionEventParams(Transition transition)
        {
            var returnParams = new Dictionary<string, string>();

            if (!transition.TransitionName.StartsWith("Default"))
            {
                var functions = DataHelper.GetTrasnsitionFunctions(transition);
                var function = functions.FirstOrDefault().Value;
                if (function != null)
                {
                    var functionMO = FSMFunctionLoader.GetFunction(function.FunctionName);
                    returnParams = functionMO.GetFieldInfos;
                }
            }

            if(returnParams.Count == 0)
            {
                returnParams.Add("DefaultParam", "NA");
            }

            return returnParams;
        }
Ejemplo n.º 8
0
        public static void DeleteTransition(Transition transition)
        {
            var data = dataAccess();

            data.DeleteTransition(transition);
        }
Ejemplo n.º 9
0
        public static void AddUpdateTransitionFinctions(Dictionary<int, Function> functionDict, Transition transition)
        {
            var data = dataAccess();

            data.AddUpdateTransitionFunctions(functionDict, transition);

        }
Ejemplo n.º 10
0
 public static void AddUpdateTransition(Transition transition)
 {
     var data = dataAccess();
     data.AddUpdateTransition(transition);
 }
Ejemplo n.º 11
0
        public static SortedDictionary<int, Function> GetTrasnsitionFunctions(Transition transition)
        {
            var data = dataAccess();

            return data.GetTrasnsitionFunctions(transition);
        }
Ejemplo n.º 12
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Transitions EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToTransitions(Transition transition)
 {
     base.AddObject("Transitions", transition);
 }
Ejemplo n.º 13
0
 /// <summary>
 /// Create a new Transition object.
 /// </summary>
 /// <param name="tranistionID">Initial value of the TranistionID property.</param>
 /// <param name="eventID">Initial value of the EventID property.</param>
 /// <param name="stateID">Initial value of the StateID property.</param>
 /// <param name="modeID">Initial value of the ModeID property.</param>
 public static Transition CreateTransition(global::System.Int32 tranistionID, global::System.Int32 eventID, global::System.Int32 stateID, global::System.Int32 modeID)
 {
     Transition transition = new Transition();
     transition.TranistionID = tranistionID;
     transition.EventID = eventID;
     transition.StateID = stateID;
     transition.ModeID = modeID;
     return transition;
 }
Ejemplo n.º 14
0
        /// <summary>
        /// Deletes transition and all it's links to functions
        /// Doe not delte Functions
        /// </summary>
        /// <param name="transition"></param>
        public void DeleteTransition(Transition transition)
        {
            DeleteTransitionFunctions(transition);

            _db.Transitions.DeleteObject(transition);

            SaveChanges();
        }
Ejemplo n.º 15
0
        private void BuildTransistionPanel(Transition transition)
        {
            var isAdd = transition.TranistionID == 0;
            // Setup Buttons ...
            btnDelete.Visible = !isAdd;
            btnUpdateAdd.Text = isAdd ? "Add" : "Update";
            btnUpdateAdd.Enabled = false;

            if (!isAdd)
            {
                txtTransitionName.Text = transition.TransitionName;
                txtDescription.Text = transition.Description;
            }
            LoadFunctionList(transition);
        }
Ejemplo n.º 16
0
        private void LoadFunctionList(Transition transition)
        {
            var functionList = FSMFunctionLoader.GetFunctionList();
            var allFunctions = DataHelper.GetFunctions(functionList);
            // Note - these are ordered & we have to update ordering 
            //        or add new in proper order
            var orderedTransitionFunctions = DataHelper.GetTrasnsitionFunctions(transition);
            var usedFunctions = (from Function f in orderedTransitionFunctions.Values
                                   select f).ToDictionary(f => f.FunctionID, f => f);

            BuildUnusedFunctionList(allFunctions);
            BuildUsedFunctionList(orderedTransitionFunctions);
        }
Ejemplo n.º 17
0
 public void DisplayTransition(Transition transition)
 {
     ddButton.Text = transition.TransitionName;
     returnTransition = transition;
     BuildTransistionPanel(transition);
 }
Ejemplo n.º 18
0
        private void RaiseParamsEvent(List<Parameter> transitionParams, ButtonFunction buttonFunction, Transition transition)
        {
            if(ParamsActivtyEvent != null)
            {
                var args = new ParamsEventHandlerArgs();
                args.ButtonPressed = buttonFunction;
                args.TransitionParameters = transitionParams;
                args.Transition = transition;

                ParamsActivtyEvent.Invoke(null, args);
            }
        }
Ejemplo n.º 19
0
 private Function SetUpTransitionToRun(Transition transition, TransitionState currentState, string eventName)
 {
     var tFunction = (transition.TransitionFunctions).FirstOrDefault();
     var firstFunction = tFunction == null ? null : tFunction.Function;
     LoadFunctionList(transition.TransitionFunctions.ToList());
     return firstFunction;
 }
Ejemplo n.º 20
0
 private void EnterEventParams(List<Parameter> parameters, Transition transition)
 {
     frmTransitionParams parameterForm = new frmTransitionParams(parameters, transition);
     parameterForm.ParamsActivtyEvent +=new frmTransitionParams.ParamsEventHandler(parameterForm_ParamsActivtyEvent);
     parameterForm.ShowDialog();
 }