Exemplo n.º 1
0
        //////////////////////////////////////////////////////////////////////////////

        #region URL handling

        internal static bool HandleURL(string urlString)
        {
            CAssert.IsNotEmpty(urlString);

            try
            {
                Uri    uri    = new Uri(urlString);
                string scheme = uri.Scheme;

                CURLHandler handler = FindURLHandler(scheme);
                if (handler == null)
                {
                    CLog.e("Can't find URL handler for scheme: '{0}'", scheme);
                    return(false);
                }

                return(handler(urlString));
            }
            catch (Exception e)
            {
                Debug.LogException(e);
            }

            return(false);
        }
Exemplo n.º 2
0
        private static IDictionary <string, CURLHandler> CreateURLHandlersLookup()
        {
            IDictionary <string, CURLHandler> handlers = new Dictionary <string, CURLHandler>();

            CURLHandler webPageURLHandler = delegate(string urlString)
            {
                Application.OpenURL(urlString);
                return(true);
            };

            handlers["http"]  = webPageURLHandler;
            handlers["https"] = webPageURLHandler;

            return(handlers);
        }
Exemplo n.º 3
0
        internal static CURLHandler RegisterURLHanlder(string scheme, CURLHandler handler)
        {
            if (scheme == null)
            {
                throw new ArgumentNullException("scheme");
            }

            if (handler == null)
            {
                throw new ArgumentNullException("handler");
            }

            CURLHandler oldHandler = FindURLHandler(scheme);

            s_urlHandlers[scheme] = handler;
            return(oldHandler);
        }