public MsalAuthenticationAgentUIViewController(string url, string callback, ReturnCodeCallback callbackMethod)
 {
     this.url            = url;
     this.callback       = callback;
     this.callbackMethod = callbackMethod;
     NSUrlProtocol.RegisterClass(new ObjCRuntime.Class(typeof(CoreCustomUrlProtocol)));
 }
Ejemplo n.º 2
0
        public override bool FinishedLaunching(UIApplication application, NSDictionary options)
        {
            // Register our custom url protocol
            NSUrlProtocol.RegisterClass(new MonoTouch.ObjCRuntime.Class(typeof(ImageProtocol)));

            controller = new UIViewController();

            web = new UIWebView(UIScreen.MainScreen.Bounds)
            {
                BackgroundColor  = UIColor.White,
                ScalesPageToFit  = true,
                AutoresizingMask = UIViewAutoresizing.All
            };
            controller.NavigationItem.Title = "Test case";

            controller.View.AutosizesSubviews = true;
            controller.View.AddSubview(web);

            web.LoadRequest(NSUrlRequest.FromUrl(NSUrl.FromFilename(NSBundle.MainBundle.PathForResource("test", "html"))));

            window = new UIWindow(UIScreen.MainScreen.Bounds);
            window.MakeKeyAndVisible();
            window.RootViewController = controller;

            return(true);
        }
Ejemplo n.º 3
0
 public AuthenticationAgentNSWindowController(string url, string callback, ReturnCodeCallback callbackMethod)
     : base("PlaceholderNibNameToForceWindowLoad")
 {
     _url            = url;
     _callback       = callback;
     _callbackMethod = callbackMethod;
     NSUrlProtocol.RegisterClass(new ObjCRuntime.Class(typeof(CoreCustomUrlProtocol)));
 }
Ejemplo n.º 4
0
        public static void EnableJsBridge()
        {
            if (!protocolRegistered)
            {
                NSUrlProtocol.RegisterClass(new MonoTouch.ObjCRuntime.Class(typeof(AppProtocolHandler)));

                protocolRegistered = true;
            }
        }
Ejemplo n.º 5
0
        public override void AwakeFromNib()
        {
            NSUrlProtocol.RegisterClass(new MonoMac.ObjCRuntime.Class(typeof(NdcProtocol)));

            string html = "https://developer.mozilla.org/en-US/demos/detail/guitar-chord-diagrams-html5-web-component/launch";

            html = "ndc://test.html";
            browser.MainFrame.LoadRequest(NSUrlRequest.FromUrl(NSUrl.FromString(html)));
            base.AwakeFromNib();
        }
        /// <summary>
        /// Hides the AbstractServiceLocator class static method by using the keyword new.
        /// </summary>
        /// <returns>Singleton IServiceLocator.</returns>
        public new static IServiceLocator GetInstance()
        {
            if (singletonServiceLocator == null)
            {
                singletonServiceLocator = new IPhoneServiceLocator();

                NSUrlProtocol.RegisterClass(new MonoTouch.ObjCRuntime.Class(typeof(IPhoneNSUrlProtocol)));
            }
            return(singletonServiceLocator);
        }
Ejemplo n.º 7
0
        public void Registration()
        {
            Class c = new Class(typeof(CustomProtocol));
            bool  res;

            res = NSUrlProtocol.RegisterClass(c);

            Assert.That(res, "#1");

            NSUrlProtocol.UnregisterClass(c);
        }
Ejemplo n.º 8
0
 public static void EnableJSBridge(IWebBrowser browser)
 {
     m_browser = browser;
     if (m_browser == null)
     {
         throw new ArgumentNullException("IWebBrowser cannot be null");
     }
     if (!ProtocolRegistered)
     {
         NSUrlProtocol.RegisterClass(new Class(typeof(AppProtocolHandler)));
         ProtocolRegistered = true;
     }
 }
