partial void SubmitButton_TouchUpInside(UIButton sender) { SL.RefreshProfile(); if (!SL.IsNetworkConnected("Instagram")) { UIStoryboard board = UIStoryboard.FromName("Web", null); WebViewController ctrl = (WebViewController)board.InstantiateViewController("WebViewController"); const string ClientID = "cf88ac6682e24ffe83441b6950e3134a"; const string RedirectUrl = "http://socialladderapp.com"; ctrl.Url = "https://api.instagram.com/oauth/authorize/?client_id=" + ClientID + "&redirect_uri=" + RedirectUrl + "&response_type=token"; ctrl.InstagramDelegate = this; this.PresentViewController(ctrl, false, null); } if (SL.IsNetworkConnected("Instagram")) { NSUrl instagramURL = new NSUrl("instagram://"); if (UIApplication.SharedApplication.CanOpenUrl(instagramURL)) { TakePicture(); } else { Platform.ShowAlert("Unable to find the Instagram App on your device. This challenge requires Instagram.", string.Empty); /* * var overlay = Platform.AddOverlay(); * if (overlay != null) * { * var background = Platform.AddOverlayBackground(overlay, UIColor.White); * } */ } } }
public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path) { var vc = new WebViewController(this) { Autorotate = dvc.Autorotate }; web = new UIWebView(UIScreen.MainScreen.Bounds) { BackgroundColor = UIColor.White, AutoresizingMask = UIViewAutoresizing.All }; // We delete cache and cookies so it does not remember our login information DeleteCacheandCookies(); web.LoadStarted += (webview, e) => { NetworkActivity = true; }; web.LoadFinished += (webview, e) => { NetworkActivity = false; var wb = webview as UIWebView; FacebookOAuthResult oauthResult; if (!_fb.TryParseOAuthCallbackUrl(new Uri(wb.Request.Url.ToString()), out oauthResult)) { return; } if (oauthResult.IsSuccess) { // Facebook Granted Token var accessToken = oauthResult.AccessToken; LoginSucceded(accessToken, dvc); } else { // user cancelled login LoginSucceded(string.Empty, dvc); } }; web.LoadError += (webview, args) => { NetworkActivity = false; if (web != null) { web.LoadHtmlString( String.Format("<html><center><font size=+5 color='red'>{0}:<br>{1}</font></center></html>", "An error occurred: ", args.Error.LocalizedDescription), null); } }; vc.NavigationItem.Title = Caption; vc.View.AutosizesSubviews = true; vc.View.AddSubview(web); dvc.ActivateController(vc); web.LoadRequest(NSUrlRequest.FromUrl(nsUrl)); }
public void Selected(DialogViewController controller, UITableView tableView, object item, NSIndexPath indexPath) { var frame = UIScreen.MainScreen.Bounds; Web = new UIWebView(frame) { BackgroundColor = UIColor.White, ScalesPageToFit = true, AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight }; Web.LoadStarted += (sender, e) => NetworkActivity = true; Web.LoadFinished += (sender, e) => NetworkActivity = false; Web.LoadError += (webview, args) => { NetworkActivity = false; if (Web != null) { Web.LoadHtmlString(String.Format("<html><center><font size=+5 color='red'>An error occurred:<br>{0}</font></center></html>", args.Error.LocalizedDescription), null); } }; _WebViewController = new WebViewController(this) { Autorotate = controller.Autorotate, Title = Caption }; _WebViewController.View.AddSubview(Web); controller.ActivateController(_WebViewController, controller); var url = new NSUrl(Value.AbsoluteUri); Web.LoadRequest(NSUrlRequest.FromUrl(url)); }
private void Start() { webView = new WebViewController(base.gameObject); Button component = GetComponent <Button>(); component.onClick.AddListener(onClicked); }
public override void OnElementChanged() { Controller = new WebViewController(Element); base.OnElementChanged(); Element.HandleEval(script => Control.ExecuteScript(script)); Controller.LoadSource(loadHandler); }
public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path) { var vc = new WebViewController(this) { Autorotate = dvc.Autorotate }; web = new UIWebView(UIScreen.MainScreen.ApplicationFrame) { BackgroundColor = UIColor.White, ScalesPageToFit = true, AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight }; web.LoadStarted += delegate { NetworkActivity = true; }; web.LoadFinished += delegate { NetworkActivity = false; }; web.LoadError += (webview, args) => { NetworkActivity = false; if (web != null) { web.LoadHtmlString(String.Format("<html><center><font size=+5 color='red'>An error occurred:<br>{0}</font></center></html>", args.Error.LocalizedDescription), null); } }; vc.NavigationItem.Title = Caption; vc.View.AddSubview(web); dvc.ActivateController(vc, dvc); var url = new NSUrl(Value.AbsoluteUri); web.LoadRequest(NSUrlRequest.FromUrl(url)); }
public void ShowTodo(string url) { var rootViewController = UIApplication.SharedApplication.KeyWindow.RootViewController as UINavigationController; var controller = new WebViewController(url); controller.ModalPresentationStyle = UIModalPresentationStyle.FullScreen; rootViewController.PresentViewController(controller, true, null); }
public void ShowOnPanel(string urlToken, Button scrollUp, Button scrollDown, GameObject viewerPanel, bool isDownsampled, string javaScriptLoginFunction = "") { jsLoginFunction = javaScriptLoginFunction; webView = new WebViewController(base.gameObject); addWebViewListeners(); webView.WaitForReadyToShow = waitForReadyToShow; webView.IsReadyToShow = receivedInitialLoginFunctionResponse; webView.Show(urlToken, null, viewerPanel, scrollUp, scrollDown, isDownsampled); }
public override void Selected (DialogViewController dvc, UITableView tableView, NSIndexPath path) { var vc = new WebViewController (this) { Autorotate = dvc.Autorotate }; web = new UIWebView (UIScreen.MainScreen.Bounds) { BackgroundColor = UIColor.White, AutoresizingMask = UIViewAutoresizing.All }; // We delete cache and cookies so it does not remember our login information DeleteCacheandCookies (); web.LoadStarted += (webview, e) => { NetworkActivity = true; }; web.LoadFinished += (webview, e) => { NetworkActivity = false; var wb = webview as UIWebView; FacebookOAuthResult oauthResult; if (!_fb.TryParseOAuthCallbackUrl (new Uri (wb.Request.Url.ToString()), out oauthResult)) { return; } if (oauthResult.IsSuccess) { // Facebook Granted Token var accessToken = oauthResult.AccessToken; LoginSucceded(accessToken, dvc); } else { // user cancelled login LoginSucceded(string.Empty, dvc); } }; web.LoadError += (webview, args) => { NetworkActivity = false; if (web != null) web.LoadHtmlString ( String.Format ("<html><center><font size=+5 color='red'>{0}:<br>{1}</font></center></html>", "An error occurred: ", args.Error.LocalizedDescription), null); }; vc.NavigationItem.Title = Caption; vc.View.AutosizesSubviews = true; vc.View.AddSubview (web); dvc.ActivateController (vc); web.LoadRequest (NSUrlRequest.FromUrl (nsUrl)); }
public override void LoadFailed(UIWebView webView, NSError error) { var url = GetCurrentUrl(); WebViewController.SendNavigated(new WebNavigatedEventArgs(_lastEvent, new UrlWebViewSource { Url = url }, url, WebNavigationResult.Failure)); _renderer.UpdateCanGoBackForward(); }
partial void InstagramLoginButton_TouchUpInside(UIButton sender) { InstagramConnectedImage.Image = UIImage.FromBundle("loading-indicator"); Platform.AnimateRotation(InstagramConnectedImage); UIStoryboard board = UIStoryboard.FromName("Web", null); WebViewController ctrl = (WebViewController)board.InstantiateViewController("WebViewController"); const string ClientID = "cf88ac6682e24ffe83441b6950e3134a"; const string RedirectUrl = "http://socialladderapp.com"; ctrl.Url = "https://api.instagram.com/oauth/authorize/?client_id=" + ClientID + "&redirect_uri=" + RedirectUrl + "&response_type=token"; ctrl.InstagramDelegate = this; this.PresentViewController(ctrl, false, null); }
private async Task GetResult() { try { var rootViewController = UIApplication.SharedApplication.KeyWindow.RootViewController as UINavigationController; var controller = new WebViewController(null); controller.ErrorEvent += Controller_ErrorEvent; controller.OkEvent += Controller_OkEvent; controller.ModalPresentationStyle = UIModalPresentationStyle.FullScreen; rootViewController.PresentViewController(controller, true, null); } catch (Exception e) { ShowDialog(e.Message, "msg_ok", null); } }
public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path) { var vc = new WebViewController(this) { Autorotate = dvc.Autorotate }; _web = new UIWebView(UIScreen.MainScreen.Bounds) { BackgroundColor = UIColor.White, ScalesPageToFit = true, #warning UIViewAutoresizing.All not in my version of MonoTouch - so use long form here AutoresizingMask = UIViewAutoresizing.FlexibleBottomMargin | UIViewAutoresizing.FlexibleRightMargin | UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleTopMargin | UIViewAutoresizing.FlexibleLeftMargin | UIViewAutoresizing.FlexibleWidth }; _web.LoadStarted += delegate { NetworkActivity = true; var indicator = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.White); vc.NavigationItem.RightBarButtonItem = new UIBarButtonItem(indicator); indicator.StartAnimating(); }; _web.LoadFinished += delegate { NetworkActivity = false; vc.NavigationItem.RightBarButtonItem = null; }; _web.LoadError += (webview, args) => { NetworkActivity = false; vc.NavigationItem.RightBarButtonItem = null; if (_web != null) { _web.LoadHtmlString( String.Format("<html><center><font size=+5 color='red'>{0}:<br>{1}</font></center></html>", "An error occurred:".GetText(), args.Error.LocalizedDescription), null); } }; vc.NavigationItem.Title = Caption; vc.View.AutosizesSubviews = true; vc.View.AddSubview(_web); dvc.ActivateController(vc); _web.LoadRequest(NSUrlRequest.FromUrl(_nsUrl)); }
private void showURL(string urlToken, bool isParentGate) { if (Service.Get <ConnectionManager>().ConnectionState == ConnectionManager.NetworkConnectionState.NoConnection) { Service.Get <PromptManager>().ShowError("GlobalUI.ErrorMessages.NetworkConnectionError", "GlobalUI.ErrorMessages.CheckNetworkConnection"); return; } webView = new WebViewController(base.gameObject); addWebViewListeners(); if (isParentGate) { showWebPageViaParentGate(urlToken); } else { showWebPageSubPanel(urlToken); } }
public override void Selected (DialogViewController dvc, UITableView tableView, NSIndexPath path) { tableView.DeselectRow (path, true); //base.Selected (dvc, tableView, path); var evc = new EmptyViewController(()=> { nav.PopViewControllerAnimated(true); }, Caption); var vc = new WebViewController (this) { Autorotate = dvc.Autorotate }; var web = new UIWebView (UIScreen.MainScreen.ApplicationFrame){ BackgroundColor = UIColor.White, ScalesPageToFit = true, AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight }; web.LoadStarted += delegate { NetworkActivity = true; var indicator = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.White); vc.NavigationItem.RightBarButtonItem = new UIBarButtonItem(indicator); indicator.StartAnimating(); }; web.LoadFinished += delegate { NetworkActivity = false; vc.NavigationItem.RightBarButtonItem = null; }; web.LoadError += (webview, args) => { NetworkActivity = false; vc.NavigationItem.RightBarButtonItem = null; if (web != null) web.LoadHtmlString (String.Format ("<html><center><font size=+5 color='red'>An error occurred:<br>{0}</font></center></html>", args.Error.LocalizedDescription), null); }; vc.NavigationItem.Title = Caption; vc.View.AddSubview (web); //vc.View.Frame = new RectangleF(0, 41 , 320, 480 - 41); evc.Add(vc.View); nav.PushViewController(evc, true); web.LoadRequest (NSUrlRequest.FromUrl (new NSUrl (Url))); }
public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path) { if (!Url.StartsWith("http:")) { tableView.DeselectRow(path, false); UIApplication.SharedApplication.OpenUrl(nsUrl); return; } var vc = new WebViewController(this) { Autorotate = dvc.Autorotate }; web = new UIWebView(UIScreen.MainScreen.ApplicationFrame) { BackgroundColor = UIColor.White, ScalesPageToFit = true, AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight }; web.LoadStarted += delegate { NetworkActivity = true; var indicator = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.White); vc.NavigationItem.RightBarButtonItem = new UIBarButtonItem(indicator); indicator.StartAnimating(); }; web.LoadFinished += delegate { NetworkActivity = false; vc.NavigationItem.RightBarButtonItem = null; }; web.LoadError += (webview, args) => { NetworkActivity = false; vc.NavigationItem.RightBarButtonItem = null; if (web != null) { web.LoadHtmlString(String.Format("<html><center><font size=+5 color='red'>An error occurred:<br>{0}</font></center></html>", args.Error.LocalizedDescription), null); } }; vc.NavigationItem.Title = Caption; vc.View = web; dvc.ActivateController(vc, dvc); web.LoadRequest(NSUrlRequest.FromUrl(nsUrl)); }
public override bool ShouldStartLoad(UIWebView webView, NSUrlRequest request, UIWebViewNavigationType navigationType) { var navEvent = WebNavigationEvent.NewPage; switch (navigationType) { case UIWebViewNavigationType.LinkClicked: navEvent = WebNavigationEvent.NewPage; break; case UIWebViewNavigationType.FormSubmitted: navEvent = WebNavigationEvent.NewPage; break; case UIWebViewNavigationType.BackForward: navEvent = _renderer._lastBackForwardEvent; break; case UIWebViewNavigationType.Reload: navEvent = WebNavigationEvent.Refresh; break; case UIWebViewNavigationType.FormResubmitted: navEvent = WebNavigationEvent.NewPage; break; case UIWebViewNavigationType.Other: navEvent = WebNavigationEvent.NewPage; break; } _lastEvent = navEvent; var lastUrl = request.Url.ToString(); var args = new WebNavigatingEventArgs(navEvent, new UrlWebViewSource { Url = lastUrl }, lastUrl); WebViewController.SendNavigating(args); _renderer.UpdateCanGoBackForward(); return(!args.Cancel); }
public override void LoadingFinished(UIWebView webView) { if (webView.IsLoading) { return; } _renderer._ignoreSourceChanges = true; var url = GetCurrentUrl(); ((IElementController)WebView).SetValueFromRenderer(WebView.SourceProperty, new UrlWebViewSource { Url = url }); _renderer._ignoreSourceChanges = false; var args = new WebNavigatedEventArgs(_lastEvent, WebView.Source, url, WebNavigationResult.Success); WebViewController.SendNavigated(args); _renderer.UpdateCanGoBackForward(); }
public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path) { var vc = new WebViewController(this) { Autorotate = dvc.Autorotate }; _web = new UIWebView(UIScreen.MainScreen.Bounds) { BackgroundColor = UIColor.White, ScalesPageToFit = true, AutoresizingMask = UIViewAutoresizing.All }; _web.LoadStarted += delegate { NetworkActivity = true; var indicator = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.White); vc.NavigationItem.RightBarButtonItem = new UIBarButtonItem(indicator); indicator.StartAnimating(); }; _web.LoadFinished += delegate { NetworkActivity = false; vc.NavigationItem.RightBarButtonItem = null; }; _web.LoadError += (webview, args) => { NetworkActivity = false; vc.NavigationItem.RightBarButtonItem = null; _web?.LoadHtmlString( $"<html><center><font size=+5 color='red'>{"An error occurred:".GetText()}:<br>{args.Error.LocalizedDescription}</font></center></html>", null); }; vc.NavigationItem.Title = Caption; vc.View.AutosizesSubviews = true; vc.View.AddSubview(_web); dvc.ActivateController(vc); _web.LoadRequest(NSUrlRequest.FromUrl(_nsUrl)); }
public void ShowFlow(string url, string title) { closeUserInitiated = true; webViewGameObject = new GameObject("WebView"); webViewController = new WebViewController(webViewGameObject); webViewController.OnLoaded += delegate { if (!string.IsNullOrEmpty("CPI.Membership.WebviewEventComm")) { webViewController.RegisterJSFunction("CPI.Membership.WebviewEventComm"); webViewController.CallFunction("CPI.Membership.EnableWebviewEventComm"); } }; webViewController.OnFailed += onWebViewFailed; webViewController.OnClosed += onWebViewClosed; webViewController.OnReceivedMessage += onReceivedMessage; WebViewController obj = webViewController; obj.FormatURL = (WebViewController.FormatURLDelegate)Delegate.Combine(obj.FormatURL, new WebViewController.FormatURLDelegate(setURLParameters)); IContentInterruption gate = new ParentGate(); webViewController.Show(url, gate, title, webViewPopupKey, AllowPopups: true, openPopupInNewBrowser: false, 1.8f, 3f); }
private void Start() { webView = new WebViewController(base.gameObject); }
public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path) { var vc = new WebViewController (this) { Autorotate = dvc.Autorotate }; web = new UIWebView (UIScreen.MainScreen.ApplicationFrame){ BackgroundColor = UIColor.White, ScalesPageToFit = true, AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight }; web.LoadStarted += delegate { NetworkActivity = true; }; web.LoadFinished += delegate { NetworkActivity = false; }; web.LoadError += (webview, args) => { NetworkActivity = false; if (web != null) web.LoadHtmlString (String.Format ("<html><center><font size=+5 color='red'>An error occurred:<br>{0}</font></center></html>", args.Error.LocalizedDescription), null); }; vc.NavigationItem.Title = Caption; vc.View.AddSubview (web); dvc.ActivateController (vc); web.LoadRequest (NSUrlRequest.FromUrl (nsUrl)); }
public override void Selected (DialogViewController dvc, UITableView tableView, NSIndexPath path) { int i = 0; var vc = new WebViewController (this) { Autorotate = dvc.Autorotate }; web = new UIWebView (UIScreen.MainScreen.Bounds) { BackgroundColor = UIColor.White, ScalesPageToFit = true, AutoresizingMask = UIViewAutoresizing.All }; web.LoadStarted += delegate { // this is called several times and only one UIActivityIndicatorView is needed if (i++ == 0) { var indicator = new UIActivityIndicatorView (UIActivityIndicatorViewStyle.White); vc.NavigationItem.RightBarButtonItem = new UIBarButtonItem (indicator); indicator.StartAnimating (); } NetworkActivity = true; }; web.LoadFinished += delegate { if (--i == 0) { // we stopped loading, remove indicator and dispose of UIWebView vc.NavigationItem.RightBarButtonItem = null; web.StopLoading (); web.Dispose (); } NetworkActivity = false; }; web.LoadError += (webview, args) => { NetworkActivity = false; vc.NavigationItem.RightBarButtonItem = null; if (web != null) web.LoadHtmlString ( String.Format ("<html><center><font size=+5 color='red'>{0}:<br>{1}</font></center></html>", "An error occurred:".GetText (), args.Error.LocalizedDescription), null); }; vc.NavigationItem.Title = Caption; vc.View.AutosizesSubviews = true; vc.View.AddSubview (web); dvc.ActivateController (vc); web.LoadRequest (NSUrlRequest.FromUrl (nsUrl)); }
void Start() { Instance = this; }
public override void Selected (DialogViewController dvc, UITableView tableView, NSIndexPath path) { if (!Url.StartsWith("http:")){ tableView.DeselectRow(path, false); UIApplication.SharedApplication.OpenUrl(nsUrl); return; } var vc = new WebViewController (this) { Autorotate = dvc.Autorotate }; web = new UIWebView (UIScreen.MainScreen.ApplicationFrame){ BackgroundColor = UIColor.White, ScalesPageToFit = true, AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight }; web.LoadStarted += delegate { NetworkActivity = true; var indicator = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.White); vc.NavigationItem.RightBarButtonItem = new UIBarButtonItem(indicator); indicator.StartAnimating(); }; web.LoadFinished += delegate { NetworkActivity = false; vc.NavigationItem.RightBarButtonItem = null; }; web.LoadError += (webview, args) => { NetworkActivity = false; vc.NavigationItem.RightBarButtonItem = null; if (web != null) web.LoadHtmlString (String.Format ("<html><center><font size=+5 color='red'>An error occurred:<br>{0}</font></center></html>", args.Error.LocalizedDescription), null); }; vc.NavigationItem.Title = Caption; vc.View = web; dvc.ActivateController (vc, dvc); web.LoadRequest (NSUrlRequest.FromUrl (nsUrl)); }
public override void Selected (DialogViewController dvc, UITableView tableView, NSIndexPath path) { var vc = new WebViewController (this) { Autorotate = dvc.Autorotate }; _web = new UIWebView (UIScreen.MainScreen.Bounds) { BackgroundColor = UIColor.White, ScalesPageToFit = true, #warning UIViewAutoresizing.All not in my version of MonoTouch - so use long form here AutoresizingMask = UIViewAutoresizing.FlexibleBottomMargin | UIViewAutoresizing.FlexibleRightMargin | UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleTopMargin | UIViewAutoresizing.FlexibleLeftMargin | UIViewAutoresizing.FlexibleWidth }; _web.LoadStarted += delegate { NetworkActivity = true; var indicator = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.White); vc.NavigationItem.RightBarButtonItem = new UIBarButtonItem(indicator); indicator.StartAnimating(); }; _web.LoadFinished += delegate { NetworkActivity = false; vc.NavigationItem.RightBarButtonItem = null; }; _web.LoadError += (webview, args) => { NetworkActivity = false; vc.NavigationItem.RightBarButtonItem = null; if (_web != null) _web.LoadHtmlString ( String.Format ("<html><center><font size=+5 color='red'>{0}:<br>{1}</font></center></html>", "An error occurred:".GetText (), args.Error.LocalizedDescription), null); }; vc.NavigationItem.Title = Caption; vc.View.AutosizesSubviews = true; vc.View.AddSubview (_web); dvc.ActivateController (vc); _web.LoadRequest (NSUrlRequest.FromUrl (_nsUrl)); }