public JabbRAuthDialog(string serverAddress, string appName) { this.ServerAddress = serverAddress; this.AppName = appName; this.DisplayMode = DialogDisplayMode.Attached; this.ClientSize = defaultSize; this.Resizable = true; this.Title = "JabbR Login"; var baseDir = Path.Combine(EtoEnvironment.GetFolderPath(EtoSpecialFolder.ApplicationResources), "Styles", "default"); webserver = new HttpServer(baseDir); LocalhostTokenUrl = new Uri(webserver.Url, "Authorize"); webserver.StaticContent.Add("/", AuthHtml(true)); webserver.StaticContent.Add("/Authorize", GetUserIDHtml()); webserver.ReceivedRequest += HandleReceivedRequest; web = new WebView(); web.DocumentLoaded += HandleDocumentLoaded; web.Url = webserver.Url; var layout = new DynamicLayout(); layout.Add(web, yscale: true); layout.AddSeparateRow(Padding.Empty).Add(null, this.CancelButton()); Content = layout; }
public SocialLoginDialog () { web = new WebView(); web.DocumentLoaded += HandleDocumentLoaded; this.AddDockedControl(web); }
Control WebView() { try { webView = new WebView(); webView.Navigated += (sender, e) => { Log.Write(webView, "Navigated, Uri: {0}", e.Uri); UpdateButtons(); }; webView.DocumentLoading += (sender, e) => { Log.Write(webView, "DocumentLoading, Uri: {0}, IsMainFrame: {1}", e.Uri, e.IsMainFrame); e.Cancel = cancelLoad.Checked ?? false; if (!e.Cancel) { UpdateButtons(); stopButton.Enabled = true; } }; webView.DocumentLoaded += (sender, e) => { Log.Write(webView, "DocumentLoaded, Uri: {0}", e.Uri); UpdateButtons(); stopButton.Enabled = false; }; webView.OpenNewWindow += (sender, e) => { Log.Write(webView, "OpenNewWindow: {0}, Url: {1}", e.NewWindowName, e.Uri); }; webView.DocumentTitleChanged += delegate(object sender, WebViewTitleEventArgs e) { titleLabel.Text = e.Title; }; return webView; } catch (Exception) { var control = new Label { Text = string.Format("WebView not supported on this platform with the {0} generator", Platform.ID), BackgroundColor = Colors.Red, TextAlignment = TextAlignment.Center, VerticalAlignment = VerticalAlignment.Center, TextColor = Colors.White }; if (Platform.IsGtk) Log.Write(this, "You must install webkit-sharp for WebView to work under GTK. Note that GTK does not support webkit-sharp on any platform other than Linux."); return control; } }
Control WebView () { try { var control = webView = new WebView (); control.DocumentLoading += delegate(object sender, WebViewLoadingEventArgs e) { Log.Write (control, "Document loading, Uri: {0}, IsMainFrame: {1}", e.Uri, e.IsMainFrame); UpdateButtons (); stopButton.Enabled = true; }; control.DocumentLoaded += delegate(object sender, WebViewLoadedEventArgs e) { Log.Write (control, "Document loaded, Uri: {0}", e.Uri); UpdateButtons (); stopButton.Enabled = false; }; control.OpenNewWindow += (sender, e) => { Log.Write (control, "Open new window with name '{0}', Url: {1}", e.NewWindowName, e.Uri); }; control.DocumentTitleChanged += delegate(object sender, WebViewTitleEventArgs e) { titleLabel.Text = e.Title; }; LoadHtml(); return control; } catch (HandlerInvalidException) { var control = new Label { Text = string.Format ("WebView not supported on this platform with the {0} generator", Generator.ID), BackgroundColor = Colors.Red, HorizontalAlign = HorizontalAlign.Center, VerticalAlign = VerticalAlign.Middle, TextColor = Colors.White }; if (Generator.ID == Generators.Gtk) Log.Write (this, "You must install webkit-sharp for WebView to work under GTK. Note that GTK does not support webkit-sharp on any platform other than Linux."); return control; } }
/// <summary> /// Raises the document loading event. /// </summary> public void OnDocumentLoading(WebView widget, WebViewLoadingEventArgs e) { widget.Platform.Invoke(() => widget.OnDocumentLoading(e)); }
/// <summary> /// Raises the navigated event. /// </summary> public void OnNavigated(WebView widget, WebViewLoadedEventArgs e) { widget.Platform.Invoke(() => widget.OnNavigated(e)); }
Control WebView() { var control = webView = new WebView (); control.DocumentLoading += delegate(object sender, WebViewLoadingEventArgs e) { UpdateButtons (); stopButton.Enabled = true; }; control.DocumentLoaded += delegate(object sender, WebViewLoadedEventArgs e) { UpdateButtons (); stopButton.Enabled = false; }; control.DocumentTitleChanged += delegate(object sender, WebViewTitleEventArgs e) { titleLabel.Text = e.Title; }; control.Url = new Uri ("http://www.google.com"); return control; }
/// <summary> /// Raises the document loading event. /// </summary> public void OnDocumentLoading(WebView widget, WebViewLoadingEventArgs e) { using (widget.Platform.Context) widget.OnDocumentLoading(e); }
/// <summary> /// Raises the open new window event. /// </summary> public void OnOpenNewWindow(WebView widget, WebViewNewWindowEventArgs e) { using (widget.Platform.Context) widget.OnOpenNewWindow(e); }
/// <summary> /// Raises the document title changed event. /// </summary> public void OnDocumentTitleChanged(WebView widget, WebViewTitleEventArgs e) { widget.Platform.Invoke(() => widget.OnDocumentTitleChanged(e)); }
/// <summary> /// Raises the navigated event. /// </summary> public void OnNavigated(WebView widget, WebViewLoadedEventArgs e) { using (widget.Platform.Context) widget.OnNavigated(e); }
/// <summary> /// Raises the open new window event. /// </summary> public void OnOpenNewWindow(WebView widget, WebViewNewWindowEventArgs e) { widget.Platform.Invoke(() => widget.OnOpenNewWindow(e)); }
/// <summary> /// Raises the document title changed event. /// </summary> public void OnDocumentTitleChanged(WebView widget, WebViewTitleEventArgs e) { using (widget.Platform.Context) widget.OnDocumentTitleChanged(e); }
public MessageSection() { History = new WebView(); History.DocumentLoaded += HandleDocumentLoaded; TextEntry = MessageEntry(); }