コード例 #1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            Service   service   = new Service();
            Constants constants = new Constants();

            try
            {
                UIWebView UIWebviewPanorama = new UIWebView(View.Bounds);
                View.AddSubview(UIWebviewPanorama);
                if (SelectionNumber == 1)
                {
                    Galeria galeria = service.HttpGet <Galeria>(constants.Url, constants.GaleriaController, constants.GaleriaMethod, "code=16");
                    UIWebviewPanorama.LoadRequest(new NSUrlRequest(new NSUrl(galeria.Url)));
                }
                else
                {
                    Galeria galeria = service.HttpGet <Galeria>(constants.Url, constants.GaleriaController, constants.GaleriaMethod, "code=20");
                    UIWebviewPanorama.LoadRequest(new NSUrlRequest(new NSUrl(galeria.Url)));
                }
            }
            catch (Exception)
            {
            }
            // Perform any additional setup after loading the view, typically from a nib.
        }
コード例 #2
0
        public static BaseItemView Create (CGRect frame, NodeViewController nodeViewController, TreeNode node, string filePath, UIColor kleur)
        {
            var view = BaseItemView.Create(frame, nodeViewController, node, kleur);
            UIWebView webView = new UIWebView();

			string extension = Path.GetExtension (filePath);
			if (extension == ".odt") {
				string viewerPath = NSBundle.MainBundle.PathForResource ("over/viewer/index", "html");

				Uri fromUri = new Uri(viewerPath);
				Uri toUri = new Uri(filePath);
				Uri relativeUri = fromUri.MakeRelativeUri(toUri);
				String relativePath = Uri.UnescapeDataString(relativeUri.ToString());

				NSUrl finalUrl = new NSUrl ("#" + relativePath.Replace(" ", "%20"), new NSUrl(viewerPath, false));
				webView.LoadRequest(new NSUrlRequest(finalUrl));
				webView.ScalesPageToFit = true;
				view.ContentView = webView;

				return view;
			} else {
				NSUrl finalUrl = new NSUrl (filePath, false);
				webView.LoadRequest(new NSUrlRequest(finalUrl));
				webView.ScalesPageToFit = true;
				view.ContentView = webView;

				return view;
			}
		
        }
コード例 #3
0
        public static BaseItemView Create(CGRect frame, NodeViewController nodeViewController, TreeNode node, string filePath, UIColor kleur)
        {
            var       view    = BaseItemView.Create(frame, nodeViewController, node, kleur);
            UIWebView webView = new UIWebView();

            string extension = Path.GetExtension(filePath);

            if (extension == ".odt")
            {
                string viewerPath = NSBundle.MainBundle.PathForResource("over/viewer/index", "html");

                Uri    fromUri      = new Uri(viewerPath);
                Uri    toUri        = new Uri(filePath);
                Uri    relativeUri  = fromUri.MakeRelativeUri(toUri);
                String relativePath = Uri.UnescapeDataString(relativeUri.ToString());

                NSUrl finalUrl = new NSUrl("#" + relativePath.Replace(" ", "%20"), new NSUrl(viewerPath, false));
                webView.LoadRequest(new NSUrlRequest(finalUrl));
                webView.ScalesPageToFit = true;
                view.ContentView        = webView;

                return(view);
            }
            else
            {
                NSUrl finalUrl = new NSUrl(filePath, false);
                webView.LoadRequest(new NSUrlRequest(finalUrl));
                webView.ScalesPageToFit = true;
                view.ContentView        = webView;

                return(view);
            }
        }
コード例 #4
0
        void useWebView(NSUrlRequest request)
        {
            NSUrlProtocol.UnregisterClass(new ObjCRuntime.Class(typeof(CustomUrlProtocol)));

            webView.LoadRequest(request);

            //webview events
            webView.LoadStarted += (sender, e) =>
            {
                UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true;
            };

            webView.LoadFinished += (sender, e) =>
            {
                UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false;
            };

            webView.LoadError += (sender, e) =>
            {
                Console.WriteLine("load error {0}", e.ToString());
                UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false;
                var alert = UIAlertController.Create("Load Error", "Error occured while loading the url", UIAlertControllerStyle.Alert);
                alert.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Cancel, null));
                this.PresentViewController(alert, animated: true, completionHandler: null);
            };
        }
コード例 #5
0
        public override void ViewDidLoad()
        {
            Title = "Web";
            NavigationController.NavigationBar.Translucent = false;
            var webFrame = UIScreen.MainScreen.ApplicationFrame;

            webFrame.Y      += 25f;
            webFrame.Height -= 40f;

            web = new UIWebView(webFrame)
            {
                BackgroundColor  = UIColor.White,
                ScalesPageToFit  = true,
                AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight
            };
            web.LoadStarted += delegate {
                UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true;
            };
            web.LoadFinished += delegate {
                UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false;
            };
            web.LoadError += (webview, args) => {
                UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false;
                web.LoadHtmlString(String.Format("<html><center><font size=+5 color='red'>An error occurred:<br>{0}</font></center></html>", args.Error.LocalizedDescription), null);
            };
            View.AddSubview(web);

            // Delegate = new
            var urlField = new UITextField(new CGRect(20f, 10f, View.Bounds.Width - (20f * 2f), 30f))
            {
                BorderStyle            = UITextBorderStyle.Bezel,
                TextColor              = UIColor.Black,
                Placeholder            = "<enter a URL>",
                Text                   = "http://ios.xamarin.com/",
                BackgroundColor        = UIColor.White,
                AutoresizingMask       = UIViewAutoresizing.FlexibleWidth,
                ReturnKeyType          = UIReturnKeyType.Go,
                KeyboardType           = UIKeyboardType.Url,
                AutocapitalizationType = UITextAutocapitalizationType.None,
                AutocorrectionType     = UITextAutocorrectionType.No,
                ClearButtonMode        = UITextFieldViewMode.Always
            };

            urlField.ShouldReturn = delegate(UITextField field){
                field.ResignFirstResponder();
                web.LoadRequest(NSUrlRequest.FromUrl(new NSUrl(field.Text)));

                return(true);
            };

            View.AddSubview(urlField);

            web.LoadRequest(NSUrlRequest.FromUrl(new NSUrl("http://ios.xamarin.com/")));
        }