Ejemplo n.º 9
0
 /// <summary>
 ///     Creates a new instance of this class for the provided <see cref="UIWebView" /> with the provided string as the
 ///     custom
 ///     url protocol
 ///     and passed collection of <see cref="IBridgeHandler" /> instances
 /// </summary>
 /// <param name="webView">The <see cref="UIWebView" /> to handle requests from</param>
 /// <param name="customProtocol">
 ///     The protocol to use for communication with web browser, or <see langword="null" /> to use
 ///     defualt
 /// </param>
 /// <param name="collection">The collection of <see cref="IBridgeHandler" /> instances to add to this list</param>
 public UIWebViewHybridBridge(UIWebView webView, string customProtocol,
                              IEnumerable <IBridgeHandler> collection)
     : base(customProtocol, collection)
 {
     WebView = webView;
     WebView.LoadFinished += WebView_LoadFinished;
     lock (HybridUrlProtocol.Bridges)
     {
         if (!HybridUrlProtocol.Bridges.Contains(this))
         {
             HybridUrlProtocol.Bridges.Add(this);
         }
     }
     NSUrlProtocol.RegisterClass(new Class(typeof(HybridUrlProtocol)));
 }
Ejemplo n.º 10
0
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			// Register our custom url protocol
			NSUrlProtocol.RegisterClass (new ObjCRuntime.Class (typeof (ImageProtocol)));

			var web = new WebView {
				AutoresizingMask = NSViewResizingMask.HeightSizable | NSViewResizingMask.WidthSizable
			};

			web.Frame = View.Bounds;
			View.AutoresizesSubviews = true;
			View.AddSubview (web);

			web.MainFrame.LoadRequest (NSUrlRequest.FromUrl (NSUrl.FromFilename (NSBundle.MainBundle.PathForResource ("test", "html"))));
		}
Ejemplo n.º 11
0
        /// <summary>
        /// Hides the AbstractServiceLocator class static method by using the keyword new.
        /// </summary>
        /// <returns>Singleton IServiceLocator.</returns>
        public new static IServiceLocator GetInstance()
        {
            if (singletonServiceLocator == null)
            {
                singletonServiceLocator = new IPhoneServiceLocator();


                // initialize UIApplication weak delegates
                var tsEnumerator = typedServices.GetEnumerator();
                while (tsEnumerator.MoveNext())
                {
                    var typedService = tsEnumerator.Current;
                    if (typedService.Value is IWeakDelegateManager)
                    {
                        (typedService.Value as IWeakDelegateManager).InitializeWeakDelegate();
                    }
                }

                NSUrlProtocol.RegisterClass(new ObjCRuntime.Class(typeof(IPhoneNSUrlProtocol)));
            }
            return(singletonServiceLocator);
        }
Ejemplo n.º 12
0
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            NSUrlProtocol.RegisterClass(new MonoTouch.ObjCRuntime.Class(typeof(MtRnCachingUrlProtocol)));

            _window = new UIWindow(UIScreen.MainScreen.Bounds);

            var webViewControllerSwxben    = new WebViewController("http://swxben.com", "SWXBEN");
            var webViewControllerReadify   = new WebViewController("http://readify.net", "Readify");
            var webViewControllerRgrrrrrba = new WebViewController("http://rgrrrrrba.github.io", "RGRRRRRBA");
            var localWebViewController     = new LocalWebViewController("Content/Web/index.html", "Local");

            _tabBarController = new UITabBarController();
            _tabBarController.ViewControllers = new UIViewController [] {
                webViewControllerSwxben,
                webViewControllerReadify,
                webViewControllerRgrrrrrba,
                localWebViewController,
            };

            _window.RootViewController = _tabBarController;
            _window.MakeKeyAndVisible();

            return(true);
        }
Ejemplo n.º 13
0
 public void useUrlSession(NSUrlRequest request)
 {
     NSUrlProtocol.RegisterClass(new ObjCRuntime.Class(typeof(CustomUrlProtocol)));
     webView.LoadRequest(request);
 }
Ejemplo n.º 14
0
 public static void Register()
 {
     urlProtocolClass = new Class(typeof(UrlProtocol));
     NSUrlProtocol.RegisterClass(urlProtocolClass);
 }