Exemplo n.º 1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.Main);

            var downloadButton = FindViewById<Button>(Resource.Id.downloadButton);
            FindViewById<Button>(Resource.Id.backButton).Click += (sender, args) => { if (_webView.CanGoBack()) _webView.GoBack(); };
            FindViewById<Button>(Resource.Id.forwardButton).Click += (sender, args) => { if (_webView.CanGoForward()) _webView.GoForward(); };
            _webView = FindViewById<WebView>(Resource.Id.webView1);
            var progressBar = FindViewById<ProgressBar>(Resource.Id.progressBar1);
            var title = FindViewById<TextView>(Resource.Id.textView1);
            var frame = FindViewById(Resource.Id.frameDownload);
            frame.Visibility = ViewStates.Gone;
            var viewControls = new ViewControls {
                DownloadButton = downloadButton,
                ProgressBar = progressBar,
                Title = title,
                DownloadFrame = frame,
                Activity = this
            };
            _webView.Settings.JavaScriptEnabled = true;
            _webView.SetWebViewClient(new YoutubeWebViewClient(viewControls));
            _webView.LoadUrl("http://www.youtube.com/");
        }
Exemplo n.º 2
0
        public static void collectDevice()
        {
            string SessionId = Conekta.DeviceFingerPrint ();
            string PublicKey = Conekta.PublicKey;
            string html = "<!DOCTYPE html><html><head></head><body style=\"background: blue;\">";
            html += "<script type=\"text/javascript\" src=\"https://conektaapi.s3.amazonaws.com/v0.5.0/js/conekta.js\" data-conekta-public-key=\"" + PublicKey + "\" data-conekta-session-id=\"" + SessionId + "\"></script>";
            html += "</body></html>";

            string contentPath = Environment.CurrentDirectory;

            #if __IOS__
            UIWebView web = new UIWebView(new RectangleF(new PointF(0,0), new SizeF(0, 0)));
            web.ScalesPageToFit = true;
            web.LoadHtmlString(html, new NSUrl("https://conektaapi.s3.amazonaws.com/v0.5.0/js/conekta.js"));
            Conekta._delegate.View.AddSubview(web);
            #endif

            #if __ANDROID__
            WebView web_view = new WebView(Android.App.Application.Context);
            web_view.Settings.JavaScriptEnabled = true;
            web_view.Settings.AllowContentAccess = true;
            web_view.Settings.DomStorageEnabled = true;
            web_view.LoadDataWithBaseURL(Conekta.UriConektaJs, html, "text/html", "UTF-8", null);
            #endif
        }
Exemplo n.º 3
0
        public override WebResourceResponse ShouldInterceptRequest(WebView view, IWebResourceRequest request)
        {
            if (request.Url.Scheme == Uri.UriSchemeFile)
                return null;

            if (SkipLoading(request.Url.LastPathSegment))
                return null;

            var baseResponse = base.ShouldInterceptRequest(view, request);

            try
            {
                var result = Task.Run(async () =>
                {
                    using (var c = new HttpClient { Timeout = TimeSpan.FromSeconds(TimeOut) })
                    {
                        var response = await c.GetAsync(request.Url.ToString());
                        var content = await response.Content.ReadAsStreamAsync();
                        return new WebResourceResponse(baseResponse.MimeType, "UTF-8", (int)response.StatusCode, response.ReasonPhrase, null, content);
                    }
                }).Result;
                
                return result;
            }
            catch (AggregateException e)
            {
                return baseResponse;
            }
        }
 public ReceivedErrorEventArgs(WebView webView, ClientError errorCode, string description, string failingUrl)
 {
     this.WebView = webView;
     this.ErrorCode = errorCode;
     this.Description = description;
     this.FailingUrl = failingUrl;
 }
Exemplo n.º 5
0
        protected override void OnCreate(Bundle bundle)
        {
            Console.WriteLine("AboutActivity - OnCreate");
            base.OnCreate(bundle);

            _navigationManager = Bootstrapper.GetContainer().Resolve<MobileNavigationManager>();
            SetContentView(Resource.Layout.About);
            ActionBar.SetDisplayHomeAsUpEnabled(true);
            ActionBar.SetHomeButtonEnabled(true);

            _progressBar = FindViewById<ProgressBar>(Resource.Id.about_progressBar);
            _lblLoading = FindViewById<TextView>(Resource.Id.about_lblLoading);
            _webView = FindViewById<WebView>(Resource.Id.about_webView);
            _webViewClient = new MyWebViewClient();
            _webViewClient.PageFinished += (sender, args) => {
                Animation anim = AnimationUtils.LoadAnimation(this, Resource.Animation.fade_out);
                anim.AnimationEnd += (animSender, animArgs) => {
                    _lblLoading.Visibility = ViewStates.Gone;
                };
                _lblLoading.StartAnimation(anim);

                Animation anim2 = AnimationUtils.LoadAnimation(this, Resource.Animation.fade_out);
                anim2.AnimationEnd += (animSender, animArgs) => {
                    _progressBar.Visibility = ViewStates.Gone;
                };
                _progressBar.StartAnimation(anim2);
            };
            _webView.SetWebViewClient(_webViewClient);

            // Since the onViewReady action could not be added to an intent, tell the NavMgr the view is ready
            //((AndroidNavigationManager)_navigationManager).SetAboutActivityInstance(this);
            _navigationManager.BindAboutView(this);
        }
Exemplo n.º 6
0
 public JSCallbackEventArgs(WebView webView, string objectName, string callbackName, JSValue[] args)
 {
     this.webView = webView;
     this.objectName = objectName;
     this.callbackName = callbackName;
     this.args = args;
 }
Exemplo n.º 7
0
            public override bool ShouldOverrideUrlLoading(WebView webView, string url)
            {
                // If the URL is not our own custom scheme, just let the webView load the URL as usual
                var scheme = "hybrid:";

                if (!url.StartsWith(scheme))
                    return false;

                // This handler will treat everything between the protocol and "?"
                // as the method name.  The querystring has all of the parameters.
                var resources = url.Substring(scheme.Length).Split('?');
                var method = resources[0];
                var parameters = System.Web.HttpUtility.ParseQueryString(resources[1]);

                if (method == "UpdateLabel")
                {
                    var textbox = parameters["textbox"];

                    // Add some text to our string here so that we know something
                    // happened on the native part of the round trip.
                    var prepended = string.Format("C# says \"{0}\"", textbox);

                    // Build some javascript using the C#-modified result
                    var js = string.Format("SetLabelText('{0}');", prepended);

                    webView.LoadUrl("javascript:" + js);
                }

                return true;
            }
Exemplo n.º 8
0
		public override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
		{
			View v = inflater.Inflate (Resource.Layout.WebViewDialog, container, false);

			txtTitle = v.FindViewById<TextView> (Resource.Id.txt_dialog_title);
			divider = v.FindViewById<View> (Resource.Id.title_divider);
			webView = v.FindViewById<WebView> (Resource.Id.dialog_web_view);

			if (title == null || title.Length < 1) {
				txtTitle.Visibility = divider.Visibility = ViewStates.Gone;
			} else {
				txtTitle.Text = title;
			}

			if (url != null && url.Length > 0) {
				webView.LoadUrl (url);
			}

			if (showOkay) {
				btnOk.Visibility = ViewStates.Visible;
				btnOk.Click += (object sender, EventArgs e) => {
					this.Dismiss ();
				};
			}

			return v;
		}
Exemplo n.º 9
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);
            SetContentView (Resource.Layout.PlayAnimation);
            ImageView btns = FindViewById<ImageView> (Resource.Id.imgNewLoginHeader);
            TextView header = FindViewById<TextView> (Resource.Id.txtFirstScreenHeader);
            RelativeLayout relLayout = FindViewById<RelativeLayout> (Resource.Id.relativeLayout1);
            ImageHelper.setupTopPanel (btns, header, relLayout, header.Context);
            Header.headertext = Application.Context.Resources.GetString (Resource.String.animationPlaybackTitle);
            Header.fontsize = 36f;
            ImageHelper.fontSizeInfo (header.Context);
            header.SetTextSize (Android.Util.ComplexUnitType.Dip, Header.fontsize);
            header.Text = Header.headertext;

            animationView = FindViewById<WebView> (Resource.Id.animationView);

            ImageButton btnBack = FindViewById<ImageButton> (Resource.Id.btnBack);
            btnBack.Tag = 0;
            btnBack.Click += delegate {
                Finish ();
            };
            ImageButton btnPlay = FindViewById<ImageButton> (Resource.Id.btnPlay);
            btnPlay.Tag = 1;
            LinearLayout bottom = FindViewById<LinearLayout> (Resource.Id.bottomHolder);
            ImageButton[] buttons = new ImageButton[2];
            buttons [0] = btnBack;
            buttons [1] = btnPlay;
            ImageHelper.setupButtonsPosition (buttons, bottom, header.Context);
        }
		protected void WebViewDidStartLoad (WebView _webview)
		{
			Console.Log(Constants.kDebugTag, "[WebView] Received DidStartLoad event, Webview=" + _webview);

			if (_webview != null)
				_webview.InvokeMethod(kOnDidStartLoadEvent);
		}