コード例 #6
0
		public override void ViewDidLoad ()
		{
			Title = "Web";
			NavigationController.NavigationBar.Translucent = false;
			var webFrame = UIScreen.MainScreen.ApplicationFrame;
			webFrame.Y += 25f;
			webFrame.Height -= 40f;

			web = new UIWebView (webFrame) {
				BackgroundColor = UIColor.White,
				ScalesPageToFit = true,
				AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight
			};
			web.LoadStarted += delegate {
				UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true;
			};
			web.LoadFinished += delegate {
				UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false;
			};
			web.LoadError += (webview, args) => {
				UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false;
				web.LoadHtmlString (String.Format ("<html><center><font size=+5 color='red'>An error occurred:<br>{0}</font></center></html>", args.Error.LocalizedDescription), null);
			};
			View.AddSubview (web);

			// Delegate = new
			var urlField = new UITextField (new CGRect (20f, 10f, View.Bounds.Width - (20f * 2f), 30f)){
				BorderStyle = UITextBorderStyle.Bezel,
				TextColor = UIColor.Black,
				Placeholder = "<enter a URL>",
				Text = "http://ios.xamarin.com/",
				BackgroundColor = UIColor.White,
				AutoresizingMask = UIViewAutoresizing.FlexibleWidth,
				ReturnKeyType = UIReturnKeyType.Go,
				KeyboardType = UIKeyboardType.Url,
				AutocapitalizationType = UITextAutocapitalizationType.None,
				AutocorrectionType = UITextAutocorrectionType.No,
				ClearButtonMode = UITextFieldViewMode.Always
			};

			urlField.ShouldReturn = delegate (UITextField field){
				field.ResignFirstResponder ();
				web.LoadRequest (NSUrlRequest.FromUrl (new NSUrl (field.Text)));

				return true;
			};

			View.AddSubview (urlField);

			web.LoadRequest (NSUrlRequest.FromUrl (new NSUrl ("http://ios.xamarin.com/")));
		}
コード例 #7
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();



            var url = uri;

            //loadingOverlay.Hide();

            webview_Main = new UIWebView();

            webview_Main.Frame = new CoreGraphics.CGRect(0, 0, View.Bounds.Width, View.Bounds.Height);



            webview_Main.LoadRequest(new NSUrlRequest(new NSUrl(url)));
            // Perform any additional setup after loading the view, typically from a nib.

            webview_Main.LoadStarted    += Webview_Main_LoadStarted;
            webview_Main.LoadFinished   += Webview_Main_LoadFinished;
            webview_Main.ScalesPageToFit = true;

            View.AddSubview(webview_Main);
            //View.BringSubviewToFront(webview_Main);
        }
コード例 #8
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();
            navBar = new UIToolbar ();
            navBar.Frame = new RectangleF (0, this.View.Frame.Height-130, this.View.Frame.Width, 40);

            items = new UIBarButtonItem [] {
                new UIBarButtonItem ("Back", UIBarButtonItemStyle.Bordered, (o, e) => { webView.GoBack (); }),
                new UIBarButtonItem ("Forward", UIBarButtonItemStyle.Bordered, (o, e) => { webView.GoForward (); }),
                new UIBarButtonItem (UIBarButtonSystemItem.FlexibleSpace, null),
                new UIBarButtonItem (UIBarButtonSystemItem.Refresh, (o, e) => { webView.Reload (); }),
                new UIBarButtonItem (UIBarButtonSystemItem.Stop, (o, e) => { webView.StopLoading (); })
            };
            navBar.Items = items;

            SetNavBarColor();

            webView = new UIWebView ();
            webView.Frame = new RectangleF (0, 0, this.View.Frame.Width, this.View.Frame.Height-130);

            webView.LoadStarted += delegate {
                UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true;
            };
            webView.LoadFinished += delegate {
                UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false;
            };

            webView.ScalesPageToFit = true;
            webView.SizeToFit ();
            webView.LoadRequest (url);

            this.View.AddSubview (webView);
            this.View.AddSubview (navBar);
        }
コード例 #9
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var webFrame = new RectangleF(0, 0, this.View.Frame.Width, this.View.Frame.Height - 44);

            webView = new UIWebView(webFrame)
            {
                BackgroundColor  = UIColor.White,
                ScalesPageToFit  = true,
                AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight
            };

            webView.LoadStarted += delegate {
                UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true;
            };
            webView.LoadFinished += delegate {
                UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false;
            };

            this.View.AddSubview(webView);
            if (!string.IsNullOrWhiteSpace(product.Url))
            {
                webView.LoadRequest(NSUrlRequest.FromUrl(new NSUrl(product.Url)));
            }
        }
コード例 #10
0
        async Task TestScalesPageToFitAsync(UIWebView webView)
        {
            // Url du blog de James Montemagno
            var uri = new Uri("http://motzcod.es/");

            // par défaut la web view est en ScalesPageToFit à false
            webView.ScalesPageToFit = false;
            webView.LoadRequest(new Foundation.NSUrlRequest(uri));
            await Task.Delay(5000);

            // On réaffiche le même site web avec en ScalesPageToFit à true
            webView.ScalesPageToFit = true;
            // On recharge la page web
            webView.LoadRequest(new Foundation.NSUrlRequest(uri));
            await Task.Delay(5000);
        }
コード例 #11
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var webView = new UIWebView(this.View.Frame);

            webView.Delegate = this;

            View.AddSubview(webView);

            StringBuilder builder = new StringBuilder();

            builder.Append("https://test.payu.in/_payment");

            var urlReq = new NSMutableUrlRequest(NSUrl.FromString(builder.ToString()));

            urlReq.HttpMethod = "POST";
            NSMutableDictionary dic = new NSMutableDictionary();

            dic.Add(new NSString("Content-Type"), new NSString("application/json"));
            urlReq.Headers = dic;

            urlReq.Body = NSData.FromString(GetPostString());
            webView.LoadRequest(urlReq);
        }
