示例#1
0
        public virtual void OnNodeAfterSelection(TreeViewEventArgs e)
        {
            HtmlElement_Base he   = HtmlElement;
            Guid             guid = Guid.Empty;

            if (string.CompareOrdinal(he.tagName, "body") != 0)
            {
                if (he.ElementGuid != Guid.Empty)
                {
                    guid = he.ElementGuid;
                }
            }
            if (guid != Guid.Empty)
            {
                TreeViewObjectExplorer tv = this.TreeView as TreeViewObjectExplorer;
                if (tv != null)
                {
                    TreeNodeClassRoot r = tv.RootClassNode;
                    if (r != null && r.ClassData.DesignerHolder != null)
                    {
                        r.ClassData.DesignerHolder.OnSelectedHtmlElement(guid, tv);
                    }
                }
            }
        }
示例#2
0
 public void OnSelectHtmlElement(HtmlElement_Base he)
 {
     this.ClassPointer = he;
     OnSetImage();
     base.SetLabelText(string.Format(CultureInfo.InvariantCulture, "current element:{0}", he.ToString()));
     this.Refresh();
 }
示例#3
0
        public override void OnWriteToXmlNode(IXmlCodeWriter writer, XmlNode node)
        {
            base.OnWriteToXmlNode(writer, node);
            HtmlElement_Base he = this.ClassPointer as HtmlElement_Base;

            if (he != null)
            {
                XmlUtil.SetAttribute(node, XmlTags.XMLATT_guid, he.ElementGuidString);
            }
        }
示例#4
0
        protected override void OnSelectByMouseDown()
        {
            base.OnSelectByMouseDown();
            HtmlElement_Base heb = this.HtmlElement;

            if (heb != null)
            {
                DesignerPane.OnSelectedHtmlElement(heb.ElementGuid, this.Parent);
            }
        }
示例#5
0
        public override bool OnDeserialize(ClassPointer root, ILimnorDesigner designer)
        {
            HtmlElement_Base c = this.HtmlElement;

            if (c == null)
            {
                c = new HtmlElement_body(root);
            }
            Init(designer, c);
            return(true);
        }
示例#6
0
        public override void SetLabelText(string name)
        {
            HtmlElement_Base heb = this.ClassPointer as HtmlElement_Base;

            if (heb != null)
            {
                base.SetLabelText(string.Format(CultureInfo.InvariantCulture, "current element:{0}", heb.ToString()));
            }
            else
            {
                base.SetLabelText("current element:");
            }
        }
        public override void LoadNextLevel(TreeViewObjectExplorer tv, TreeNodeObject parentNode)
        {
            UInt32           scopeId = parentNode.ScopeMethodId;
            HtmlElement_Base objRef  = (HtmlElement_Base)parentNode.OwnerIdentity;

            parentNode.Nodes.Add(new TreeNodeHtmlPropertyCollection(tv, parentNode, objRef, scopeId));
            if (parentNode.SelectionTarget == EnumObjectSelectType.All || parentNode.SelectionTarget == EnumObjectSelectType.Event || !string.IsNullOrEmpty(parentNode.EventScope))
            {
                parentNode.Nodes.Add(new TreeNodeHtmlEventCollection(tv, parentNode, objRef, scopeId));
            }
            if (parentNode.SelectionTarget == EnumObjectSelectType.All || parentNode.SelectionTarget == EnumObjectSelectType.Method || parentNode.SelectionTarget == EnumObjectSelectType.Action || parentNode.SelectionTarget == EnumObjectSelectType.Object)
            {
                parentNode.Nodes.Add(new TreeNodeHtmlMethodCollection(tv, parentNode, objRef, scopeId));
            }
        }
示例#8
0
        public override void OnReadFromXmlNode(IXmlCodeReader reader, XmlNode node)
        {
            base.OnReadFromXmlNode(reader, node);
            string           guid = XmlUtil.GetAttribute(node, XmlTags.XMLATT_guid);
            XmlObjectReader  xr   = reader as XmlObjectReader;
            ClassPointer     root = xr.ObjectList.RootPointer as ClassPointer;
            HtmlElement_Base he   = null;

            if (!string.IsNullOrEmpty(guid))
            {
                he = root.FindHtmlElementByGuid(new Guid(guid));
            }
            if (he == null)
            {
                he = new HtmlElement_body(root);
            }
            this.ClassPointer = he;
        }