Exemplo n.º 11
0
        protected override void OnViewModelSet()
        {
            Window.RequestFeature(WindowFeatures.Progress);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetHomeButtonEnabled(true);
            SupportActionBar.SetBackgroundDrawable(Resources.GetDrawable(Resource.Color.s_main_green));
            SupportActionBar.SetLogo(Resource.Drawable.logo_white);

            base.OnViewModelSet();

            SetContentView(Resource.Layout.page_webview);

            
            var set = this.CreateBindingSet<GenericWebViewView, GenericWebViewViewModel>();
            set.Bind(SupportActionBar).For(v => v.Title).To(vm => vm.Title).Mode(MvxBindingMode.OneWay);
            set.Apply();


            _webView = FindViewById<WebView>(Resource.Id.webView);
            _webView.Settings.JavaScriptEnabled = true;
            _webView.Settings.SetSupportZoom(true);


            var progressBar = FindViewById<ProgressBar>(Resource.Id.progressBar);
            var webChromeClient = new ProgressUpdatingWebChromeClient(progressBar);
            var webViewClient = new ProgressHandlingWebViewClient(progressBar);
            _webView.SetWebViewClient(webViewClient);
            _webView.SetWebChromeClient(webChromeClient);
    
            _webView.LoadUrl(ViewModel.Uri);
        }
Exemplo n.º 12
0
 public MainWindow()
 {
     CreateToolbarTemplate();
     Style |= WindowStyle.UnifiedTitleAndToolbar;
     Toolbar = new Toolbar() { TemplateName = "Main", Customizable = true };
     button1 = new Button() { Title = "Click me \u263A", Width = 100, Margin = new Thickness(0, 0, 200, 0), HorizontalAlignment = HorizontalAlignment.Right, VerticalAlignment = VerticalAlignment.Bottom };
     button1.Action += HandleButton1Action;
     button2 = new Button() { Title = "\u26A0 Don't click me \u2620", Width = 200, Margin = new Thickness(0, 0, 0, 0), HorizontalAlignment = HorizontalAlignment.Right, VerticalAlignment = VerticalAlignment.Bottom };
     button2.Action += HandleButton2Action;
     checkBox = new Button() { Title = "Closable", ButtonType = ButtonType.Switch, Width = 100, Height = 24, Margin = new Thickness(120, 0, 0, 100), HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Bottom };
     paintedView = new DrawableView() { Height = 100, Margin = new Thickness(0, 0, 0, 160), VerticalAlignment = VerticalAlignment.Bottom };
     paintedView.Draw += HandlePaintedViewDraw;
     webView = new WebView() { Margin = new Thickness(0, 0, 0, 260), VerticalAlignment = VerticalAlignment.Top };
     #if DOCUMENT
     //			checkBox.Checked = true;
     #endif
     Title = "Hello From C#";
     Content.Children.AddRange
     (
         button1,
         button2,
         checkBox,
         new ColorWell() { Width = 100, Height = 100, Margin = new Thickness(10, 0, 0, 32), HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Bottom },
         new ColorWell() { Width = 100, Height = 100, Margin = new Thickness(0, 0, 10, 32), HorizontalAlignment = HorizontalAlignment.Right, VerticalAlignment = VerticalAlignment.Bottom },
         new SearchField() { Width = double.NaN, Height = 22, Margin = new Thickness(120, 0, 120, 32), HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Bottom },
         new TextField() { Height = 22, Margin = new Thickness(120, 0, 120, 64), HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Bottom },
         new ComboBox() { Height = 22, Margin = new Thickness(10, 0, 10, 132), HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Bottom },
         paintedView,
         webView
     );
 }
Exemplo n.º 13
0
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

			// Create your application here
			SetContentView(Resource.Layout.MySkool_AnnounceDetailsLayout);

			toolbar = FindViewById<Android.Support.V7.Widget.Toolbar> (Resource.Id.app_bar);
			toolbar.SetBackgroundColor (Color.ParseColor ("#F8A015"));
			//toolbar.SetNavigationIcon (Resource.Drawable.ic_arrow_up);
			SetSupportActionBar (toolbar);
			SupportActionBar.SetDisplayHomeAsUpEnabled (true);

			string getArticleTitle = Intent.GetStringExtra ("ArticleTitle");
			string getArticleContent = Intent.GetStringExtra ("ArticleContent");

			mainTitle = FindViewById<TextView> (Resource.Id.tvMSADLMainTitle);
			mainTitle.Text = getArticleTitle.ToString();

			infoDetails = FindViewById<WebView> (Resource.Id.wvMSADLDetails);
			infoDetails.Settings.JavaScriptEnabled = true;
			infoDetails.LoadDataWithBaseURL ("", 
				getArticleContent.ToString(), 
				"text/html", 
				"UTF-8", "");


		}
Exemplo n.º 14
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            fb = new FacebookClient ();
            appId = Intent.GetStringExtra ("AppId");
            extendedPermissions = Intent.GetStringExtra ("ExtendedPermissions");
            url = GetFacebookLoginUrl (appId, extendedPermissions);

            WebView webView = new WebView(this);
            webView.Settings.JavaScriptEnabled = true;
            webView.Settings.SetSupportZoom(true);
            webView.Settings.BuiltInZoomControls = true;
            webView.Settings.LoadWithOverviewMode = true; //Load 100% zoomed out
            webView.ScrollBarStyle = ScrollbarStyles.OutsideOverlay;
            webView.ScrollbarFadingEnabled = true;

            webView.VerticalScrollBarEnabled = true;
            webView.HorizontalScrollBarEnabled = true;

            webView.SetWebViewClient(new FBWebClient (this));
            webView.SetWebChromeClient(new FBWebChromeClient (this));

            AddContentView(webView, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.FillParent));

            webView.LoadUrl(url);
        }
Exemplo n.º 15
0
        /// <summary>
        /// Construct the UI and start loading
        /// </summary>
		public void onCreate()
		{
			string startUrl = webSettings.GetString ("url");
			string title = webSettings.GetString ("title");
			mainLayout = new LinearLayout (this.context);
			LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams (ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.FillParent, 0.0F);
			mainLayout.LayoutParameters = lp;
			((LinearLayout)mainLayout).SetGravity (GravityFlags.CenterVertical);
			((LinearLayout)mainLayout).Orientation = Orientation.Vertical;

			webView = new WebView (this.context);
			WebSettings settings = webView.Settings;
			settings.JavaScriptEnabled = true;
			settings.BuiltInZoomControls = true;
			settings.JavaScriptCanOpenWindowsAutomatically = true;

			webView.LayoutParameters = new LinearLayout.LayoutParams (ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.FillParent, 1.0F);

			webView.SetWebViewClient (new FHOAuthWebViewClient (this));
			webView.RequestFocusFromTouch ();
			webView.Visibility = ViewStates.Visible;

			LinearLayout barlayout = initHeaderBar (title);

			mainLayout.AddView (barlayout);
			mainLayout.SetBackgroundColor (Color.Transparent);
			mainLayout.SetBackgroundResource (0);
			mainLayout.AddView (this.webView);

			this.webView.LoadUrl (startUrl);

		}
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            _messageHub = Mvx.Resolve<IMvxMessenger>();

            var url = Intent.GetStringExtra("cheesebaron.mvxplugins.azureaccesscontrol.droid.Url");

            Window.RequestFeature(WindowFeatures.Progress);

            _webView = new WebView(this)
            {
                VerticalScrollBarEnabled = true,
                HorizontalScrollBarEnabled = true,
                ScrollBarStyle = ScrollbarStyles.OutsideOverlay,
                ScrollbarFadingEnabled = true
            };

            _webView.Settings.JavaScriptEnabled = true;
            _webView.Settings.SetSupportZoom(true);
            _webView.Settings.BuiltInZoomControls = true;
            _webView.Settings.LoadWithOverviewMode = true; //Load 100% zoomed out
            
            var notify = new AccessControlJavascriptNotify();
            notify.GotSecurityTokenResponse += GotSecurityTokenResponse;

            _webView.AddJavascriptInterface(notify, "external");
            _webView.SetWebViewClient(new AuthWebViewClient());
            _webView.SetWebChromeClient(new AuthWebChromeClient(this));

            _webView.LoadUrl(url);

            AddContentView(_webView, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent));
        }
Exemplo n.º 17
0
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);
			// Set our view from the "main" layout resource
			SetContentView (Resource.Layout.Main);

			_pdfPath = _documentsPath + "/PDFView";
			_pdfFilePath  = Path.Combine(_pdfPath, _pdfFileName);

			// Check if the PDFDirectory Exists
			if(!Directory.Exists(_pdfPath)){
				Directory.CreateDirectory(_pdfPath);
			}
			else{
				// Check if the IDCard is there, If Yes Delete It. Because we will download the fresh one just in a moment
				if (File.Exists(_pdfFilePath)){
					File.Delete(_pdfFilePath);
				}
			}

			_webView = FindViewById<WebView> (Resource.Id.webView1);
			var settings = _webView.Settings;
			settings.JavaScriptEnabled = true;
			settings.AllowFileAccessFromFileURLs = true;
			settings.AllowUniversalAccessFromFileURLs = true;
			settings.BuiltInZoomControls = true;
			_webView.SetWebChromeClient(new WebChromeClient());
			_webView.LoadUrl("file:///android_asset/PDFViewer/index.html?file=" + _pdfFilePath);
		}