コード例 #12
0
 public override void ViewDidLoad()
 {
     base.ViewDidLoad();
     this.NavigationItem.LeftBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Cancel, (x, y) => this.DismissViewController(true, null));
     this.webview            = new UIWebView(this.View.Frame);
     webview.ShouldStartLoad = (webView, request, navType) => { return(true); };
     webview.LoadFinished   += (object sender, EventArgs e) => {
         var payload = webview.EvaluateJavascript("document.title");
         Console.WriteLine(payload);
         if (payload.Contains("Success payload="))
         {
             payload = Encoding.UTF8.GetString(Convert.FromBase64String(payload.Replace("Success payload=", String.Empty)));
             var rawToken = JsonConvert.DeserializeObject <Dictionary <string, string> >(payload);
             OnAuthenticationResponseArrived(new AuthenticationResponseEventArgs {
                 Success = true, TokenInfo = rawToken
             });
             this.InvokeOnMainThread(() => (UIApplication.SharedApplication.Delegate.Window.RootViewController.DismissViewController(true, null)));
         }
         else if (payload.Contains("Error message="))
         {
             OnAuthenticationResponseArrived(new AuthenticationResponseEventArgs {
                 Success = true, ErrorMessage = payload.Replace("Error message=", String.Empty)
             });
         }
     };
     this.View.AddSubview(webview);
     webview.LoadRequest(new NSUrlRequest(this.signInEndpoint));
 }
コード例 #13
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);
        }
コード例 #14
0
        public Vote(IntPtr handle) : base(handle)
        {
            Title = NSBundle.MainBundle.LocalizedString("Votação", "Votação");
            View.BackgroundColor = UIColor.White;
            webView = new UIWebView(View.Bounds);
            webView.ScrollView.ContentInset = new UIEdgeInsets(0, 0, 65, 0);

            View.AddSubview(webView);
            url = "http://poll.fitu.tum.pt";

            webView.ScalesPageToFit = false;



            if (!Reachability.IsHostReachable("tum.pt"))
            {
                UIAlertView alert = new UIAlertView();
                alert.Title = "Sem ligação à rede";
                alert.AddButton("Continuar");
                alert.Message = "Não conseguirá usar a aplicação sem conexão à rede.";
                alert.Show();
            }
            else
            {
                webView.LoadRequest(new NSUrlRequest(new NSUrl(url)));
            }
        }
コード例 #15
0
        private void loadPDF(string pdfFileName)
        {
            UIWebView pdfView = new UIWebView(UIScreen.MainScreen.Bounds);

            pdfView.LoadRequest(new NSUrlRequest(NSUrl.FromFilename(pdfFileName)));
            pdfView.ScalesPageToFit = true;

            UIViewController popover = new UIViewController();

            popover.View = pdfView;
            popover.ModalPresentationStyle = UIModalPresentationStyle.Popover;

            // Grab Image
            var image = UIImage.FromFile("close.png");

            // Add a close button
            var closeButton = new ImageButton(new CGRect(340, 30, image.Size.Width, image.Size.Height));

            closeButton.UserInteractionEnabled = true;
            closeButton.Image = image;
            pdfView.AddSubview(closeButton);

            // Wireup the close button
            closeButton.Touched += (button) =>
            {
                popover.DismissViewController(true, null);
            };

            // Present the popover
            owner.PresentViewController(popover, true, null);
        }
コード例 #16
0
        void SegmentValueChanged(object sender, EventArgs e)
        {
            if (_viewSegment.SelectedSegment == 0)
            {
                if (_previewView != null)
                {
                    _previewView.RemoveFromSuperview();
                    _previewView.Dispose();
                    _previewView = null;
                }

                Add(TextView);
                TextView.BecomeFirstResponder();
            }
            else
            {
                if (_previewView == null)
                {
                    _previewView = new UIWebView(this.View.Bounds);
                }

                TextView.RemoveFromSuperview();
                Add(_previewView);

                var markdownService = Mvx.Resolve <IMarkdownService>();
                var path            = MarkdownHtmlGenerator.CreateFile(markdownService.Convert(Text));
                var uri             = Uri.EscapeUriString("file://" + path) + "#" + Environment.TickCount;
                _previewView.LoadRequest(new MonoTouch.Foundation.NSUrlRequest(new MonoTouch.Foundation.NSUrl(uri)));
            }
        }
コード例 #17
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            navBar           = new UIToolbar();
            navBar.Frame     = new CGRect(0, View.Frame.Height - 40, View.Frame.Width, 40);
            navBar.TintColor = UIColor.Gray;

            items = new [] {
                new UIBarButtonItem(UIBarButtonSystemItem.Stop, (o, e) => {
                    webView.StopLoading();
                    DismissViewController(true, null);
                }),
                new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace, null),
                new UIBarButtonItem(UIBarButtonSystemItem.Refresh, (o, e) => webView.Reload())
            };

            navBar.Items            = items;
            webView                 = new UIWebView();
            webView.Frame           = new CGRect(0, 0, View.Frame.Width, View.Frame.Height - 40);
            webView.ScalesPageToFit = true;
            webView.SizeToFit();
            webView.LoadRequest(url);

            navBar.AutoresizingMask  = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleTopMargin;
            webView.AutoresizingMask = UIViewAutoresizing.FlexibleDimensions;

            View.AddSubviews(new UIView[] { webView, navBar });
        }
コード例 #18
0
        protected override void OnElementChanged(ElementChangedEventArgs <WebViewExtended> e)
        {
            base.OnElementChanged(e);
            if (e.NewElement != null)
            {
                CustomWebView = (WebViewExtended)Element;
                UIView contentView = new UIView(this.Frame);

                ActiveIndicator = new UIActivityIndicatorView(new CGRect((double)((CustomWebView.ControlWidth / 2) - 25), (double)((CustomWebView.ControlHeight / 2) - 25), 50, 50));
                ActiveIndicator.ActivityIndicatorViewStyle = UIActivityIndicatorViewStyle.Gray;

                webView = new UIWebView(new CGRect(0, 0, (double)(CustomWebView.ControlWidth), (double)(CustomWebView.ControlHeight)));
                webView.LoadFinished   += WebView_LoadFinished;
                webView.LoadStarted    += WebView_LoadStarted;
                webView.LoadError      += WebView_LoadError;
                webView.ScalesPageToFit = true;


                var url = CustomWebView.Source;                 // NOTE: https secure request
                webView.LoadRequest(new NSUrlRequest(new NSUrl(url)));

                contentView.AddSubview(webView);
                contentView.AddSubview(ActiveIndicator);
                SetNativeControl(contentView);
            }
        }