示例#9
0
        public static int GetHtmlElementIcon(HtmlElement_Base he)
        {
            string webFolder = he.WebPhysicalFolder;
            int    n;
            string imgKey = he.ImageKey;

            if (imgList == null)
            {
                imgList = new Dictionary <string, int>();
            }
            if (imgList.TryGetValue(imgKey, out n))
            {
                return(n);
            }
            Image img = he.ImageIcon;

            n = TreeViewObjectExplorer.ObjectImageList.Images.Add(img, Color.White);
            imgList.Add(imgKey, n);
            return(n);
        }
 public TreeNodeHtmlMethodCollection(TreeViewObjectExplorer tv, TreeNodeObject parentNode, HtmlElement_Base objectPointer, UInt32 scopeMethodId)
     : base(tv, parentNode, false, objectPointer, scopeMethodId)
 {
     Text = "Methods inherited";
     Nodes.Add(new HtmlMethodLoader());
 }
示例#11
0
        private int getTreeIcon()
        {
            HtmlElement_Base heb = HtmlElement;

            return(GetHtmlElementIcon(heb));
        }
示例#12
0
 public TreeNodeHtmlEventCollection(TreeViewObjectExplorer tv, TreeNodeObject parentNode, HtmlElement_Base objectPointer, UInt32 scopeMethodId)
     : base(tv, parentNode, false, objectPointer, scopeMethodId)
 {
     Text = "Events inherited";
 }
 public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     if (context != null && context.Instance != null && provider != null)
     {
         IWindowsFormsEditorService service = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
         if (service != null)
         {
             string            title  = null;
             string            filter = null;
             FilePathAttribute fa     = null;
             if (context.PropertyDescriptor.Attributes != null)
             {
                 foreach (Attribute a in context.PropertyDescriptor.Attributes)
                 {
                     fa = a as FilePathAttribute;
                     if (fa != null)
                     {
                         title  = fa.Title;
                         filter = fa.Pattern;
                         break;
                     }
                 }
             }
             if (string.IsNullOrEmpty(title))
             {
                 title  = "Select web file";
                 filter = "All files|*.*";
             }
             ParameterValue pv = context.Instance as ParameterValue;
             if (pv != null)
             {
                 OpenFileDialog dlg = new OpenFileDialog();
                 if (value != null)
                 {
                     dlg.FileName = value.ToString();
                 }
                 dlg.Title  = title;
                 dlg.Filter = filter;
                 if (dlg.ShowDialog() == DialogResult.OK)
                 {
                     value = dlg.FileName;
                 }
             }
             else
             {
                 HtmlElement_Base heb = context.Instance as HtmlElement_Base;
                 if (heb != null)
                 {
                     try
                     {
                         //the dialog will copy the selected file to web folder
                         DialogHtmlFile dlg = new DialogHtmlFile();
                         dlg.LoadData(heb.WebPhysicalFolder, value as string, title, filter);
                         if (service.ShowDialog(dlg) == DialogResult.OK)
                         {
                             HtmlElement_object hob = heb as HtmlElement_object;
                             if (hob != null && string.CompareOrdinal(context.PropertyDescriptor.Name, "archive") == 0)
                             {
                                 hob.AppendArchiveFile(hob.id, dlg.WebFile);
                             }
                             else
                             {
                                 heb.SetWebProperty(context.PropertyDescriptor.Name, dlg.WebFile);
                                 value = dlg.WebFile;
                             }
                         }
                     }
                     catch (Exception err)
                     {
                         MessageBox.Show(err.Message);
                     }
                 }
             }
         }
     }
     return(value);
 }
示例#14
0
 public void SelectHtmlElementByGuid(Guid guid)
 {
     webBrowser1.Document.InvokeScript("setSelectedObject", new object[] { HtmlElement_Base.GetGuidString(guid) });
 }
示例#15
0
 public void SwitchHtmlElement(HtmlElement_Base element)
 {
     this.ResetObjectPointer(element);
     this.ResetNextLevel(this.TreeView as TreeViewObjectExplorer);
 }
示例#16
0
        public override bool IsSameElement(HtmlElement_Base e)
        {
            HtmlElement_body bd = e as HtmlElement_body;

            return(bd != null);
        }
示例#17
0
 public void OnHtmlElementSelected(HtmlElement_Base element)
 {
 }
 public void SelectHtmlElementByGuid(Guid guid)
 {
     ExecuteJs("setSelectedObject('{0}');", HtmlElement_Base.GetGuidString(guid));
 }
 public void OnHtmlElementSelected(HtmlElement_Base element)
 {
     _objExplorer.OnHtmlElementSelected(element);
 }
示例#20
0
 public void OnHtmlElementSelected(HtmlElement_Base element)
 {
     _eventPath.OnHtmlElementSelected(element);
 }