Exemplo n.º 18
0
		protected override void Init()
		{

			var notWorkingHtml = @"<html><body>
						<p><img src='test.jpg' /></p>
						<p>After starting (not re-entering!) the app in landscape, scroll down to see a black area which is not supposed to be there.</p>
						<p>After starting (not re-entering!) the app in portrait, scroll to the right to see a black area which is not supposed to be there.</p>
						<p>This only happends when a local image is loaded.</p>
						</body></html>";

			var workingHtml = @"<html><body>
						<p></p>
						<p>Without local image, everything works fine.</p>
						</body></html>";

			// Initialize ui here instead of ctor
			WebView webView = new WebView {
				//Source = new UrlWebViewSource {
				//	Url = "https://blog.xamarin.com/",
				//},
				Source = new HtmlWebViewSource() {
					Html = notWorkingHtml
				},
				VerticalOptions = LayoutOptions.FillAndExpand,
				HorizontalOptions = LayoutOptions.FillAndExpand
			};

			Content = webView;
		}
		public override void LoadData (byte[] _byteArray, string _MIMEType, string _textEncodingName, string _baseURL, WebView _webview)
		{
			base.LoadData(_byteArray, _MIMEType, _textEncodingName, _baseURL, _webview);
			
			// Feature isnt supported
			WebViewDidFailLoadWithError(_webview, Constants.kFeatureNotSupported);
		}
		public override void Reload (WebView _webview)
		{
			base.Reload(_webview);
			
			// Feature isnt supported
			Console.LogError(Constants.kDebugTag, Constants.kFeatureNotSupported);
		}
		public override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
		{
			
			ViewGroup root = (ViewGroup)inflater.Inflate (Resource.Layout.fragment_webview_with_spinner, null);

			// For some reason, if we omit this, NoSaveStateFrameLayout thinks we are
			// FILL_PARENT / WRAP_CONTENT, making the progress bar stick to the top of the activity.
			root.LayoutParameters = new ViewGroup.LayoutParams (ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.FillParent);
	
			loadingSpinner = root.FindViewById (Resource.Id.loading_spinner);
			webView = root.FindViewById<WebView> (Resource.Id.webview);
			webView.SetWebChromeClient (webChromeClient);
			webView.SetWebViewClient (webViewClient);
	
			webView.Post (() => {
				if (CLEAR_CACHE_ON_LOAD) {
					webView.ClearCache (true);	
				}
				webView.Settings.JavaScriptEnabled = true;
				webView.Settings.JavaScriptCanOpenWindowsAutomatically = false;
				webView.LoadUrl (MAP_URL);
				webView.AddJavascriptInterface (new MyMapJsi (Activity, savedInstanceState), MAP_JSI_NAME);
			});
			
			return root;
			
		}
		public override void Create (WebView _webview, Rect _frame)
		{
			base.Create(_webview, _frame);
			
			// Feature isnt supported
			Console.LogError(Constants.kDebugTag, Constants.kFeatureNotSupported);
		}
Exemplo n.º 23
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.WebViewInterop);

            wv = FindViewById<WebView>(Resource.Id.Web);
            wv.Settings.JavaScriptEnabled = true;

            // wire up the c#-to-javascript button
            RunScriptButton = FindViewById<Button>(Resource.Id.RunScriptButton);
            RunScriptButton.Click += (s, e) => {
                wv.LoadUrl("javascript:RunAction();");
                wv.LoadUrl("javascript:SetContent('Yay for content from C#');");
            };

            wv.LoadUrl("file:///android_asset/Content/InteractivePages/Home.html");
            
            wv.SetWebViewClient(new MonkeyWebViewClient(this));
            wv.SetWebChromeClient(new MonkeyWebChromeClient());     // required for javascript:alert() handling

            // allow zooming/panning
            wv.Settings.BuiltInZoomControls = true;
            wv.Settings.SetSupportZoom(true);

            // we DON'T want the page zoomed-out, since it is phone-sized content
            wv.Settings.LoadWithOverviewMode = false;
            wv.Settings.UseWideViewPort = false;

            // scrollbar stuff
            wv.ScrollBarStyle = ScrollbarStyles.OutsideOverlay; // so there's no 'white line'
            wv.ScrollbarFadingEnabled = false;
        }
Exemplo n.º 24
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate (savedInstanceState);
            if (!((GlobalvarsApp)this.Application).ISLOGON) {
                Finish ();
            }
            SetTitle (Resource.String.SHOWLOCATION);
            SetContentView (Resource.Layout.ShowLocation);
            pathToDatabase = ((GlobalvarsApp)this.Application).DATABASE_PATH;
            latlng= Intent.GetStringExtra ("location") ?? "";

            date =  DateTime.Today;
            wv1= FindViewById<WebView> (Resource.Id.webView1);
            btnBack =FindViewById<Button> (Resource.Id.butBack);
            btnShow =FindViewById<Button> (Resource.Id.butMaP);
            txtdate = FindViewById<EditText> (Resource.Id.date);
            wv1.SetWebViewClient (new myWebView ());

            imm = (InputMethodManager)GetSystemService(Context.InputMethodService);
            txtdate.Click += delegate(object sender, EventArgs e) {
                imm.HideSoftInputFromWindow(txtdate.WindowToken, 0);
                ShowDialog (DATE_DIALOG_ID1);
            };

            btnShow.Click+= (object sender, EventArgs e) => {
                ShowMap();
            };
            btnBack.Click+= (object sender, EventArgs e) => {
                base.OnBackPressed();
            };

            // Create your application here
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            var url = Intent.GetStringExtra("monodroid.watoolkit.library.login.url");

            System.Diagnostics.Debug.WriteLine(url);

            Window.RequestFeature(WindowFeatures.Progress);

            var webView = new WebView(this);

            webView.Settings.JavaScriptEnabled = true;
            webView.Settings.SetSupportZoom(true);
            webView.Settings.BuiltInZoomControls = true;
            webView.Settings.LoadWithOverviewMode = true; //Load 100% zoomed out
            webView.ScrollBarStyle = ScrollbarStyles.OutsideOverlay;
            webView.ScrollbarFadingEnabled = true;

            webView.VerticalScrollBarEnabled = true;
            webView.HorizontalScrollBarEnabled = true;

            var notify = new AccessControlJavascriptNotify();
            notify.GotSecurityTokenResponse += GotSecurityTokenResponse;

            webView.AddJavascriptInterface(notify, "external");
            webView.SetWebViewClient(new AuthWebViewClient());
            webView.SetWebChromeClient(new AuthWebChromeClient(this));
            
            webView.LoadUrl(url);

            AddContentView(webView, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.FillParent));
        }
Exemplo n.º 26
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);
            //"a16fe3fa136e7b54b24664bb2a3c647e"
            ColorDrawable colorDrawable = new ColorDrawable (Color.ParseColor (Helpers.ColorHeader));
            ActionBar.SetBackgroundDrawable (colorDrawable);

            //fb = new FacebookClient ();
            appId = Intent.GetStringExtra ("AppId");
            extendedPermissions = Intent.GetStringExtra ("ExtendedPermissions");
            url = GetFacebookLoginUrl (appId, extendedPermissions);

            WebView webView = new WebView(this);
            webView.Settings.JavaScriptEnabled = true;
            webView.Settings.SetSupportZoom(true);
            webView.Settings.BuiltInZoomControls = true;
            webView.Settings.LoadWithOverviewMode = true; //Load 100% zoomed out
            webView.ScrollBarStyle = ScrollbarStyles.OutsideOverlay;
            webView.ScrollbarFadingEnabled = true;

            webView.VerticalScrollBarEnabled = true;
            webView.HorizontalScrollBarEnabled = true;

            webView.SetWebViewClient(new FBWebClient (this));
            webView.SetWebChromeClient(new FBWebChromeClient (this));

            AddContentView(webView, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.FillParent));

            webView.LoadUrl(url);
        }
		public override void OnViewCreated (View view, Bundle savedInstanceState)
		{
			mWebView = (WebView)view.FindViewById (Resource.Id.web_view);
			// Here, we use #mWebChromeClient with implementation for handling PermissionRequests.
			mWebView.SetWebChromeClient (mWebChromeClient);
			ConfigureWebSettings (mWebView.Settings);
		}
Exemplo n.º 28
0
 public BrowserWindow()
 {
     rootTree = RootTree.LoadTree(@"/Library/Frameworks/Mono.framework/Versions/Current/lib/monodoc");
     MonoDocWebRequest.RegisterWithRootTree(rootTree);
     treeView = new DocTreeView(rootTree);
     treeView.SelectionChanged += treeView_SelectionChanged;
     scrollView = new ScrollView() { Scrollers = Axis.Both };
     scrollView.DocumentView = treeView;
     webView = new WebView();
     //			splitView = new SplitView()
     //			{
     //				Margin = new Thickness(0, 0, 0, Window.SmallBottomBarHeight),
     //				Width = double.NaN,
     //				Height = double.NaN,
     //				Orientation = Orientation.Horizontal,
     //				DividerStyle = DividerStyle.Thin,
     //			};
     //			splitView.Children.Add(scrollView);
     //			splitView.Children.Add(webView);
     //			Content.Children.Add(splitView);
     scrollView.HorizontalAlignment = HorizontalAlignment.Left;
     scrollView.Width = 250;
     scrollView.Margin = new Thickness(4, 4, 4, Window.SmallBottomBarHeight + 4);
     webView.HorizontalAlignment = HorizontalAlignment.Right;
     webView.Margin = new Thickness(258, 4, 4, Window.SmallBottomBarHeight + 4);
     Content.Children.Add(scrollView);
     Content.Children.Add(webView);
     CreateToolbarTemplate();
     Toolbar = new Toolbar() { Customizable = true, TemplateName = "Main" };
     BottomBarHeight = Window.SmallBottomBarHeight;
     Title = "Mono Documentation Browser";
 }
