Пример #1
0
        /// <summary>
        /// this version supports global (per namespace) designers only, for &lt;asp:hyperlink> it is "asp" bstrBehavior contains the
        /// element name, for &lt;asp:hyperlink> it is "hyperlink".
        /// </summary>
        /// <param name="bstrBehavior"></param>
        /// <param name="bstrBehaviorUrl"></param>
        /// <param name="pSite"></param>
        /// <returns></returns>
        Interop.IElementBehavior Interop.IElementBehaviorFactory.FindBehavior(string bstrBehavior, string bstrBehaviorUrl, Interop.IElementBehaviorSite pSite)
        {
            if (saving)
            {
                return(null);
            }
            Interop.IHTMLElement element = pSite.GetElement();
            if (!IsRenderable(element))
            {
                return(null);
            }
            string tagPrefix = ((Interop.IHTMLElement2)element).GetScopeName();

            if (!_registeredBehaviors.ContainsKey(tagPrefix))
            {
                return(null);
            }
            if (_registeredBehaviors[tagPrefix] == null)
            {
                return(null);
            }
            IBaseBehavior o = Activator.CreateInstance(_registeredBehaviors[tagPrefix], _editor) as IBaseBehavior;

            _behaviorInstances.Add(element, o); // just for cleaning up
            string f = String.Concat(tagPrefix, ":", element.GetTagName());

            if (((GuruComponents.Netrix.ElementFactory)((HtmlEditor)this._editor).GenericElementFactory).IsRegistered(f))
            {
                return((IBaseBehavior)o);
            }
            else
            {
                return(null);
            }
        }
Пример #2
0
    void Interop.IElementBehavior.Init(Interop.IElementBehaviorSite site)
    {
        Dictionary <string, int> dictionary1;
        string text2;
        string text3;
        string text4;
        int    num1;

        this.behaviorSite = site;
        if (4 == 0)
        {
            goto Label_01AE;
        }
        this.attachedElement = (Interop.IHTMLElement2)site.GetElement();
        this.paintSite       = (Interop.IHTMLPaintSite) this.behaviorSite;
        IConnectionPointContainer container1 = (IConnectionPointContainer)this.attachedElement;
        Guid   guid1 = Guid.Empty;
        string text1 = container1.GetType().Name;

        if (text1.EndsWith("Class"))
        {
            text2 = container1.GetType().Name.Substring(0, text1.Length - 5) + "Events2";
            if (text1 == "HTMLInputElementClass")
            {
                goto Label_03D4;
            }
            if ((((uint)num1) + ((uint)num1)) <= uint.MaxValue)
            {
                goto Label_022E;
            }
            if ((((uint)num1) <= uint.MaxValue) && ((((uint)num1) | uint.MaxValue) == 0))
            {
                goto Label_012B;
            }
            goto Label_024A;
        }
        return;

Label_00D9:
        if ((0 == 0) && ((((uint)num1) & 0) == 0))
        {
            goto Label_0107;
        }
Label_00DC:
        //if (<PrivateImplementationDetails>{FDFC6380-7665-4920-BE96-D8D7777662F6}.$$method0x6000139-1.TryGetValue(text4, out num1))
        {
            switch (num1)
            {
            case 0:
                text2 = "HTMLInputTextElementEvents2";
                if (4 != 0)
                {
                    if ((((uint)num1) - ((uint)num1)) >= 0)
                    {
                    }
                    goto Label_0107;
                }
                if (0 == 0)
                {
                    goto Label_02C9;
                }
                if (-2147483648 != 0)
                {
                    goto Label_03D4;
                }
                goto Label_0360;

            case 1:
                text2 = "HTMLOptionButtonElementEvents2";
                goto Label_0107;

            case 2:
                text2 = "HTMLButtonElementEvents2";
                goto Label_0107;

            case 3:
                goto Label_02C9;

            case 4:
                text2 = "HTMLElementEvents2";
                goto Label_0107;

            case 5:
                throw new NotImplementedException("dunno correct class");

            case 6:
                text2 = "HTMLInputTextElementEvents2";
                goto Label_0107;
            }
        }
Label_0107:
        text3 = "mshtml." + text2 + ", Microsoft.mshtml, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a";
        if (((((uint)num1) + ((uint)num1)) <= uint.MaxValue) && ((((uint)num1) + ((uint)num1)) < 0))
        {
            goto Label_016C;
        }
        Type type1 = Type.GetType(text3);

        try
        {
            guid1 = type1.GUID;
            container1.FindConnectionPoint(ref guid1, out this.x09a9fe7720941e5b);
            this.x09a9fe7720941e5b.Advise(this.myEvents, out this.xc151a99213d76447);
            this.myEvents.ElementEvent += new ElementEventHandler(this.eventHandler);
        }
        catch
        {
            MessageBox.Show("Could not attach events for " + ((Interop.IHTMLElement) this.attachedElement).outerHTML);
        }
        return;

Label_011E:
        if (text1 == "HTMLDivElementClass")
        {
            goto Label_016C;
        }
Label_012B:
        if (text1 != "HTMLSpanElementClass")
        {
            goto Label_0107;
        }
        text2 = "HTMLElementEvents2";
        goto Label_00D9;
Label_016C:
        text2 = "HTMLElementEvents2";
        goto Label_0107;
Label_0177:
        if (text1 == "HTMLAnchorElementClass")
        {
            text2 = "HTMLAnchorEvents2";
            if (((uint)num1) >= 0)
            {
                goto Label_0107;
            }
            if ((((uint)num1) - ((uint)num1)) < 0)
            {
                goto Label_00D9;
            }
            if ((((uint)num1) | 1) != 0)
            {
                goto Label_01AE;
            }
            goto Label_022E;
        }
        if ((((uint)num1) + ((uint)num1)) > uint.MaxValue)
        {
            if (0 != 0)
            {
                goto Label_0177;
            }
            goto Label_011E;
        }
        if (((uint)num1) <= uint.MaxValue)
        {
            goto Label_011E;
        }
        goto Label_016C;
Label_01AE:
        if ((((uint)num1) | 15) == 0)
        {
            goto Label_022E;
        }
        if (0xff != 0)
        {
            goto Label_0177;
        }
Label_01CD:
        if ((((uint)num1) & 0) != 0)
        {
            goto Label_01AE;
        }
        goto Label_0177;
Label_022E:
        if (text1 != "HTMLGenericElementClass")
        {
            if (-1 != 0)
            {
                goto Label_01CD;
            }
            goto Label_0107;
        }
Label_024A:
        text2 = "HTMLElementEvents2";
        goto Label_0107;
Label_02C9:
        text2 = "HTMLElementEvents2";
        goto Label_0107;
Label_0360:
        dictionary1 = new Dictionary <string, int>(7);
        dictionary1.Add("text", 0);
        dictionary1.Add("option", 1);
        dictionary1.Add("button", 2);
        dictionary1.Add("submit", 3);
        dictionary1.Add("radio", 4);
        dictionary1.Add("image", 5);
        dictionary1.Add("hidden", 6);
        //<PrivateImplementationDetails>{FDFC6380-7665-4920-BE96-D8D7777662F6}.$$method0x6000139-1 = dictionary1;
        goto Label_00DC;
Label_03D4:
        if ((text4 = ((HTMLInputElementClass)container1).type) == null)
        {
            goto Label_0107;
        }
        //if (<PrivateImplementationDetails>{FDFC6380-7665-4920-BE96-D8D7777662F6}.$$method0x6000139-1 == null)
        {
            goto Label_0360;
        }
        goto Label_00DC;
    }