Ejemplo n.º 1
0
            public override bool ShouldFollowLink(OHAttributedLabel sender, NSObject linkInfo)
            {
                var a = (NSUrl)MonoTouch.ObjCRuntime.Runtime.GetNSObject(MonoTouch.ObjCRuntime.Messaging.IntPtr_objc_msgSend(linkInfo.Handle, MonoTouch.ObjCRuntime.Selector.GetHandle("URL")));

                try
                {
                    if (a.AbsoluteString.StartsWith("http"))
                    {
                        if (_parent.WebLinkClicked != null)
                        {
                            _parent.WebLinkClicked(a);
                        }
                    }
                    else
                    {
                        var id = Int32.Parse(a.AbsoluteString);
                        _links[id].Callback();
                    }
                }
                catch (Exception e)
                {
                    MonoTouch.Utilities.LogException("Unable to callback on OHAttributedLabel", e);
                }
                return(false);
            }
Ejemplo n.º 2
0
 public override bool ShouldFollowLink(OHAttributedLabel sender, NSObject linkInfo)
 {
     var a = (NSUrl)MonoTouch.ObjCRuntime.Runtime.GetNSObject (MonoTouch.ObjCRuntime.Messaging.IntPtr_objc_msgSend(linkInfo.Handle, MonoTouch.ObjCRuntime.Selector.GetHandle ("URL")));
     try
     {
         if (a.AbsoluteString.StartsWith("http"))
         {
             if (_parent.WebLinkClicked != null)
                 _parent.WebLinkClicked(a);
         }
         else
         {
             var id = Int32.Parse(a.AbsoluteString);
             _links[id].Callback();
         }
     }
     catch (Exception e)
     {
         MonoTouch.Utilities.LogException("Unable to callback on OHAttributedLabel", e);
     }
     return false;
 }