Exemplo n.º 29
0
        public override void OnPageStarted(WebView view, string url, Android.Graphics.Bitmap favicon)
        {
            base.OnPageStarted(view, url, favicon);

            _urlText.Text = url;
            _urlText.SetSelection(0);
        }
        public override void OnProgressChanged(WebView view, int newProgress)
        {
            base.OnProgressChanged(view, newProgress);

            _context.SetProgress(newProgress * 100);

            if (newProgress == 100)
            {
                _context.Title = view.Title;

                bool soundEnabled = PreferenceManager.GetDefaultSharedPreferences(_context.ApplicationContext).GetBoolean("sounds", false);

                if (soundEnabled)
                {
                    _mediaPlayer = MediaPlayer.Create(_context.ApplicationContext, Resource.Raw.inception_horn);
                    _mediaPlayer.Completion += delegate { _mediaPlayer.Release(); };
                    _mediaPlayer.Start();
                }

                // add this page to the history
                using (SQLiteDatabase db = _historyDataHelper.WritableDatabase)
                {
                    var values = new ContentValues();
                    values.Put("Title", view.Title);
                    values.Put("Url", view.Url);
                    values.Put("Timestamp", DateTime.Now.Ticks);

                    db.Insert("history", null, values);
                }
            }
            else
            {
                _context.Title = _context.ApplicationContext.Resources.GetString(Resource.String.title_loading);
            }
        }
Exemplo n.º 31
0
 public void Initialize(WebView webView)
 {
     _webView = webView;
 }
 public override bool ShouldOverrideUrlLoading(WebView view, string url)
 {
     view.LoadUrl(url);
     return(true);
 }
 public override bool ShouldOverrideUrlLoading(WebView view, IWebResourceRequest request)
 {
     view.LoadUrl(request.Url.ToString());
     return(true);
 }
Exemplo n.º 34
0
        private async void ScriptNotify(object sender, NotifyEventArgs e)
        {
            var notify = JsonConvert.DeserializeObject <NotifytModel>(e.Value);
            var contentPageViewModel = DataContext as ContentPageViewModel;

            switch (notify.Type)
            {
            case "POSITION":
                ContentMenuPosition = HtmlHelper.ConvertToPoint(notify.Value1, notify.Value2);
                break;

            case "SELECTED":
                string text = notify.Value1;
                SelectContent = SearchTools.RemoveBlank(text);
                double PaddingLeft = LeftSidePanelGrid.Visibility == Visibility.Visible ? 368 : 48;
                ContextMenuInitial(ContentMenuPosition, PaddingLeft);
                break;

            case "INFINITE":
                if (Navigating)
                {
                    return;
                }
                await Task.Run(() => { Navigating = true; });

                WebView webView = sender as WebView;

                switch (notify.Value1)
                {
                case "UP":
                    var last = contentPageViewModel.GetBackwardNode();
                    if (last == null)
                    {
                        break;
                    }
                    contentPageViewModel.LoadingContent(last.Title, RollingDirection.Up);
                    await InvokeScript(webView, "loadingupvisible();");

                    string backwardContent = await contentPageViewModel.GoBackWardContent(last);

                    var recordUP = new NavigationRecord
                    {
                        TOCId = last.ID,
                        Type  = NavigationType.TOCDocument
                    };
                    backwardContent = await HtmlHelper.PageSplit(backwardContent, recordUP);

                    string jsonUp = JsonConvert.SerializeObject(new { content = backwardContent, selector = string.Format("#tocId{0}", last.ID) });
                    await InvokeScript(webView, "AppendHtml_Top(" + jsonUp + ");");

                    contentPageViewModel.LoadingCompleted();
                    await InvokeScript(webView, string.Format("ListenHref('#tocId{0} a');", last.ID));

                    break;

                case "DOWN":
                    var next = contentPageViewModel.GetForwardNode();
                    if (next == null)
                    {
                        break;
                    }
                    contentPageViewModel.LoadingContent(next.Title, RollingDirection.Down);
                    await InvokeScript(webView, "loadingdownvisible();");

                    string forwardContent = await contentPageViewModel.GoForWardContent(next);

                    var recordDown = new NavigationRecord
                    {
                        TOCId = next.ID,
                        Type  = NavigationType.TOCDocument
                    };
                    forwardContent = await HtmlHelper.PageSplit(forwardContent, recordDown);

                    string jsonDowm = JsonConvert.SerializeObject(new { content = forwardContent, selector = string.Format("#tocId{0}", next.ID) });
                    await InvokeScript(webView, "AppendHtml_Bottom(" + jsonDowm + ");");

                    contentPageViewModel.LoadingCompleted();
                    await InvokeScript(webView, string.Format("ListenHref('#tocId{0} a');", next.ID));

                    break;
                }
                //avoid scroll event hannpens twice
                Task.Run(() =>
                {
                    using (ManualResetEvent manualResetEvent = new ManualResetEvent(false))
                    {
                        manualResetEvent.WaitOne(1000);
                        Navigating = false;
                    }
                });
                break;

            case "SCROLL":
                int tocId = int.Parse(notify.Value1.Substring(5));
                await contentPageViewModel.ResetTocByScroll(tocId);

                break;

            case "HREF":
                if (notify.Value1.StartsWith("about:"))
                {
                    notify.Value1 = notify.Value1.Replace("about:", "http://");
                }
                contentPageViewModel.LinkAnalyze(notify.Value1);
                break;

            case "PBO":
                string pageNum = notify.Value1;
                contentPageViewModel.PageNum = "Page " + pageNum;
                break;

            case "COUNTRYCODE":
                break;
            }
        }
Exemplo n.º 35
0
 private void web_PermissionRequested(WebView sender, WebViewPermissionRequestedEventArgs args)
 {
     args.PermissionRequest.Allow();
 }
