Example #1
0
        protected void ExecuteHsm(string typeName)
        {
            /*
             * ExecutionControllerView view = new ExecutionControllerView ();
             * view.Controller = new ExecutionController (_Glyphs);
             * view.Controller.Refresh += new EventHandler(Controller_Refresh);
             * view.Show ();
             */
            QHsmExecutionControllerView view = new QHsmExecutionControllerView();

            view.Controller          = new QHsmExecutionController(_Model);
            view.Controller.Refresh += new EventHandler(_Context.RefreshView);
            view.SetMachineName(typeName);
            //view.SetMachineModel (_Model, AppForm ());
#warning Cleanup this code - this control uses knowledge of its parent
            StateDiagramView dv = _Context.ParentStateDiagramView;
            dv.SetExecutionWindow(view);
            view.Show();


            qf4net.ILQHsm hsm = view.Controller.Hsm;

            TestAppForm appForm = _Context.AppForm();
            if (appForm != null)
            {
                appForm.RegisterHsm(hsm);
            }

            qf4net.IQSupportsSubMachines supportsSubMachines = hsm as qf4net.IQSupportsSubMachines;
            if (supportsSubMachines != null)
            {
                foreach (DictionaryEntry de in supportsSubMachines.SubMachines)
                {
                    qf4net.ILQHsm subMachine = de.Value as qf4net.ILQHsm;
                    ExecuteHsm(de.Key.ToString(), subMachine);
                }
            }
        }
        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 void ExecuteHsm(string typeName)
        {
            /*
            ExecutionControllerView view = new ExecutionControllerView ();
            view.Controller = new ExecutionController (_Glyphs);
            view.Controller.Refresh += new EventHandler(Controller_Refresh);
            view.Show ();
            */
            QHsmExecutionControllerView view = new QHsmExecutionControllerView ();
            view.Controller = new QHsmExecutionController (_Model);
            view.Controller.Refresh += new EventHandler(_Context.RefreshView);
            view.SetMachineName (typeName);
            //view.SetMachineModel (_Model, AppForm ());
            #warning Cleanup this code - this control uses knowledge of its parent
            StateDiagramView dv = _Context.ParentStateDiagramView;
            dv.SetExecutionWindow (view);
            view.Show ();

            qf4net.ILQHsm hsm = view.Controller.Hsm;

            TestAppForm appForm = _Context.AppForm ();
            if (appForm != null)
            {
                appForm.RegisterHsm (hsm);
            }

            qf4net.IQSupportsSubMachines supportsSubMachines = hsm as qf4net.IQSupportsSubMachines;
            if (supportsSubMachines != null)
            {
                foreach (DictionaryEntry de in supportsSubMachines.SubMachines)
                {
                    qf4net.ILQHsm subMachine = de.Value as qf4net.ILQHsm;
                    ExecuteHsm (de.Key.ToString (), subMachine);
                }
            }
        }