Пример #1
0
        //
        public void CreateWindow()
        {
            FactoryShape  factory = FactoryManager.getInstance().GetSelectedTool();
            ElementWindow model   = (ElementWindow)factory.CreateControl();

            m_Window        = (ElementWindow)model;
            model.Container = m_Canvas;

            bool[] hotSpot = { false, false };
            mSceneCanvas.Add(model);

            ElementProperty prop = FactoryActionParam.CreateParam(model);

            model.Property = prop;
            factory.PopulatePropertyList(prop);
            m_GridView.Tag       = prop;
            m_ActionWindow       = new ActionAdd(factory);
            m_ActionWindow.Model = model;
            // Assign a copy of Param.....
            m_ActionWindow.SetParam(prop);
            mHostory.ExcuteAction(m_ActionWindow);

            //mSceneCanvas.Canvas.Invalidate();
            PopulateControlList();
            ElementTracker.Instance.AttachHotSpotObserver(this);
            //m_Window.PropertyChangeObserver = this;
            model.OnSizeChanged();
        }
Пример #2
0
        //
        public void CreateElementWindow(XmlNode node)
        {
            FactoryShape  factory = FactoryManager.getInstance().GetFactory(node.Name);
            ElementWindow model   = (ElementWindow)factory.CreateControl();

            m_Window        = (ElementWindow)model;
            model.Container = m_Canvas;

            bool[] hotSpot = { false, false };
            mSceneCanvas.Add(model);

            ElementProperty prop = FactoryActionParam.CreateParam(model);

            model.Property = prop;
            factory.PopulatePropertyList(prop);
            m_GridView.Tag = prop;

            foreach (XmlAttribute attr in node.Attributes)
            {
                prop.SetValue(attr.Name, attr.Value);
            }

            //FIXME use Factory for action...
            m_ActionWindow       = new ActionAdd(factory);
            m_ActionWindow.Model = model;
            // Assign a copy of Param.....
            m_ActionWindow.SetParam(prop);
            mHostory.ExcuteAction(m_ActionWindow);

            //mSceneCanvas.Canvas.Invalidate();
            PopulateControlList();
            ElementTracker.Instance.AttachHotSpotObserver(this);
            //m_Window.PropertyChangeObserver = this;
            model.OnSizeChanged();

            foreach (XmlNode child in node.ChildNodes)
            {
                // We only need Control elements..
                if (child.Name == "Properties")
                {
                    continue;
                }
                //
                CreateChildlement(child);
            }
        }