コード例 #19
0
		public override void ViewDidLoad()
		{
			base.ViewDidLoad ();
			View.BackgroundColor = UIColor.White;

			var TitleFrame = new CGRect (0, 15, View.Frame.Width, 50);
			var DisclaimerTitleLabel = new UILabel (TitleFrame) {
				Font = UIFont.FromName("HelveticaNeue-Medium", 14f),
				Text = "Disclosures",
				TextAlignment = UITextAlignment.Center,
				TextColor = UIColor.Clear.FromHexString (RSColors.RS_BLACK),
			};

			DisclaimerCloseButton.TintColor = UIColor.Clear.FromHexString (RSColors.MM_BLUE);

			DisclaimerCloseButton.TouchUpInside += (object sender, EventArgs e) => {
				this.DismissViewController(true, null);
			};

			var DisclaimerFrame = new CGRect (15f, 60f, View.Frame.Width - 30f, View.Frame.Height-60f);
			var DisclaimerWebView = new UIWebView (DisclaimerFrame);

			DisclaimerWebView.LoadRequest (new NSUrlRequest (new NSUrl (UrlConsts.URL_DISCLAIMERS)));

			View.AddSubview (DisclaimerTitleLabel);
			View.AddSubview (DisclaimerWebView);
		}
コード例 #20
0
        bool HandleShouldStartLoad(UIWebView webView, NSUrlRequest request, UIWebViewNavigationType navigationType)
        {

            // If the URL is not our own custom scheme, just let the webView load the URL as usual
            var scheme = "app:";

            if (request.Url.Scheme != scheme.Replace(":", ""))
                return true;

            var resources = request.Url.ResourceSpecifier.Split('?');
            var method = resources[0];

            if (method == "QR")
            {
                var scanner = new ZXing.Mobile.MobileBarcodeScanner();
                scanner.Scan().ContinueWith(result => {
                    if (result != null){
                        var code = result.Result.Text;
                        this.InvokeOnMainThread(new NSAction(() => webView.LoadRequest(new NSUrlRequest(new NSUrl(MainUrl + "code?value=" + code)))));
                    }
                });
            }

            return false;
        }
コード例 #21
0
        public Agenda(IntPtr handle) : base(handle)
        {
            Title = NSBundle.MainBundle.LocalizedString("Notícias", "Notícias");
            var attrs = new UITextAttributes()
            {
                TextColor = UIColor.FromRGB(168, 0, 0),
            };

            UITabBarItem.Appearance.SetTitleTextAttributes(attrs, state: UIControlState.Normal);


            View.BackgroundColor = UIColor.White;

            webView = new UIWebView(View.Bounds);

            webView.ScrollView.ContentInset = new UIEdgeInsets(0, 0, 45, 0);
            View.AddSubview(webView);

            webView.ScalesPageToFit = true;


            if (!Reachability.IsHostReachable("tum.pt"))
            {
                Reachability.InternetConnectionStatus();
                UIAlertView alert = new UIAlertView();
                alert.Title = "Sem ligação à rede";
                alert.AddButton("Continuar");
                alert.Message = "Não conseguirá usar a aplicação sem conexão à rede.";
                alert.Show();
            }
            else
            {
                webView.LoadRequest(new NSUrlRequest(new NSUrl(url)));
            }
        }
コード例 #22
0
        public void Load(string url)
        {
            Parameter.CheckUrl(url);

            int    queryIndex = url.IndexOf('?');
            string file       = queryIndex >= 0 ? url.Substring(0, queryIndex) : url;

            if (iApp.File.Exists(file))
            {
                webView.LoadRequest(NSUrlRequest.FromUrl(new NSUrl(url, NSBundle.MainBundle.BundleUrl)));
            }
            else
            {
                webView.LoadRequest(NSUrlRequest.FromUrl(NSUrl.FromString(url)));
            }
        }
コード例 #23
0
    private void Initialise()
    {
      const float BtnWidth = 200f;
      const float BtnHeight = 40f;
      const float BtnVertMargin = 10f;

      mFlowViewCtlr = new FlowViewController();

      // instructions - allow for OK button at bottom
      var instrUrl = NSUrl.FromFilename("Instructions/index.html");
      var instrUrlReq = NSUrlRequest.FromUrl(instrUrl);
      var instrBounds = new RectangleF(0f, 0f, UIScreen.MainScreen.Bounds.Width, UIScreen.MainScreen.Bounds.Height - BtnHeight - 2f * BtnVertMargin);
      mInstructions = new UIWebView(instrBounds);
      mInstructions.LoadRequest(instrUrlReq);
      View.AddSubview(mInstructions);

      // centre OK button at bottom of screen
      var btnBounds = new RectangleF((UIScreen.MainScreen.Bounds.Width - BtnWidth) / 2, UIScreen.MainScreen.Bounds.Height - BtnHeight - BtnVertMargin, BtnWidth, BtnHeight);

      mCmdOK = new GlassButton(btnBounds)
        {
          Font = UIFont.BoldSystemFontOfSize (22),
          NormalColor = UIColor.Blue,
          HighlightedColor = UIColor.Cyan
        };
      mCmdOK.SetTitle("OK", UIControlState.Normal);
      mCmdOK.TouchUpInside += OnCmdOKTouchUpInside;

      View.AddSubview(mCmdOK);
    }
コード例 #24
0
ファイル: WebViewController.cs プロジェクト: yofanana/recipes
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            Title = "WebView";
            View.BackgroundColor = UIColor.White;

            webView = new UIWebView(View.Bounds);
            View.AddSubview(webView);

            // html, image, css files must have Build Action:Content
            string fileName = "Content/Home.html"; // remember case sensitive

            string localHtmlUrl = Path.Combine(NSBundle.MainBundle.BundlePath, fileName);
            webView.LoadRequest (new NSUrlRequest (new NSUrl (localHtmlUrl, false)));
            webView.ScalesPageToFit = true;
            webView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;

            #region Additional Info
            // can also manually create html
            // passing the 'base' path to LoadHtmlString lets relative Urls for for links, images, etc
            //string contentDirectoryPath = Path.Combine(NSBundle.MainBundle.BundlePath,"Content/");
            //webView.LoadHtmlString ("<html><a href='Home.html'>Click Me</a>", new NSUrl (contentDirectoryPath, true));
            #endregion
        }