Exemplo n.º 36
0
        public async Task <string> DoWork(string videoId, CancellationToken token)
        {
            var result = new string[2];
            var client = new HttpClient(new HttpClientHandler {
                AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate
            });

            client.DefaultRequestHeaders.TryAddWithoutValidation("User-Agent", "Mozilla/5.0 (X11; Linux x86_64; rv:10.0) Gecko/20150101 Firefox/47.0 (Chrome)");
            client.DefaultRequestHeaders.TryAddWithoutValidation("Accept-Encoding", "gzip, deflate");
            client.DefaultRequestHeaders.TryAddWithoutValidation("Accept-Language", "en-us,en;q=0.5");
            client.DefaultRequestHeaders.TryAddWithoutValidation("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
            client.DefaultRequestHeaders.TryAddWithoutValidation("Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.7");

            Match matcher;

            try
            {
                var request  = new HttpRequestMessage(HttpMethod.Get, $"https://www.youtube.com/embed/{videoId}");
                var response = await client.SendAsync(request, token);

                var embedCode = await response.Content.ReadAsStringAsync();

                if (token.IsCancellationRequested)
                {
                    return(null);
                }

                var parameters = $"video_id={videoId}&ps=default&gl=US&hl=en";
                try
                {
                    parameters += "&eurl=" + WebUtility.UrlEncode("https://youtube.googleapis.com/v/" + videoId);
                }
                catch { }

                if (embedCode != null)
                {
                    matcher = stsPattern.Match(embedCode);
                    if (matcher.Success)
                    {
                        parameters += "&sts=" + embedCode.Substring(matcher.Index + 6, matcher.Length - 6);
                    }
                    else
                    {
                        parameters += "&sts=";
                    }
                }

                var encrypted = false;
                var extra     = new string[] { "", "&el=info", "&el=embedded", "&el=detailpage", "&el=vevo" };
                for (int i = 0; i < extra.Length; i++)
                {
                    request  = new HttpRequestMessage(HttpMethod.Get, "https://www.youtube.com/get_video_info?" + parameters + extra[i]);
                    response = await client.SendAsync(request, token);

                    var videoInfo = await response.Content.ReadAsStringAsync();

                    if (token.IsCancellationRequested)
                    {
                        return(null);
                    }

                    var fmts = string.Empty;

                    var exists = false;
                    if (videoInfo != null)
                    {
                        var args = videoInfo.Split('&');
                        for (int a = 0; a < args.Length; a++)
                        {
                            if (args[a].StartsWith("url_encoded_fmt_stream_map") || args[a].StartsWith("adaptive_fmts"))
                            {
                                var args2 = args[a].Split('=');
                                fmts += WebUtility.UrlDecode(args2[1]) + "&";
                            }


                            if (args[a].StartsWith("dashmpd"))
                            {
                                exists = true;
                                var args2 = args[a].Split('=');
                                if (args2.Length == 2)
                                {
                                    try
                                    {
                                        result[0] = WebUtility.UrlDecode(args2[1]);
                                    }
                                    catch { }
                                }
                            }
                            else if (args[a].StartsWith("use_cipher_signature"))
                            {
                                var args2 = args[a].Split('=');
                                if (args2.Length == 2)
                                {
                                    if (args2[1].ToLower().Equals("true"))
                                    {
                                        encrypted = true;
                                    }
                                }
                            }
                        }
                    }
                    if (exists)
                    {
                        break;
                    }

                    var yolo = fmts.Trim('&').Split('&').Select(x => new Tuple <string, string>(x.Split('=')[0], WebUtility.UrlDecode(x.Split('=')[1]))).ToList();
                }

                if (result[0] != null && (encrypted || result[0].Contains("/s/")) && embedCode != null)
                {
                    encrypted = true;
                    int index  = result[0].IndexOf("/s/");
                    int index2 = result[0].IndexOf('/', index + 10);
                    if (index != -1)
                    {
                        if (index2 == -1)
                        {
                            index2 = result[0].Length;
                        }
                        sig = result[0].Substring(index, index2 - index);
                        String jsUrl = null;
                        matcher = jsPattern.Match(embedCode);
                        if (matcher.Success)
                        {
                            try
                            {
                                var tokener = JsonValue.Parse(matcher.Groups[1].Value);
                                if (tokener.ValueType == JsonValueType.String)
                                {
                                    jsUrl = tokener.GetString();
                                }
                            }
                            catch { }
                        }

                        if (jsUrl != null)
                        {
                            matcher = playerIdPattern.Match(jsUrl);
                            String playerId;
                            if (matcher.Success)
                            {
                                playerId = matcher.Groups[1].Value + matcher.Groups[2].Value;
                            }
                            else
                            {
                                matcher = playerIdPattern2.Match(jsUrl);
                                if (matcher.Success)
                                {
                                    playerId = matcher.Groups[1].Value + matcher.Groups[2].Value;
                                }
                                else
                                {
                                    playerId = null;
                                }
                            }
                            String functionCode = null;
                            String functionName = null;
                            var    preferences  = ApplicationData.Current.LocalSettings.CreateContainer("YouTubeCode", ApplicationDataCreateDisposition.Always);
                            if (playerId != null)
                            {
                                functionCode = preferences.Values[playerId] as string;
                                functionName = preferences.Values[playerId + "n"] as string;
                            }
                            if (functionCode == null)
                            {
                                if (jsUrl.StartsWith("//"))
                                {
                                    jsUrl = "https:" + jsUrl;
                                }
                                else if (jsUrl.StartsWith("/"))
                                {
                                    jsUrl = "https://www.youtube.com" + jsUrl;
                                }

                                request  = new HttpRequestMessage(HttpMethod.Get, jsUrl);
                                response = await client.SendAsync(request, token);

                                var jsCode = await response.Content.ReadAsStringAsync();

                                if (token.IsCancellationRequested)
                                {
                                    return(null);
                                }

                                if (jsCode != null)
                                {
                                    matcher = sigPattern.Match(jsCode);
                                    if (matcher.Success)
                                    {
                                        functionName = matcher.Groups[1].Value;
                                    }
                                    else
                                    {
                                        matcher = sigPattern2.Match(jsCode);
                                        if (matcher.Success)
                                        {
                                            functionName = matcher.Groups[1].Value;
                                        }
                                    }
                                    if (functionName != null)
                                    {
                                        try
                                        {
                                            JSExtractor extractor = new JSExtractor(jsCode);
                                            functionCode = extractor.ExtractFunction(functionName);
                                            if (!string.IsNullOrEmpty(functionCode) && playerId != null)
                                            {
                                                preferences.Values[playerId]       = functionCode;
                                                preferences.Values[playerId + "n"] = functionName;
                                            }
                                        }
                                        catch (Exception e)
                                        {
                                            //FileLog.e(e);
                                        }
                                    }
                                }
                            }
                            if (!string.IsNullOrEmpty(functionCode))
                            {
                                functionCode += functionName + "('" + sig.Substring(3) + "');";

                                var webView = new WebView(WebViewExecutionMode.SeparateThread);
                                var value   = await webView.InvokeScriptAsync("eval", new[] { functionCode });

                                result[0] = result[0].Replace(sig, "/signature/" + value); // value.Substring(1, value.Length - 1));
                                encrypted = false;
                                Debugger.Break();
                            }
                        }
                    }
                }

                return(token.IsCancellationRequested || encrypted ? null : result[0]);
            }
            catch { }
            finally
            {
                client.Dispose();
            }

            return(token.IsCancellationRequested ? null : result[0]);
        }
 private void ADWebView_NewWindowRequested(WebView sender, WebViewNewWindowRequestedEventArgs args)
 {
     clickAd = true;
     //Utils.ShowMessageToast("点击了广告");
     System.Diagnostics.Debug.WriteLine("点击了广告");
 }
Exemplo n.º 38
0
        private void ParseAndDisplay(JsonValue json)
        {
            WebView wv_answer = FindViewById <WebView> (Resource.Id.wv_answer);

            wv_answer.LoadUrl(json ["image"]);
        }
Exemplo n.º 39
0
 private void web_UnsafeContentWarningDisplaying(WebView sender, object args)
 {
 }
Exemplo n.º 40
0
 private void web_UnsupportedUriSchemeIdentified(WebView sender, WebViewUnsupportedUriSchemeIdentifiedEventArgs args)
 {
 }
Exemplo n.º 41
0
 private void web_UnviewableContentIdentified(WebView sender, WebViewUnviewableContentIdentifiedEventArgs args)
 {
     IAsyncOperation <bool> b = Windows.System.Launcher.LaunchUriAsync(args.Uri);
 }
Exemplo n.º 42
0
 private void web_ContentLoading(WebView sender, WebViewContentLoadingEventArgs args)
 {
     style();
 }
Exemplo n.º 43
0
 private void web_LongRunningScriptDetected(WebView sender, WebViewLongRunningScriptDetectedEventArgs args)
 {
     args.StopPageScriptExecution = true;
 }
Exemplo n.º 44
0
 private void web_NewWindowRequested(WebView sender, WebViewNewWindowRequestedEventArgs args)
 {
     // args.Handled = true;
     // UtilityClass.OpenExternalLink(sender, args.Uri);
 }
Exemplo n.º 45
0
 private void NavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args) => Modern.NavigationCompleted(this, args.IsSuccess);
Exemplo n.º 46
0
 private async void DOMContentLoaded(WebView sender, WebViewDOMContentLoadedEventArgs args)
 {
     string func = "var style = document.createElement('style'); style.innerHTML = 'body, html { background: transparent !important; } p.ip { display: none !important; }'; document.head.appendChild(style);";
     await sender.InvokeScriptAsync("eval", new string[] { func });
 }
Exemplo n.º 47
0
        private void Home_Loaded(object sender, RoutedEventArgs e)
        {
            if (isfirst == true)
            {
                isfirst        = false;
                HomeGrid       = FavouritesGridView;
                webViewControl = WebViewControl;
                try
                {
                    tICO.IsOn = (Boolean)Windows.Storage.ApplicationData.Current.LocalSettings.Values["HomeIcon"];
                    if ((Boolean)Windows.Storage.ApplicationData.Current.LocalSettings.Values["HomeIcon"] == true)
                    {
                        icon.Visibility = Visibility.Visible;
                    }
                    else
                    {
                        icon.Visibility = Visibility.Collapsed;
                    }
                    TfAV.IsOn = (Boolean)Windows.Storage.ApplicationData.Current.LocalSettings.Values["HomeFav"];
                    if ((Boolean)Windows.Storage.ApplicationData.Current.LocalSettings.Values["HomeFav"] == true)
                    {
                        FavouritesGridView.Visibility = Visibility.Visible;
                    }
                    else
                    {
                        FavouritesGridView.Visibility = Visibility.Collapsed;
                    }
                    TqUI.IsOn = (Boolean)Windows.Storage.ApplicationData.Current.LocalSettings.Values["HomePin"];
                    if ((Boolean)Windows.Storage.ApplicationData.Current.LocalSettings.Values["HomePin"] == true)
                    {
                        QuickPinnedGrid.Visibility = Visibility.Visible;
                    }
                    else
                    {
                        QuickPinnedGrid.Visibility = Visibility.Collapsed;
                    }
                    TmOR.IsOn = (Boolean)Windows.Storage.ApplicationData.Current.LocalSettings.Values["HomeMore"];
                    if ((Boolean)Windows.Storage.ApplicationData.Current.LocalSettings.Values["HomeMore"] == true)
                    {
                        loadcontentmore.Visibility = Visibility.Visible;
                    }
                    else
                    {
                        loadcontentmore.Visibility = Visibility.Collapsed;
                    }
                    TSea.IsOn = (Boolean)Windows.Storage.ApplicationData.Current.LocalSettings.Values["HomeSearch"];
                    if ((Boolean)Windows.Storage.ApplicationData.Current.LocalSettings.Values["HomeSearch"] == true)
                    {
                        SearchBox.Visibility = Visibility.Visible;
                    }
                    else
                    {
                        SearchBox.Visibility = Visibility.Collapsed;
                    }
                }
                catch
                {
                    Windows.Storage.ApplicationData.Current.LocalSettings.Values["HomeIcon"]   = true;
                    Windows.Storage.ApplicationData.Current.LocalSettings.Values["HomeFav"]    = true;
                    Windows.Storage.ApplicationData.Current.LocalSettings.Values["HomeSearch"] = true;
                    Windows.Storage.ApplicationData.Current.LocalSettings.Values["HomePin"]    = true;
                    Windows.Storage.ApplicationData.Current.LocalSettings.Values["HomeMore"]   = true;
                    tICO.IsOn = (bool)Windows.Storage.ApplicationData.Current.LocalSettings.Values["HomeIcon"];
                    QuickPinnedGrid.Visibility    = Visibility.Visible;
                    loadcontentmore.Visibility    = Visibility.Visible;
                    FavouritesGridView.Visibility = Visibility.Visible;
                    icon.Visibility      = Visibility.Visible;
                    TfAV.IsOn            = (Boolean)Windows.Storage.ApplicationData.Current.LocalSettings.Values["HomeFav"];
                    TqUI.IsOn            = (Boolean)Windows.Storage.ApplicationData.Current.LocalSettings.Values["HomePin"];
                    TmOR.IsOn            = (Boolean)Windows.Storage.ApplicationData.Current.LocalSettings.Values["HomeMore"];
                    TSea.IsOn            = (Boolean)Windows.Storage.ApplicationData.Current.LocalSettings.Values["HomeSearch"];
                    SearchBox.Visibility = Visibility.Visible;
                }

                try
                {
                    if ((bool)Windows.Storage.ApplicationData.Current.LocalSettings.Values["CustomUrlBool"] == true)
                    {
                        FindName("WebViewHome");
                        WebViewHome.Navigate(new Uri((string)Windows.Storage.ApplicationData.Current.LocalSettings.Values["CustomUrl"]));
                        Option2RadioButton.IsChecked = true;
                        UnloadObject(Home);
                    }
                    else
                    {
                        Option1RadioButton.IsChecked = true;
                        UnloadObject(WebViewHome);
                        LoadFavorites();
                        LoadQuickPinned();
                    }
                }
                catch
                {
                    Option1RadioButton.IsChecked = true;
                    Windows.Storage.ApplicationData.Current.LocalSettings.Values["CustomUrlBool"] = false;
                    Windows.Storage.ApplicationData.Current.LocalSettings.Values["CustomUrl"]     = "";
                    LoadFavorites();
                    LoadQuickPinned();
                    UnloadObject(WebViewHome);
                }
                try
                {
                    if ((bool)Windows.Storage.ApplicationData.Current.LocalSettings.Values["CustomBackgroundBool"] == true)
                    {
                        f = true;
                        Imageoption.IsChecked      = true;
                        BackGroundimage.Visibility = Visibility.Visible;
                        BitmapImage bitmapImage = new BitmapImage();                                            // dimension, so long as one dimension measurement is provided
                        bitmapImage.UriSource  = new Uri((string)Windows.Storage.ApplicationData.Current.LocalSettings.Values["CustomBackgroundPath"]);
                        BackGroundimage.Source = bitmapImage;
                        f = false;
                    }
                    else
                    {
                        DefaultacrylicOption.IsChecked = true;
                        BackGroundimage.Visibility     = Visibility.Collapsed;
                        DefaultacrylicOption.IsChecked = true;
                    }
                }
                catch
                {
                    DefaultacrylicOption.IsChecked = true;
                    BackGroundimage.Visibility     = Visibility.Collapsed;
                    Windows.Storage.ApplicationData.Current.LocalSettings.Values["CustomBackgroundBool"] = false;
                    Windows.Storage.ApplicationData.Current.LocalSettings.Values["CustomBackgroundPath"] = "";
                }
            }
        }
