protected void ExecuteHsm(string modelName, qf4net.ILQHsm hsm)
        {
            TestAppForm appForm = _Context.AppForm ();
            try
            {
                qf4net.ModelInformation modelInformation = hsm.ModelInformation;

                StateDiagramView sd = new StateDiagramView (false);
                sd.StateControl.SetStateMachine (_LastFileName, hsm);

            #warning Cleanup this code - this control uses knowledge of its parent - below (TestAppForm) and above (StateDiagramView)
                // find Top level form

                if (appForm != null)
                {
                    appForm.AddChild (modelName, modelName, sd);
                    appForm.RegisterHsm (hsm);
                }
                else
                {
                    Form frm = new Form ();
                    frm.Text = modelName;
                    frm.Controls.Add (sd);
                    sd.Dock = DockStyle.Fill;
                    frm.Show ();
                }
            }
            catch {}
        }
 public bool Edit(qf4net.IQEventEditContext context)
 {
     Form frm = context.Container as Form;
     _StringEntry = new StringEntry ();
     if (context.Instance != null)
     {
         _StringEntry.InputText = (string) context.Instance;
     }
     frm.Controls.Add (_StringEntry);
     _StringEntry.Dock = DockStyle.Fill;
     _StringEntry.Select ();
     bool ok = true;
     while (ok)
     {
         ok = context.Edit ();
         if (ok && _StringEntry.InputText.Trim () != "")
         {
             context.Instance = _StringEntry.InputText;
             break;
         }
     }
     return ok;
 }
        public void SetStateMachine(string parentModelFile, qf4net.ILQHsm hsm)
        {
            lastDirectory = System.IO.Path.GetDirectoryName (parentModelFile);
            string fileName = FindFile (hsm.ModelInformation.FileName);

            LoadFileCommand command = new LoadFileCommand (fileName, this);
            command.Execute ();

            QHsmExecutionControllerView view = new QHsmExecutionControllerView ();
            string typeName = string.Format ("{0}.{1}, TestGeneratedStateMachines", _Model.Header.NameSpace, _Model.Header.Name);
            view.Controller = new QHsmExecutionController (_Model);
            view.Controller.Refresh += new EventHandler(RefreshView);
            view.SetMachine (hsm);
            StateDiagramView dv = this.Parent as StateDiagramView;
            dv.SetExecutionWindow (view);
            view.Show ();
        }
 protected EditorAttribute GetEditorType(qf4net.TransitionEventAttribute te)
 {
     if (_Editors.Contains (te.DataType))
     {
         return _Editors [te.DataType] as EditorAttribute;
     }
     foreach (EditorAttribute editor in te.DataType.GetCustomAttributes (typeof (EditorAttribute), false))
     {
         return editor;
     }
     throw new NotSupportedException (te.ToString () + " TransitionEventAttribute does not have a supported Editor");
 }
 protected qf4net.IQEventEditor GetEditor(qf4net.TransitionEventAttribute te)
 {
     EditorAttribute editor = GetEditorType (te);
     Type editorType = Type.GetType (editor.EditorTypeName);
     object editorObj = Activator.CreateInstance (editorType);
     qf4net.IQEventEditor eventEditor = editorObj as qf4net.IQEventEditor;
     if (eventEditor == null)
     {
         throw new ArgumentException (editor.EditorTypeName + " is not a valid IQEventEditor Type");
     }
     return eventEditor;
 }
 public void SetMachine(qf4net.ILQHsm hsm)
 {
     typeNameInput.Text = hsm.GetType ().FullName;
     Controller.Execute (hsm);
 }
예제 #7
0
 public void RegisterHsm(qf4net.ILQHsm hsm)
 {
     hsm.EventManager.PolledEvent += new qf4net.PolledEventHandler(EventManager_PolledEvent);
     hsm.StateChange += new EventHandler(hsm_StateChange);
     hsm.DispatchException += new qf4net.DispatchExceptionHandler(hsm_DispatchException);
     hsm.UnhandledTransition += new qf4net.DispatchUnhandledTransitionHandler(hsm_UnhandledTransition);
 }
예제 #8
0
 private void hsm_UnhandledTransition(qf4net.IQHsm hsm, System.Reflection.MethodInfo stateMethod, qf4net.IQEvent ev)
 {
     _WriterWriteLine (Color.Crimson, "[{0}] Unhandled Event: {1}", hsm, ev);
 }
예제 #9
0
 private void hsm_DispatchException(Exception ex, qf4net.IQHsm hsm, System.Reflection.MethodInfo stateMethod, qf4net.IQEvent ev)
 {
     _WriterWriteLine (Color.Red, "[{0}] Exception: on event {1}\n{2}", hsm, ev, ex.ToString ());
 }
예제 #10
0
 private void EventManager_PolledEvent(qf4net.IQEventManager eventManager, qf4net.IQHsm hsm, qf4net.IQEvent ev, qf4net.PollContext pollContext)
 {
     //_WriterWriteLine (Color.Gray, "Ev: {0} {1} {2} {3}", pollContext, ev.GetHashCode (), ev.QSignal, ev.QData);
 }