예제 #1
0
        protected void Process()
        {
            _ComponentContexts = new Hashtable();
            foreach (IComponentGlyph component in _Components)
            {
                Log(System.Drawing.Color.Green, "{1} {0} = new {1} ();", component.Name, component.TypeName);
                Type type = Type.GetType(component.TypeName);
                if (type == null)
                {
                    throw new NullReferenceException("Type [" + component.TypeName + "] not found");
                }
                object hsm = HsmUtil.CreateHsm(type);
                _ComponentContexts.Add(component.Name, new ComponentContext(hsm, component));
            }
            foreach (IPortLinkGlyph portLink in _Ports)
            {
                IComponentGlyph compFrom = GetComponent(portLink, TransitionContactEnd.From);
                IComponentGlyph compTo   = GetComponent(portLink, TransitionContactEnd.To);

                Log(System.Drawing.Color.Blue, "{0}.{1}.QEvents += new QEventHandler ({2}.{3}.Receive);", compFrom.Name, portLink.FromPortName, compTo.Name, portLink.ToPortName);

                ComponentContext compCtxFrom = _ComponentContexts [compFrom.Name] as ComponentContext;
                ComponentContext compCtxTo   = _ComponentContexts [compTo.Name] as ComponentContext;
                LinkPorts(compCtxFrom, compCtxTo, portLink);
            }

            foreach (DictionaryEntry de in _PortContext)
            {
                IQPort port = de.Key as IQPort;
                port.QEvents += new QEventHandler(port_QEvents);
            }
        }
예제 #2
0
        private void loadHsmButton_Click(object sender, System.EventArgs e)
        {
            string[] strlist = typeNameInput.Text.Split(',');
            if (strlist.Length != 2)
            {
                throw new FormatException("TypeName must be fully qualified");
            }
            string typeName     = strlist [0].Trim();
            string assemblyName = strlist [1].Trim();

            typeName = typeName + ", " + assemblyName;
            Type type = Type.GetType(typeName);

            if (type == null)
            {
                throw new NullReferenceException("Type [" + typeName + "] not found");
            }
            qf4net.ILQHsm hsm = HsmUtil.CreateHsm(type);
            Controller.Execute(hsm);
        }
예제 #3
0
        public void SetMachineModel(DiagramModel model, TestAppForm appForm)
        {
            CodeCompiler compiler = new CodeCompiler();

            System.CodeDom.Compiler.CompilerResults results = compiler.Compile(model);
            if (!results.Errors.HasErrors)
            {
                string        typeName = model.Header.NameSpace + "." + model.Header.Name;
                Type          type     = results.CompiledAssembly.GetType(typeName);
                qf4net.ILQHsm hsm      = HsmUtil.CreateHsm(type);
                Controller.Execute(hsm);
            }
            else
            {
                foreach (string msg in results.Output)
                {
                    appForm.Log(Color.Red, msg + "\n");
                }
            }
        }