コード例 #25
0
ファイル: AuthViewController.cs プロジェクト: dfsklar/Mobile
 public override void ViewDidAppear(bool animated)
 {
     base.ViewDidAppear(animated);
     webView.LoadRequest(NSUrlRequest.FromUrl(NSUrl.FromString(NavigateUrl)));
     webView.ScalesPageToFit = true;
     webView.LoadFinished   += WebView_LoadFinished;
 }
コード例 #26
0
        public static UIViewController AudioSelected(ApiNode apiNode)
        {
            var url = apiNode["videoSrc1"];

            if (apiNode["contentNode"] != null)
            {
                url = apiNode[apiNode["contentNode"]];
            }

            //var videoController = new UIVideoController(url);

            //videoController.NavigationItem.Title = apiNode.Title;

            //return videoController;

            var vc = new UIViewController();

            var webView = new UIWebView(UIScreen.MainScreen.Bounds)
            {
                BackgroundColor = UIColor.White,
                ScalesPageToFit = true,
                AutoresizingMask = UIViewAutoresizing.All
            };

            var request = new NSUrlRequest(new NSUrl(url), NSUrlRequestCachePolicy.UseProtocolCachePolicy, 60);

            webView.LoadRequest(request);

            vc.NavigationItem.Title = apiNode.Title;

            vc.View.AutosizesSubviews = true;
            vc.View.AddSubview(webView);

            return vc;
        }
コード例 #27
0
        public override void ViewDidAppear(bool animated)
        {
            base.ViewDidAppear(animated);
            var request = new NSUrlRequest(new NSUrl(this.localHtmlUrl));

            webview.LoadRequest(request);
        }
コード例 #28
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            View.BackgroundColor = UIColor.White;

            webView = new UIWebView {
                Frame           = new RectangleF(0, 0, View.Bounds.Width, View.Bounds.Height - 69),
                ScalesPageToFit = true
            };

            NSUrl url;

            if (local)
            {
                url = new NSUrl(webViewAddress, false);
            }
            else
            {
                url = new NSUrl(webViewAddress);
            }

            var request = new NSUrlRequest(url);

            webView.LoadRequest(request);

            View.Add(webView);
        }
コード例 #29
0
		public override bool FinishedLaunching (UIApplication application, NSDictionary options)
		{
			// Register our custom url protocol
			NSUrlProtocol.RegisterClass (new ObjCRuntime.Class (typeof (ImageProtocol)));

			controller = new UIViewController ();

			web = new UIWebView () {
				BackgroundColor = UIColor.White,
				ScalesPageToFit = true,
				AutoresizingMask = UIViewAutoresizing.All
			};
			if (UIDevice.CurrentDevice.CheckSystemVersion (7, 0))
				web.Frame = new CGRect (0, 20,
				                            UIScreen.MainScreen.Bounds.Width,
				                            UIScreen.MainScreen.Bounds.Height - 20);
			else
				web.Frame = UIScreen.MainScreen.Bounds;
			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.BackgroundColor = UIColor.White;
			window.MakeKeyAndVisible ();
			window.RootViewController = controller;

			return true;
		}
コード例 #30
0
        public override void ViewDidLoad ()
        {
            base.ViewDidLoad ();
            navBar = new UIToolbar();
            navBar.Frame = new CGRect (0, View.Frame.Height-40, View.Frame.Width, 40);
            navBar.TintColor = UIColor.Gray;

            items = new [] {
                new UIBarButtonItem (UIBarButtonSystemItem.Stop, (o, e) => {
                    webView.StopLoading ();
                    DismissViewController (true, null);
                }),
                new UIBarButtonItem (UIBarButtonSystemItem.FlexibleSpace, null),
                new UIBarButtonItem (UIBarButtonSystemItem.Refresh, (o, e) => webView.Reload ())
            };

            navBar.Items = items;
            webView = new UIWebView ();
            webView.Frame = new CGRect (0, 0, View.Frame.Width, View.Frame.Height-40);
            webView.ScalesPageToFit = true;
            webView.SizeToFit ();
            webView.LoadRequest (url);

            navBar.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleTopMargin;
            webView.AutoresizingMask = UIViewAutoresizing.FlexibleDimensions;

            View.AddSubviews (new UIView[] { webView, navBar });
        }
コード例 #31
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            Title = "WebView";
            View.BackgroundColor = UIColor.White;

            webView = new UIWebView(View.Bounds);
            View.AddSubview(webView);

            // html, image, css files must have Build Action:Content
            string fileName = "Content/Home.html";             // remember case sensitive

            string localHtmlUrl = Path.Combine(NSBundle.MainBundle.BundlePath, fileName);

            webView.LoadRequest(new NSUrlRequest(new NSUrl(localHtmlUrl, false)));
            webView.ScalesPageToFit  = true;
            webView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;

            #region Additional Info
            // can also manually create html
            // passing the 'base' path to LoadHtmlString lets relative Urls for for links, images, etc
            //string contentDirectoryPath = Path.Combine(NSBundle.MainBundle.BundlePath,"Content/");
            //webView.LoadHtmlString ("<html><a href='Home.html'>Click Me</a>", new NSUrl (contentDirectoryPath, true));
            #endregion
        }
コード例 #32
0
        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));
        }
コード例 #33
0
		public override void ViewDidLoad()
		{
			base.ViewDidLoad();

			var webFrame = UIScreen.MainScreen.ApplicationFrame;

			_webView = new UIWebView(webFrame) {
				BackgroundColor = UIColor.White,
				ScalesPageToFit = true,
				AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight
			};

			_webView.LoadStarted += delegate {
				UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true;
			};
			_webView.LoadFinished += delegate {
				UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false;
			};
			_webView.LoadError += (webview, args) => {
				UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false;
					_webView.LoadHtmlString (String.Format ("<html><center><font size=+5 color='red'>An error occurred:<br>{0}</font></center></html>", args.Error.LocalizedDescription), null);
			};

			View.AddSubview(_webView);

			_webView.LoadRequest(new NSUrlRequest(new NSUrl(ViewModel.Uri)));
		}