Exemplo n.º 48
0
 private void NavigationStarting(WebView sender, WebViewNavigationStartingEventArgs args) => args.Cancel = Modern.NavigationStarting(this, args.Uri);
Exemplo n.º 49
0
 private void WebView_NavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args)
 {
     _urlTextBox.Text = sender.Source.ToString();
     Prev.IsEnabled   = sender.CanGoBack;
     Next.IsEnabled   = sender.CanGoForward;
 }
Exemplo n.º 50
0
 private void NewsHomePage_NewWindowRequested(WebView sender, WebViewNewWindowRequestedEventArgs args)
 {
     webViewControl.Navigate(args.Uri);
     WebViewPage.HomeFrameFrame.Visibility = Visibility.Collapsed;
     args.Handled = true;
 }
 public override void OnPageFinished(WebView view, string url)
 {
     base.OnPageFinished(view, url);
     view.EvaluateJavascript(_javascript, null);
 }
 public override void ViewDidAppear(bool animated)
 {
     base.ViewDidAppear(animated);
     WebView.LoadRequest(new NSUrlRequest(new NSUrl("http://www.dillonbuchanan.com")));
 }
Exemplo n.º 53
0
 public async void ClearAllCookies()
 {
     await WebView.ClearTemporaryWebDataAsync();
 }
 void webviewLoadlink_FrameNavigationCompleted(WebView sender, WebViewNavigationCompletedEventArgs args)
 {
     ProgressLoad.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
 }
Exemplo n.º 55
0
        private void OnNewWindowRequested(WebView sender, WebViewNewWindowRequestedEventArgs e)
        {
            mySaveView.Navigate(e.Uri);

            e.Handled = true;
        }
Exemplo n.º 56
0
 private async Task InvokeScript(WebView webView, string request)
 {
     await webView.InvokeScriptAsync("eval", new string[] { request });
 }
