Ejemplo n.º 1
0
        private void CtrlSaving(object sender, SaveEventArgs e)
        {
            tvSiteMap.SelectedNode.Tag = e.AttributeCollection;


            string nodeFullName = TreeNodeHelper.FullNodeName(tvSiteMap.SelectedNode);

            if (nodeFullName == "Series.Series")
            {
                if (e.AttributeCollection.ContainsKey("EmailTemplateType"))
                {
                    EmailTemplateType = e.AttributeCollection["EmailTemplateType"].Value;
                }
            }

            var doc = new XmlDocument();
            XmlNode rootNode = doc.CreateElement("parent");
             doc.AppendChild(rootNode);

            AddXmlNode(tvSiteMap.Nodes[0], rootNode);
           // var tmpDoc = doc.ChildNodes[0].ChildNodes[0].OuterXml;
            
            EmailTemplateXML = doc.ChildNodes[0].ChildNodes[0].OuterXml;
            
        }
        private void TvSiteMapNodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            TreeNode selectedNode = e.Node;

            selectedNode.TreeView.SelectedNode = selectedNode;
            var collec = (Dictionary <string, ITLec.CRMFormXml.Property>)selectedNode.Tag;

            TreeNodeHelper.AddContextMenu(e.Node, this);
            Control existingControl = panelContainer.Controls.Count > 0 ? panelContainer.Controls[0] : null;

            if (existingControl != null)
            {
                panelContainer.Controls.Remove(existingControl);
                existingControl.Dispose();
                GC.Collect();
                GC.WaitForPendingFinalizers();
                GC.Collect();
            }

            panelContainer.Controls.Clear();
            BaseMainFormXmlUserControl ctrl = null;

            string fullNodeName = TreeNodeHelper.FullNodeName(selectedNode);

            if (collec != null)
            {
                ctrl = new ITLec.FormXmlManager.Controls.MainFormXmlSectionControl(fullNodeName, collec);
                if (ctrl != null)
                {
                    ctrl.Saving += CtrlSaving;
                    ctrl.Dock    = DockStyle.Fill;

                    panelContainer.Controls.Add(ctrl);
                    ctrl.BringToFront();
                    if (existingControl != null)
                    {
                        panelContainer.Controls.Remove(existingControl);
                    }
                    tsbItemSave.Visible = true;
                }
            }
            ManageMenuDisplay();
        }