/// <summary>
 ///    <para>
 ///       Initializes the designer with the component for design.
 ///    </para>
 /// </summary>
 /// <param name='component'>
 ///    The control element for design.
 /// </param>
 /// <remarks>
 ///    <para>
 ///       This is called by the designer host to establish the component for
 ///       design.
 ///    </para>
 /// </remarks>
 /// <seealso cref='System.ComponentModel.Design.IDesigner'/>
 public override void Initialize(IComponent component)
 {
     Debug.Assert(component is System.Web.UI.MobileControls.Link,
                  "LinkDesigner.Initialize - Invalid Link Control");
     _link = (System.Web.UI.MobileControls.Link) component;
     base.Initialize(component);
 }
 /// <include file='doc\XhtmlBasicValidationSummaryAdapter.uex' path='docs/doc[@for="XhtmlValidationSummaryAdapter.OnInit"]/*' />
 public override void OnInit(EventArgs e) {
     // Create child controls to help on rendering
     _list = new List();
     Control.Controls.Add(_list);
     _link = new Link();
     Control.Controls.Add(_link);
 }
Exemple #3
0
 /// <summary>
 ///    <para>
 ///       Initializes the designer with the component for design.
 ///    </para>
 /// </summary>
 /// <param name='component'>
 ///    The control element for design.
 /// </param>
 /// <remarks>
 ///    <para>
 ///       This is called by the designer host to establish the component for
 ///       design.
 ///    </para>
 /// </remarks>
 /// <seealso cref='System.ComponentModel.Design.IDesigner'/>
 public override void Initialize(IComponent component)
 {
     Debug.Assert(component is System.Web.UI.MobileControls.Link,
                  "LinkDesigner.Initialize - Invalid Link Control");
     _link = (System.Web.UI.MobileControls.Link)component;
     base.Initialize(component);
 }
Exemple #4
0
 public override void Initialize(IComponent component)
 {
     this._link = (Link) component;
     base.Initialize(component);
 }
 public DesignerLinkAdapter(Link link)
 {
     base.set_Control(link);
 }
Exemple #6
0
        /// <summary>
        /// 从HTML代码中分析出链接信息
        /// </summary>
        /// <returns>List<Link></returns>
        private List<Link> getLinks()
        {
            if (m_links.Count == 0)
            {
                Regex[] regex = new Regex[2];
                regex[0] = new Regex(@"<a\shref\s*=""(?<URL>[^""]*).*?>(?<title>[^<]*)</a>", RegexOptions.IgnoreCase | RegexOptions.Singleline);
                regex[1] = new Regex("<[i]*frame[^><]+src=(\"|')?(?<url>([^>\"'\\s)])+)(\"|')?[^>]*>", RegexOptions.IgnoreCase);

                for (int i = 0; i < 2; i++)
                {
                    Match match = regex[i].Match(m_html);
                    while (match.Success)
                    {
                        try
                        {
                            string url = HttpUtility.UrlDecode(new Uri(m_uri, match.Groups["URL"].Value).AbsoluteUri);

                            string text = "";
                            if (i == 0) text = new Regex("(<[^>]+>)|(\\s)|(&nbsp;)|&|\"", RegexOptions.Multiline | RegexOptions.IgnoreCase).Replace(match.Groups["text"].Value, "");

                            Link link = new Link();
                            link.Text = text;
                            link.NavigateUrl = url;

                            m_links.Add(link);
                        }
                        catch (Exception ex) { Console.WriteLine(ex.Message); };
                        match = match.NextMatch();
                    }
                }
            }
            return m_links;
        }