コード例 #34
0
ファイル: LocationManager.cs プロジェクト: PHOETUS/Popdit
        // A location bubble was popped.  Notify the server and display the notification string to the user.
        async void Pop(object sender, CLRegionEventArgs e)
        {
            if (!e.Region.Identifier.Equals("RefreshZone")) // Ignore the refresh zone.
            {
                // Get the ID of the bubble that was popped.
                int bubbleId = Int32.Parse(e.Region.Identifier);
                Debug.WriteLine(">>>>> Popped bubble #" + bubbleId.ToString());

                // Notify the server and get notification message.
                EventMobile localEvent = new EventMobile();
                localEvent.BubbleId      = bubbleId;
                localEvent.TimestampJson = DateTime.Now.ToLongTimeString();
                string json = await WebApiPost("api/Event", localEvent);

                EventMobile serverEvent = (EventMobile)JsonConvert.DeserializeObject(json, typeof(EventMobile));

                // If the event has not been suppressed, process it.
                if (!serverEvent.Suppressed)
                {
                    Debug.WriteLine(">>>>> Processing event: Bubble #" + bubbleId.ToString());
                    // Display a notification.
                    DisplayNotification(serverEvent.ProviderName, serverEvent.MsgTitle, serverEvent.Msg, "Popdit" + " " + e.Region.Identifier);
                    // If the pops page is displayed, refresh it.
                    UIWebView webView = (UIWebView)UIApplication.SharedApplication.KeyWindow.RootViewController.View;
                    if (webView.Request.Url.AbsoluteString.Contains("Event"))
                    {
                        webView.LoadRequest(new NSUrlRequest(PopditServer.WebRoot));
                    }
                }
                else
                {
                    Debug.WriteLine(">>>>> Event suppressed: Bubble #" + bubbleId.ToString());
                }
            }
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            this.Title = "Sign in";

            View.BackgroundColor = UIColor.White;

            webView = new UIWebView(View.Bounds);
            webView.ShouldStartLoad = (wView, request, navType) =>
            {
                if (request != null && request.Url.ToString().StartsWith(callback))
                {
                    callbackMethod(new AuthorizationResult(AuthorizationStatus.Success, request.Url.ToString()));
                    this.DismissViewController(true, null);
                    return(false);
                }

                return(true);
            };

            View.AddSubview(webView);

            this.NavigationItem.LeftBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Cancel, this.CancelAuthentication);

            webView.LoadRequest(new NSUrlRequest(new NSUrl(this.url)));

            // if this is false, page will be 'zoomed in' to normal size
            //webView.ScalesPageToFit = true;
        }
コード例 #36
0
        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));
        }
コード例 #37
0
		private void SetupUserInterface ()
		{
			scrollView = new UIScrollView {
				BackgroundColor = UIColor.Clear.FromHexString ("#094074", 1.0f),
				Frame = new CGRect (0, 0, Frame.Width, Frame.Height * 2)
			};

			licensureLabel = new UILabel {
				Font = UIFont.FromName ("SegoeUI-Light", 25f),
				Frame = new CGRect (0, 20, Frame.Width, 35),
				Text = "Open-Source",
				TextAlignment = UITextAlignment.Center,
				TextColor = UIColor.White
			};

			string localHtmlUrl = Path.Combine (NSBundle.MainBundle.BundlePath, "Licensure.html");
			var url = new NSUrl (localHtmlUrl, false);
			var request = new NSUrlRequest (url);

			webView = new UIWebView () {
				Frame = new CGRect (0, 55, Frame.Width, Frame.Height - 55)
			};
			webView.LoadRequest (request);

			scrollView.ContentSize = new CGSize (Frame.Width, Frame.Height * 2);

			scrollView.Add (licensureLabel);
			scrollView.Add (webView);
			Add (scrollView);
		}
コード例 #38
0
        public override void ViewDidAppear(bool animated)
        {
            base.ViewDidAppear(animated);

            //ListItems = new List<UIViewController>(TabBarController.ViewControllers)
            if (MainTabController.LoggedIn)
            {
                urlToLoad = uriD;
            }
            else
            {
                urlToLoad = uri;
            }


            //loadingOverlay.Hide();

            webview_Main = MainTabController.webview_main;

            webview_Main.Frame = new CoreGraphics.CGRect(0, 20, View.Bounds.Width, View.Bounds.Height - 20);


            webview_Main.LoadRequest(new NSUrlRequest(new NSUrl(urlToLoad)));
            // Perform any additional setup after loading the view, typically from a nib.


            webview_Main.ScalesPageToFit = true;


            View.AddSubview(webview_Main);
            View.SendSubviewToBack(webview_Main);
        }
コード例 #39
0
        void LoadInitialUrl(Uri url)
        {
            if (!webViewVisible)
            {
                progress.StopAnimating();
                webViewVisible = true;

                UIView.Transition
                (
                    fromView: authenticatingView,
                    toView: web_view,
                    duration: TransitionTime,
                    options: UIViewAnimationOptions.TransitionCrossDissolve,
                    completion: null
                );
            }

            if (url != null)
            {
                var request = new NSUrlRequest(new NSUrl(url.AbsoluteUri));
                NSUrlCache.SharedCache.RemoveCachedResponse(request); // Always try
                if (WebViewConfiguration.IOS.IsUsingWKWebView == false)
                {
                    ui_web_view.LoadRequest(request);
                }
                else
                {
                    wk_web_view.LoadRequest(request);
                }
            }

            return;
        }
コード例 #40
0
ファイル: HtmlElement.cs プロジェクト: escoz/MonoTouch.MVVM
        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));
        }
