Ejemplo n.º 1
0
        protected virtual Tuple <Form, Clifton.MycroParser.MycroParser> InitializeViewer(string formName)
        {
            Clifton.MycroParser.MycroParser mp = new Clifton.MycroParser.MycroParser();
            XmlDocument doc = new XmlDocument();

            doc.Load(formName);
            mp.Load(doc, "Form", null);
            Form form = (Form)mp.Process();

            return(new Tuple <Form, MycroParser.MycroParser>(form, mp));
        }
Ejemplo n.º 2
0
        public static T InstantiateFromFile <T>(string filename, Action <MycroParser> AddInstances = null, object eventSink = null)
        {
            MycroParser mp = new MycroParser();

            AddInstances.IfNotNull(t => t(mp));
            XmlDocument doc = new XmlDocument();

            doc.Load(filename);
            mp.Load(doc, "Form", eventSink);
            T obj = (T)mp.Process();

            // Pass object collection to the instantiated class if it implements IMycroParserInstantiatedObject.
            if (obj is IMycroParserInstantiatedObject)
            {
                ((IMycroParserInstantiatedObject)obj).ObjectCollection = mp.ObjectCollection;
            }

            return(obj);
        }
Ejemplo n.º 3
0
		protected virtual Tuple<Form, Clifton.MycroParser.MycroParser> InitializeViewer(string formName)
		{
			Clifton.MycroParser.MycroParser mp = new Clifton.MycroParser.MycroParser();
			XmlDocument doc = new XmlDocument();
			doc.Load(formName);
			mp.Load(doc, "Form", null);
			Form form = (Form)mp.Process();

			return new Tuple<Form, MycroParser.MycroParser>(form, mp);
		}
Ejemplo n.º 4
0
		public void Initialize(XmlDocument xdoc)
		{
			nodeList = new Dictionary<string, NodeDef>();
			controllerToNodeDefMap = new Dictionary<ControllerInfo, NodeDef>();
			nameToNodeDefMap = new Dictionary<string, NodeDef>();
//			LabelEdit = true;
			ImageList = new ImageList();
			Clifton.MycroParser.MycroParser mp = new Clifton.MycroParser.MycroParser();
			mp.Load(xdoc, null, null);
			// Type t = typeof(RootNode);
			// string qname = t.AssemblyQualifiedName;
			// TODO: Fix this by getting the correct qname (minus the ".RootNode") from the above commented-out code.
			mp.NamespaceMap[""] = "Clifton.Windows.Forms.XmlTree, Clifton.Windows.Forms";
			// object ret = mp.Process();
			// MessageBox.Show(ret.GetType().AssemblyQualifiedName+"\r\n"+typeof(RootNode).AssemblyQualifiedName);
			rootNode=(RootNode)mp.Process();
			nodeList[rootNode.Name] = rootNode;
			BuildFlatNodeList(rootNode);
//			TreeNode tn=CreateNodeAndRequiredChildren(rootNode);
//			Nodes.Add(tn);
		}