//
        private void listBox1_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            int          index        = m_listItems.SelectedIndex + 1;
            FactoryShape factoryShape = FactoryManager.getInstance().SelectTool(index);
            DrawElement  model        = factoryShape.CreateControl();

            ElementProperty prop   = FactoryActionParam.CreateParam(model);
            int             id     = m_Window.List.Count + 1;
            String          strVal = factoryShape.Name + factoryShape.List.Count.ToString();

            model.Property = prop;
            prop.SetValue("Name", strVal.Trim());
            prop.SetValue("Id", id.ToString());
            prop.SetValue("Location", model.Location.X.ToString() + "," + model.Location.Y.ToString());
            prop.SetValue("Text", model.Text);
            prop.SetValue("Size", model.Width.ToString() + "," + model.Height.ToString());
            //
            factoryShape.PopulatePropertyList(prop);
            m_GridView.Tag = prop;
            //
            Action action = factoryShape.CreateAddAction(model, m_Window);

            action.SetParam(prop);
            mHostory.ExcuteAction(action);
        }
        //
        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();
        }
        //
        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);
            }
        }
        //
        public void CreateChildlement(XmlNode node)
        {
            FactoryShape factoryShape = FactoryManager.getInstance().GetFactory(node.Name);
            DrawElement  model        = factoryShape.CreateControl();

            ElementProperty prop = FactoryActionParam.CreateParam(model);

            model.Property = prop;

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


            try
            {
                XmlNodeList propertiesNodes = node.FirstChild.ChildNodes;
                foreach (XmlNode nodeProp in propertiesNodes)
                {
                    prop.SetValue(nodeProp.Name, nodeProp.InnerText);
                }
            }
            catch (Exception e)
            {
            }



            factoryShape.PopulatePropertyList(prop);
            m_GridView.Tag = prop;
            Action action = factoryShape.CreateAddAction(model, m_Window);

            action.SetParam(prop);
            //
            mHostory.ExcuteAction(action);
        }