コード例 #41
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            navBar       = new UIToolbar();
            navBar.Frame = new RectangleF(0, this.View.Frame.Height - 130, this.View.Frame.Width, 40);

            items = new UIBarButtonItem [] {
                new UIBarButtonItem("Back", UIBarButtonItemStyle.Bordered, (o, e) => { webView.GoBack(); }),
                new UIBarButtonItem("Forward", UIBarButtonItemStyle.Bordered, (o, e) => { webView.GoForward(); }),
                new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace, null),
                new UIBarButtonItem(UIBarButtonSystemItem.Refresh, (o, e) => { webView.Reload(); }),
                new UIBarButtonItem(UIBarButtonSystemItem.Stop, (o, e) => { webView.StopLoading(); })
            };
            navBar.Items = items;

            webView       = new UIWebView();
            webView.Frame = new RectangleF(0, 0, View.Frame.Width, View.Frame.Height - 130);

            webView.LoadStarted += delegate {
                UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true;
            };
            webView.LoadFinished += delegate {
                UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false;
            };

            webView.ScalesPageToFit = true;
            webView.SizeToFit();
            webView.LoadRequest(url);

            View.AddSubview(webView);
            View.AddSubview(navBar);
        }
コード例 #42
0
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();
			webView = new UIWebView (View.Bounds);
			View.AddSubview(webView);
			string url = "http://fixbuy.mx/products/new?bar_code="+ProductStoresListView.barcode2;
			webView.LoadRequest(new NSUrlRequest(new NSUrl(url)));
			webView.ScalesPageToFit = true;
		}
コード例 #43
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();
            var webView = new UIWebView (new RectangleF (0, 0, View.Bounds.Width, View.Bounds.Height));
            View.Add (webView);
            webView.LoadRequest (new NSUrlRequest (new NSUrl(_url)));

            // Perform any additional setup after loading the view, typically from a nib.
        }
コード例 #44
0
 public FileDetailViewController(string filePath)
 {
     var webView = new UIWebView(new RectangleF(0.0f, -44.0f, 320.0f, 460.0f));
     webView.ScalesPageToFit = true;
     webView.ScrollView.BackgroundColor = UIColor.ScrollViewTexturedBackgroundColor;
     webView.LoadRequest(new NSUrlRequest(new NSUrl(filePath, false)));
     this.View = webView;
     this.SetToolbarItems(AppDelegate.ToolbarButtons, false);
     this.NavigationItem.Title = Path.GetFileName(filePath);
 }
コード例 #45
0
        public override void ViewDidLoad()
        {
            var webView = new UIWebView(View.Bounds);

            webView.LoadRequest(new NSUrlRequest(new NSUrl(url)));

            webView.ScalesPageToFit = true;

            View.AddSubview(webView);
        }
コード例 #46
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            WebView = new UIWebView( );
            View.AddSubview( WebView );

            string aboutUrl = string.Format( AboutConfig.Url, App.Shared.Network.RockMobileUser.Instance.GetRelevantCampus( ) );
            WebView.LoadRequest( new NSUrlRequest( new NSUrl( aboutUrl ) ) );
        }
コード例 #47
0
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();
			navBar = new UIToolbar ();
			if (AppDelegate.IsPhone)
				navBar.Frame = new CGRect (0, View.Frame.Height-40, View.Frame.Width, 40);
			else
				navBar.Frame = new CGRect (0, View.Frame.Height-40, View.Frame.Width, 40);
			navBar.TintColor = UIColor.DarkGray;			

			items = new UIBarButtonItem [] {
				new UIBarButtonItem ("Back", UIBarButtonItemStyle.Bordered, (o, e) => { webView.GoBack (); }),
				new UIBarButtonItem ("Forward", UIBarButtonItemStyle.Bordered, (o, e) => { webView.GoForward (); }),
				new UIBarButtonItem (UIBarButtonSystemItem.FlexibleSpace, null),
				new UIBarButtonItem (UIBarButtonSystemItem.Refresh, (o, e) => { webView.Reload (); }),
				new UIBarButtonItem (UIBarButtonSystemItem.Stop, (o, e) => { 
					webView.StopLoading (); 
					
					// Phone: NavigationController, Pad: Modal
					if (NavigationController == null)
						DismissViewController (true, ()=> {});
					else
						NavigationController.PopViewController (true);
				})
			};

			navBar.Items = items;
			
			webView = new UIWebView ();
			if (AppDelegate.IsPhone)
				webView.Frame = new CGRect (0, 0, View.Frame.Width, View.Frame.Height-40);
			else
				webView.Frame = new CGRect (0, 0, View.Frame.Width, View.Frame.Height-40);

			webView.LoadStarted += delegate {
				UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true;
				navBar.Items[0].Enabled = webView.CanGoBack;
				navBar.Items[1].Enabled = webView.CanGoForward;
			};
			webView.LoadFinished += delegate {
				UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false;
				navBar.Items[0].Enabled = webView.CanGoBack;
				navBar.Items[1].Enabled = webView.CanGoForward;
			};
			
			webView.ScalesPageToFit = true;
			webView.SizeToFit ();
			webView.LoadRequest (url);
			
			navBar.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleTopMargin;
			webView.AutoresizingMask = UIViewAutoresizing.FlexibleDimensions;

			View.AddSubview (webView);
			View.AddSubview (navBar);
		}
コード例 #48
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();
            this.NavigationController.NavigationBar.BarStyle = UIBarStyle.BlackOpaque;
            this.NavigationController.NavigationBar.TintColor = UIColor.White;
            this.NavigationController.NavigationBar.BarTintColor = UIColor.FromRGB (0, 176, 202);
            this.NavigationController.NavigationBar.TitleTextAttributes = new UIStringAttributes()
            {
                ForegroundColor = UIColor.White
            };

            Title = "Yagbani";
            View.BackgroundColor = UIColor.White;

            webView = new UIWebView(View.Bounds);
            View.AddSubview(webView);

            var url = "http://yagbaniac14.wix.com/aquacultureknowledgeproject";
            webView.LoadRequest (new NSUrlRequest (new NSUrl (url)));

            webView.ScalesPageToFit = true;

            this.SetToolbarItems( new UIBarButtonItem[] {
                new UIBarButtonItem(UIBarButtonSystemItem.Refresh, (s,e) => {
                    webView.Reload();
                })
                , new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace) { Width = 10 }
                , new UIBarButtonItem("Home", UIBarButtonItemStyle.Plain, (s,e) => {
                    webView.LoadRequest(new NSUrlRequest (new NSUrl (url)));
                })
                , new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace) { Width = 10 }
                , new UIBarButtonItem(UIBarButtonSystemItem.Rewind, (s,e) => {
                    webView.GoBack();
                })
                , new UIBarButtonItem(UIBarButtonSystemItem.FastForward, (s,e) => {
                    webView.GoForward();
                })
            }, false);

            this.NavigationController.ToolbarHidden = false;
            this.NavigationController.Toolbar.TintColor = UIColor.Black;
        }