Exemplo n.º 57
0
        public void ShowPage(PageType type, string [] warnings)
        {
            if (type == PageType.Setup)
            {
                Header      = "Welcome to SparkleShare!";
                Description = "First off, what’s your name and email?\n(visible only to team members)";

                FullNameLabel       = new SparkleLabel("Full Name:", NSTextAlignment.Right);
                FullNameLabel.Frame = new RectangleF(165, Frame.Height - 234, 160, 17);

                FullNameTextField = new NSTextField()
                {
                    Frame       = new RectangleF(330, Frame.Height - 238, 196, 22),
                    StringValue = UnixUserInfo.GetRealUser().RealName,
                    Delegate    = new SparkleTextFieldDelegate()
                };

                EmailLabel       = new SparkleLabel("Email:", NSTextAlignment.Right);
                EmailLabel.Frame = new RectangleF(165, Frame.Height - 264, 160, 17);

                EmailTextField = new NSTextField()
                {
                    Frame    = new RectangleF(330, Frame.Height - 268, 196, 22),
                    Delegate = new SparkleTextFieldDelegate()
                };

                CancelButton = new NSButton()
                {
                    Title = "Cancel"
                };

                ContinueButton = new NSButton()
                {
                    Title   = "Continue",
                    Enabled = false
                };


                (FullNameTextField.Delegate as SparkleTextFieldDelegate).StringValueChanged += delegate {
                    Controller.CheckSetupPage(FullNameTextField.StringValue, EmailTextField.StringValue);
                };

                (EmailTextField.Delegate as SparkleTextFieldDelegate).StringValueChanged += delegate {
                    Controller.CheckSetupPage(FullNameTextField.StringValue, EmailTextField.StringValue);
                };

                ContinueButton.Activated += delegate {
                    string full_name = FullNameTextField.StringValue.Trim();
                    string email     = EmailTextField.StringValue.Trim();

                    Controller.SetupPageCompleted(full_name, email);
                };

                CancelButton.Activated += delegate { Controller.SetupPageCancelled(); };

                Controller.UpdateSetupContinueButtonEvent += delegate(bool button_enabled) {
                    Program.Controller.Invoke(() => {
                        ContinueButton.Enabled = button_enabled;
                    });
                };


                ContentView.AddSubview(FullNameLabel);
                ContentView.AddSubview(FullNameTextField);
                ContentView.AddSubview(EmailLabel);
                ContentView.AddSubview(EmailTextField);

                Buttons.Add(ContinueButton);
                Buttons.Add(CancelButton);

                Controller.CheckSetupPage(FullNameTextField.StringValue, EmailTextField.StringValue);

                if (FullNameTextField.StringValue.Equals(""))
                {
                    MakeFirstResponder((NSResponder)FullNameTextField);
                }
                else
                {
                    MakeFirstResponder((NSResponder)EmailTextField);
                }
            }

            if (type == PageType.Invite)
            {
                Header      = "You’ve received an invite!";
                Description = "Do you want to add this project to SparkleShare?";

                AddressLabel       = new SparkleLabel("Address:", NSTextAlignment.Right);
                AddressLabel.Frame = new RectangleF(165, Frame.Height - 240, 160, 17);

                AddressTextField = new SparkleLabel(Controller.PendingInvite.Address, NSTextAlignment.Left)
                {
                    Frame = new RectangleF(330, Frame.Height - 240, 260, 17),
                    Font  = SparkleUI.BoldFont
                };

                PathLabel       = new SparkleLabel("Remote Path:", NSTextAlignment.Right);
                PathLabel.Frame = new RectangleF(165, Frame.Height - 264, 160, 17);

                PathTextField = new SparkleLabel(Controller.PendingInvite.RemotePath, NSTextAlignment.Left)
                {
                    Frame = new RectangleF(330, Frame.Height - 264, 260, 17),
                    Font  = SparkleUI.BoldFont
                };

                CancelButton = new NSButton()
                {
                    Title = "Cancel"
                };
                AddButton = new NSButton()
                {
                    Title = "Add"
                };


                CancelButton.Activated += delegate { Controller.PageCancelled(); };
                AddButton.Activated    += delegate { Controller.InvitePageCompleted(); };


                ContentView.AddSubview(AddressLabel);
                ContentView.AddSubview(PathLabel);
                ContentView.AddSubview(AddressTextField);
                ContentView.AddSubview(PathTextField);

                Buttons.Add(AddButton);
                Buttons.Add(CancelButton);
            }

            if (type == PageType.Add)
            {
                Header      = "Where’s your project hosted?";
                Description = "";

                AddressLabel = new SparkleLabel("Address:", NSTextAlignment.Left)
                {
                    Frame = new RectangleF(190, Frame.Height - 308, 160, 17),
                    Font  = SparkleUI.BoldFont
                };

                AddressTextField = new NSTextField()
                {
                    Frame       = new RectangleF(190, Frame.Height - 336, 196, 22),
                    Font        = SparkleUI.Font,
                    Enabled     = (Controller.SelectedPlugin.Address == null),
                    Delegate    = new SparkleTextFieldDelegate(),
                    StringValue = "" + Controller.PreviousAddress
                };

                AddressTextField.Cell.LineBreakMode = NSLineBreakMode.TruncatingTail;

                PathLabel = new SparkleLabel("Remote Path:", NSTextAlignment.Left)
                {
                    Frame = new RectangleF(190 + 196 + 16, Frame.Height - 308, 160, 17),
                    Font  = SparkleUI.BoldFont
                };

                PathTextField = new NSTextField()
                {
                    Frame       = new RectangleF(190 + 196 + 16, Frame.Height - 336, 196, 22),
                    Enabled     = (Controller.SelectedPlugin.Path == null),
                    Delegate    = new SparkleTextFieldDelegate(),
                    StringValue = "" + Controller.PreviousPath
                };

                PathTextField.Cell.LineBreakMode = NSLineBreakMode.TruncatingTail;

                PathHelpLabel = new SparkleLabel(Controller.SelectedPlugin.PathExample, NSTextAlignment.Left)
                {
                    TextColor = NSColor.DisabledControlText,
                    Frame     = new RectangleF(190 + 196 + 16, Frame.Height - 355, 204, 17),
                    Font      = NSFontManager.SharedFontManager.FontWithFamily("Lucida Grande",
                                                                               NSFontTraitMask.Condensed, 0, 11),
                };

                AddressHelpLabel = new SparkleLabel(Controller.SelectedPlugin.AddressExample, NSTextAlignment.Left)
                {
                    TextColor = NSColor.DisabledControlText,
                    Frame     = new RectangleF(190, Frame.Height - 355, 204, 17),
                    Font      = NSFontManager.SharedFontManager.FontWithFamily("Lucida Grande",
                                                                               NSFontTraitMask.Condensed, 0, 11),
                };

                if (TableView == null || TableView.RowCount != Controller.Plugins.Count)
                {
                    TableView = new NSTableView()
                    {
                        Frame            = new RectangleF(0, 0, 0, 0),
                        RowHeight        = 34,
                        IntercellSpacing = new SizeF(8, 12),
                        HeaderView       = null,
                        Delegate         = new SparkleTableViewDelegate()
                    };

                    ScrollView = new NSScrollView()
                    {
                        Frame               = new RectangleF(190, Frame.Height - 280, 408, 185),
                        DocumentView        = TableView,
                        HasVerticalScroller = true,
                        BorderType          = NSBorderType.BezelBorder
                    };

                    IconColumn = new NSTableColumn()
                    {
                        Width         = 36,
                        HeaderToolTip = "Icon",
                        DataCell      = new NSImageCell()
                        {
                            ImageAlignment = NSImageAlignment.Right
                        }
                    };

                    DescriptionColumn = new NSTableColumn()
                    {
                        Width         = 350,
                        HeaderToolTip = "Description",
                        Editable      = false
                    };

                    DescriptionColumn.DataCell.Font = NSFontManager.SharedFontManager.FontWithFamily("Lucida Grande",
                                                                                                     NSFontTraitMask.Condensed, 0, 11);

                    TableView.AddColumn(IconColumn);
                    TableView.AddColumn(DescriptionColumn);

                    // Hi-res display support was added after Snow Leopard
                    if (Environment.OSVersion.Version.Major < 11)
                    {
                        DataSource = new SparkleDataSource(1, Controller.Plugins);
                    }
                    else
                    {
                        DataSource = new SparkleDataSource(BackingScaleFactor, Controller.Plugins);
                    }

                    TableView.DataSource = DataSource;
                    TableView.ReloadData();

                    (TableView.Delegate as SparkleTableViewDelegate).SelectionChanged += delegate {
                        Controller.SelectedPluginChanged(TableView.SelectedRow);
                        Controller.CheckAddPage(AddressTextField.StringValue, PathTextField.StringValue, TableView.SelectedRow);
                    };
                }

                TableView.SelectRow(Controller.SelectedPluginIndex, false);
                TableView.ScrollRowToVisible(Controller.SelectedPluginIndex);
                MakeFirstResponder((NSResponder)TableView);

                HistoryCheckButton = new NSButton()
                {
                    Frame = new RectangleF(190, Frame.Height - 400, 300, 18),
                    Title = "Fetch prior revisions"
                };

                if (Controller.FetchPriorHistory)
                {
                    HistoryCheckButton.State = NSCellStateValue.On;
                }

                HistoryCheckButton.SetButtonType(NSButtonType.Switch);

                AddButton = new NSButton()
                {
                    Title   = "Add",
                    Enabled = false
                };

                CancelButton = new NSButton()
                {
                    Title = "Cancel"
                };


                Controller.ChangeAddressFieldEvent += delegate(string text, string example_text, FieldState state) {
                    Program.Controller.Invoke(() => {
                        AddressTextField.StringValue = text;
                        AddressTextField.Enabled     = (state == FieldState.Enabled);
                        AddressHelpLabel.StringValue = example_text;
                    });
                };

                Controller.ChangePathFieldEvent += delegate(string text, string example_text, FieldState state) {
                    Program.Controller.Invoke(() => {
                        PathTextField.StringValue = text;
                        PathTextField.Enabled     = (state == FieldState.Enabled);
                        PathHelpLabel.StringValue = example_text;
                    });
                };


                (AddressTextField.Delegate as SparkleTextFieldDelegate).StringValueChanged += delegate {
                    Controller.CheckAddPage(AddressTextField.StringValue, PathTextField.StringValue, TableView.SelectedRow);
                };

                (PathTextField.Delegate as SparkleTextFieldDelegate).StringValueChanged += delegate {
                    Controller.CheckAddPage(AddressTextField.StringValue, PathTextField.StringValue, TableView.SelectedRow);
                };


                HistoryCheckButton.Activated += delegate {
                    Controller.HistoryItemChanged(HistoryCheckButton.State == NSCellStateValue.On);
                };

                AddButton.Activated += delegate {
                    Controller.AddPageCompleted(AddressTextField.StringValue, PathTextField.StringValue);
                };

                CancelButton.Activated += delegate { Controller.PageCancelled(); };

                Controller.UpdateAddProjectButtonEvent += delegate(bool button_enabled) {
                    Program.Controller.Invoke(() => {
                        AddButton.Enabled = button_enabled;
                    });
                };

                ContentView.AddSubview(ScrollView);
                ContentView.AddSubview(AddressLabel);
                ContentView.AddSubview(AddressTextField);
                ContentView.AddSubview(AddressHelpLabel);
                ContentView.AddSubview(PathLabel);
                ContentView.AddSubview(PathTextField);
                ContentView.AddSubview(PathHelpLabel);
                ContentView.AddSubview(HistoryCheckButton);

                Buttons.Add(AddButton);
                Buttons.Add(CancelButton);

                Controller.CheckAddPage(AddressTextField.StringValue, PathTextField.StringValue, TableView.SelectedRow);
            }

            if (type == PageType.Syncing)
            {
                Header      = "Adding project ‘" + Controller.SyncingFolder + "’…";
                Description = "This may take a while for large projects.\nIsn’t it coffee-o’clock?";

                ProgressIndicator = new NSProgressIndicator()
                {
                    Frame         = new RectangleF(190, Frame.Height - 200, 640 - 150 - 80, 20),
                    Style         = NSProgressIndicatorStyle.Bar,
                    MinValue      = 0.0,
                    MaxValue      = 100.0,
                    Indeterminate = false,
                    DoubleValue   = Controller.ProgressBarPercentage
                };

                ProgressIndicator.StartAnimation(this);

                CancelButton = new NSButton()
                {
                    Title = "Cancel"
                };

                FinishButton = new NSButton()
                {
                    Title   = "Finish",
                    Enabled = false
                };

                ProgressLabel       = new SparkleLabel("Preparing to fetch files…", NSTextAlignment.Right);
                ProgressLabel.Frame = new RectangleF(Frame.Width - 40 - 250, 185, 250, 25);


                Controller.UpdateProgressBarEvent += delegate(double percentage, string speed) {
                    Program.Controller.Invoke(() => {
                        ProgressIndicator.DoubleValue = percentage;
                        ProgressLabel.StringValue     = speed;
                    });
                };


                CancelButton.Activated += delegate { Controller.SyncingCancelled(); };


                ContentView.AddSubview(ProgressLabel);
                ContentView.AddSubview(ProgressIndicator);

                Buttons.Add(FinishButton);
                Buttons.Add(CancelButton);
            }

            if (type == PageType.Error)
            {
                Header      = "Oops! Something went wrong…";
                Description = "Please check the following:";

                // Displaying marked up text with Cocoa is
                // a pain, so we just use a webview instead
                WebView web_view = new WebView();
                web_view.Frame = new RectangleF(190, Frame.Height - 525, 375, 400);

                string html = "<style>" +
                              "* {" +
                              "  font-family: 'Lucida Grande';" +
                              "  font-size: 12px; cursor: default;" +
                              "}" +
                              "body {" +
                              "  -webkit-user-select: none;" +
                              "  margin: 0;" +
                              "  padding: 3px;" +
                              "}" +
                              "li {" +
                              "  margin-bottom: 16px;" +
                              "  margin-left: 0;" +
                              "  padding-left: 0;" +
                              "  line-height: 20px;" +
                              "  word-wrap: break-word;" +
                              "}" +
                              "ul {" +
                              "  padding-left: 24px;" +
                              "}" +
                              "</style>" +
                              "<ul>" +
                              "  <li><b>" + Controller.PreviousUrl + "</b> is the address we’ve compiled. Does this look alright?</li>" +
                              "  <li>Is this computer’s Client ID known by the host?</li>" +
                              "</ul>";

                if (warnings.Length > 0)
                {
                    string warnings_markup = "";

                    foreach (string warning in warnings)
                    {
                        warnings_markup += "<br><b>" + warning + "</b>";
                    }

                    html = html.Replace("</ul>", "<li>Here’s the raw error message: " + warnings_markup + "</li></ul>");
                }

                web_view.MainFrame.LoadHtmlString(html, new NSUrl(""));
                web_view.DrawsBackground = false;

                CancelButton = new NSButton()
                {
                    Title = "Cancel"
                };
                TryAgainButton = new NSButton()
                {
                    Title = "Try Again…"
                };


                CancelButton.Activated   += delegate { Controller.PageCancelled(); };
                TryAgainButton.Activated += delegate { Controller.ErrorPageCompleted(); };


                ContentView.AddSubview(web_view);

                Buttons.Add(TryAgainButton);
                Buttons.Add(CancelButton);
            }

            if (type == PageType.CryptoSetup || type == PageType.CryptoPassword)
            {
                if (type == PageType.CryptoSetup)
                {
                    Header      = "Set up file encryption";
                    Description = "Please a provide a strong password that you don’t use elsewhere.";
                }
                else
                {
                    Header      = "This project contains encrypted files";
                    Description = "Please enter the password to see their contents.";
                }

                int extra_pos_y = 0;

                if (type == PageType.CryptoPassword)
                {
                    extra_pos_y = 20;
                }

                PasswordLabel = new SparkleLabel("Password:"******"Show password",
                    State = NSCellStateValue.Off
                };

                ShowPasswordCheckButton.SetButtonType(NSButtonType.Switch);

                WarningImage      = NSImage.ImageNamed("NSInfo");
                WarningImage.Size = new SizeF(24, 24);

                WarningImageView = new NSImageView()
                {
                    Image = WarningImage,
                    Frame = new RectangleF(200, Frame.Height - 320, 24, 24)
                };

                WarningTextField = new SparkleLabel("This password can’t be changed later, and your files can’t be recovered if it’s forgotten.", NSTextAlignment.Left)
                {
                    Frame = new RectangleF(235, Frame.Height - 390, 325, 100),
                };

                CancelButton = new NSButton()
                {
                    Title = "Cancel"
                };

                ContinueButton = new NSButton()
                {
                    Title   = "Continue",
                    Enabled = false
                };


                Controller.UpdateCryptoPasswordContinueButtonEvent += delegate(bool button_enabled) {
                    Program.Controller.Invoke(() => { ContinueButton.Enabled = button_enabled; });
                };

                Controller.UpdateCryptoSetupContinueButtonEvent += delegate(bool button_enabled) {
                    Program.Controller.Invoke(() => { ContinueButton.Enabled = button_enabled; });
                };

                ShowPasswordCheckButton.Activated += delegate {
                    if (PasswordTextField.Superview == ContentView)
                    {
                        PasswordTextField.RemoveFromSuperview();
                        ContentView.AddSubview(VisiblePasswordTextField);
                    }
                    else
                    {
                        VisiblePasswordTextField.RemoveFromSuperview();
                        ContentView.AddSubview(PasswordTextField);
                    }
                };

                (PasswordTextField.Delegate as SparkleTextFieldDelegate).StringValueChanged += delegate {
                    VisiblePasswordTextField.StringValue = PasswordTextField.StringValue;

                    if (type == PageType.CryptoSetup)
                    {
                        Controller.CheckCryptoSetupPage(PasswordTextField.StringValue);
                    }
                    else
                    {
                        Controller.CheckCryptoPasswordPage(PasswordTextField.StringValue);
                    }
                };

                (VisiblePasswordTextField.Delegate as SparkleTextFieldDelegate).StringValueChanged += delegate {
                    PasswordTextField.StringValue = VisiblePasswordTextField.StringValue;

                    if (type == PageType.CryptoSetup)
                    {
                        Controller.CheckCryptoSetupPage(PasswordTextField.StringValue);
                    }
                    else
                    {
                        Controller.CheckCryptoPasswordPage(PasswordTextField.StringValue);
                    }
                };

                ContinueButton.Activated += delegate {
                    if (type == PageType.CryptoSetup)
                    {
                        Controller.CryptoSetupPageCompleted(PasswordTextField.StringValue);
                    }
                    else
                    {
                        Controller.CryptoPasswordPageCompleted(PasswordTextField.StringValue);
                    }
                };

                CancelButton.Activated += delegate { Controller.CryptoPageCancelled(); };


                ContentView.AddSubview(PasswordLabel);
                ContentView.AddSubview(PasswordTextField);
                ContentView.AddSubview(ShowPasswordCheckButton);

                if (type == PageType.CryptoSetup)
                {
                    ContentView.AddSubview(WarningImageView);
                    ContentView.AddSubview(WarningTextField);
                }

                Buttons.Add(ContinueButton);
                Buttons.Add(CancelButton);

                NSApplication.SharedApplication.RequestUserAttention(NSRequestUserAttentionType.CriticalRequest);
            }


            if (type == PageType.Finished)
            {
                Header      = "Your shared project is ready!";
                Description = "You can find the files in your SparkleShare folder.";

                if (warnings.Length > 0)
                {
                    WarningImage      = NSImage.ImageNamed("NSInfo");
                    WarningImage.Size = new SizeF(24, 24);

                    WarningImageView = new NSImageView()
                    {
                        Image = WarningImage,
                        Frame = new RectangleF(200, Frame.Height - 175, 24, 24)
                    };

                    WarningTextField       = new SparkleLabel(warnings [0], NSTextAlignment.Left);
                    WarningTextField.Frame = new RectangleF(235, Frame.Height - 245, 325, 100);

                    ContentView.AddSubview(WarningImageView);
                    ContentView.AddSubview(WarningTextField);
                }

                ShowFilesButton = new NSButton()
                {
                    Title = "Show Files…"
                };
                FinishButton = new NSButton()
                {
                    Title = "Finish"
                };


                ShowFilesButton.Activated += delegate { Controller.ShowFilesClicked(); };
                FinishButton.Activated    += delegate { Controller.FinishPageCompleted(); };


                Buttons.Add(FinishButton);
                Buttons.Add(ShowFilesButton);

                NSApplication.SharedApplication.RequestUserAttention(NSRequestUserAttentionType.CriticalRequest);
            }

            if (type == PageType.Tutorial)
            {
                SlideImage = NSImage.ImageNamed("tutorial-slide-" + Controller.TutorialPageNumber);
                if (SlideImage != null)
                {
                    SlideImage.Size = new SizeF(324, 200);

                    SlideImageView = new NSImageView()
                    {
                        Image = SlideImage,
                        Frame = new RectangleF(228, Frame.Height - 350, 324, 200)
                    };

                    ContentView.AddSubview(SlideImageView);
                }

                switch (Controller.TutorialPageNumber)
                {
                case 1: {
                    Header      = "What’s happening next?";
                    Description = "SparkleShare creates a special folder on your computer " +
                                  "that will keep track of your projects.";

                    SkipTutorialButton = new NSButton()
                    {
                        Title = "Skip Tutorial"
                    };
                    ContinueButton = new NSButton()
                    {
                        Title = "Continue"
                    };


                    SkipTutorialButton.Activated += delegate { Controller.TutorialSkipped(); };
                    ContinueButton.Activated     += delegate { Controller.TutorialPageCompleted(); };


                    ContentView.AddSubview(SlideImageView);

                    Buttons.Add(ContinueButton);
                    Buttons.Add(SkipTutorialButton);

                    break;
                }

                case 2: {
                    Header      = "Sharing files with others";
                    Description = "All files added to your project folders are synced automatically with " +
                                  "the host and your team members.";

                    ContinueButton = new NSButton()
                    {
                        Title = "Continue"
                    };
                    ContinueButton.Activated += delegate { Controller.TutorialPageCompleted(); };
                    Buttons.Add(ContinueButton);

                    break;
                }

                case 3: {
                    Header      = "The status icon helps you";
                    Description = "It shows the syncing progress, provides easy access to " +
                                  "your projects, and lets you view recent changes.";

                    ContinueButton = new NSButton()
                    {
                        Title = "Continue"
                    };
                    ContinueButton.Activated += delegate { Controller.TutorialPageCompleted(); };
                    Buttons.Add(ContinueButton);

                    break;
                }

                case 4: {
                    Header      = "Here’s your unique Client ID";
                    Description = "You’ll need it whenever you want to link this computer to a host. " +
                                  "You can also find it in the status icon menu.";

                    LinkCodeTextField = new NSTextField()
                    {
                        StringValue = Program.Controller.CurrentUser.PublicKey,
                        Enabled     = false,
                        Selectable  = false,
                        Frame       = new RectangleF(230, Frame.Height - 238, 246, 22)
                    };

                    LinkCodeTextField.Cell.UsesSingleLineMode = true;
                    LinkCodeTextField.Cell.LineBreakMode      = NSLineBreakMode.TruncatingTail;

                    CopyButton = new NSButton()
                    {
                        Title      = "Copy",
                        BezelStyle = NSBezelStyle.RoundRect,
                        Frame      = new RectangleF(480, Frame.Height - 238, 60, 22)
                    };

                    StartupCheckButton = new NSButton()
                    {
                        Frame = new RectangleF(190, Frame.Height - 400, 300, 18),
                        Title = "Add SparkleShare to startup items",
                        State = NSCellStateValue.On
                    };

                    StartupCheckButton.SetButtonType(NSButtonType.Switch);

                    FinishButton = new NSButton()
                    {
                        Title = "Finish"
                    };


                    StartupCheckButton.Activated += delegate {
                        Controller.StartupItemChanged(StartupCheckButton.State == NSCellStateValue.On);
                    };

                    CopyButton.Activated   += delegate { Controller.CopyToClipboardClicked(); };
                    FinishButton.Activated += delegate { Controller.TutorialPageCompleted(); };


                    ContentView.AddSubview(LinkCodeTextField);
                    ContentView.AddSubview(CopyButton);
                    ContentView.AddSubview(StartupCheckButton);

                    Buttons.Add(FinishButton);

                    break;
                }
                }
            }
        }
Exemplo n.º 58
0
 public JobOfferPage()
 {
     NavigationPage.SetHasNavigationBar(this, false);
     InitializeComponent();
     wv = Browser;
 }
Exemplo n.º 59
0
 public override void OnPageFinished(WebView view, string url)
 {
     UserDialogs.Instance.HideLoading();
 }
Exemplo n.º 60
0
        private void SetThreatLevel(int id, double threat)
        {
            WebView web = FindViewById <WebView> (Resource.Id.threatView);

            RunOnUiThread(() => web.LoadUrl(String.Format("javascript:window.UI.setThreatLevel({0}, {1});", id, threat), null));
        }