コード例 #49
0
ファイル: WebViewController.cs プロジェクト: MADMUC/TAP5050
 /********************************************************************************
  *customus functions
  ********************************************************************************/
 /********************************************************************************
 *Views initializations
 ********************************************************************************/
 public void initWebView()
 {
     WebView = new UIWebView (new RectangleF(0f*Device.screenWidthP,0f*Device.screenHeightP,100f*Device.screenWidthP, 100f*Device.screenHeightP));
     WebView.ScalesPageToFit =true;
     if (!url.ToLower ().Contains ("https://")) {
         NavigationController.PopViewController (true);
     } else {
         var UrlRequest = new NSUrlRequest (new NSUrl (url));
         WebView.LoadRequest(UrlRequest);
     }
 }
コード例 #50
0
ファイル: ResultCharts.cs プロジェクト: bholmes/IOSSampleApps
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            _webView = new UIWebView (this.View.Bounds);
            _webView.LoadRequest (new NSUrlRequest (new NSUrl ("http://apps.slapholmesproductions.com/apps/PerformanceApp/default.aspx")));
            _webView.AutoresizingMask = UIViewAutoresizing.All;
            _webView.ScalesPageToFit = true;
            this.View.AutosizesSubviews = true;

            this.View.Add (_webView);
        }
コード例 #51
0
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();
			
			
			string aboutPageUrl = NSBundle.MainBundle.BundlePath + "/about.html";
			
			aboutHtml = new UIWebView ();
			aboutHtml.LoadRequest (new NSUrlRequest (new NSUrl (aboutPageUrl, false)));
			aboutHtml.Frame = new RectangleF (0, 0, View.Frame.Width, View.Frame.Height);
			View.Add (aboutHtml);
		}
コード例 #52
0
ファイル: AboutUsView.cs プロジェクト: saedaes/ProductFinder
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			UIWebView webView = new UIWebView (View.Bounds);
			View.AddSubview(webView);

			string fileName = "documents/Servicios.pdf"; // remember case-sensitive
			string localDocUrl = Path.Combine (NSBundle.MainBundle.BundlePath, fileName);
			webView.LoadRequest(new NSUrlRequest(new NSUrl(localDocUrl, false)));
			webView.ScalesPageToFit = true;
		}
コード例 #53
0
ファイル: UIWebViewExample.cs プロジェクト: jamilgeor/Crayon
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            _webView = new UIWebView();

            _webView.SetStyleId("sample-web");
            View.SetStyleClass("sample-background");

            View.AddSubview(_webView);

            _webView.LoadRequest(new NSUrlRequest(new NSUrl("http://www.google.com")));
        }
コード例 #54
0
		public override void ViewDidLoad()
		{
			base.ViewDidLoad();

			this.Title = "Terms Of Use";
			WebView = new UIWebView(View.Bounds);
			View.AddSubview(WebView);

			var url = PrivateConstants.HOST_URL + "/terms/mobile";
			WebView.LoadRequest(new NSUrlRequest(new NSUrl(url)));

			WebView.ScalesPageToFit = true;
		}
コード例 #55
0
		public override void ViewDidLoad()
		{
			base.ViewDidLoad ();
			this.Title = "Account Not Available";
			View.BackgroundColor = UIColor.White;
			var NonQualFrame = new CGRect (0, 0, View.Frame.Width, View.Frame.Height);
			var NonQualWebView = new UIWebView (NonQualFrame);

			NonQualWebView.BackgroundColor = UIColor.White;
			NonQualWebView.LoadRequest (new NSUrlRequest (new NSUrl (UrlConsts.URL_NON_QUAL)));

			View.AddSubview (NonQualWebView);

		}
コード例 #56
0
		public override void ViewDidLoad ()
		{
			Title = "Sign up for a TeenTix Pass!";
			View.BackgroundColor = UIColor.White;

			webView = new UIWebView (View.Bounds);			
			View.AddSubview (webView);

			var url = PrivateConstants.HOST_URL + "/sign-up/application-mobile";
			// NOTE: https required for iOS 9 ATS
			webView.LoadRequest (new NSUrlRequest (new NSUrl (url)));

			webView.ScalesPageToFit = true;
		}
コード例 #57
0
		public override void ViewDidAppear(bool animated)
		{
			
			webView = new UIWebView (View.Bounds);

			View.AddSubview (webView);
			string url = webURL;
			webView.LoadRequest (new NSUrlRequest (new NSUrl (url)));
			webView.ScalesPageToFit = true;




		}
		public override void LoadView ()
		{
			base.LoadView ();
			var webFrame = new RectangleF(0, 0, View.Frame.Width, View.Frame.Height - NavigationController.NavigationBar.Frame.Height);
			WebView = new UIWebView(webFrame);
			
			var urlRequest = new NSUrlRequest(Url);
			
			WebView.LoadRequest(urlRequest);
			WebView.ScalesPageToFit = true;
			
			WebView.Delegate = new AccessControlWebAuthDelegate(this);
			
			View.AddSubview(WebView);
		}
コード例 #59
0
ファイル: WebViewController.cs プロジェクト: omxeliw/recipes
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            Title = "WebView";
            View.BackgroundColor = UIColor.White;

            webView = new UIWebView(View.Bounds);
            View.AddSubview(webView);

            string url = "http://xamarin.com";
            webView.LoadRequest (new NSUrlRequest (new NSUrl (url)));

            // if this is false, page will be 'zoomed in' to normal size
            //webView.ScalesPageToFit = true;
        }
コード例 #60
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            InvokeOnMainThread (() =>
            {
                _webView = new UIWebView ();
                _webView.Frame = new System.Drawing.RectangleF (0, 0, 320, 480);
                _webView.LoadFinished += OnLoadFinished;
                this.Add (_webView);

                _webView.LoadRequest (new NSUrlRequest (_url));

                Title = "Dropbox Authentication";
            }
            );
        }