public override void Execute() { if (SystemInformation.MouseButtonsSwapped || SystemParameters.SwapButtons) //TODO: somehow get which mouse button invoked this command { if (FunctionsDetails.Details.ContainsKey(Text)) { WebBrowserForm.Show(FunctionsDetails.Details[Text]); // menuFunctionsToolTip.SetFunctionInfo(FunctionsDetails.Details[this.Text]); //menuFunctionsToolTip.Show(this, menuItem.Width + 3, 0); // menuFunctionsToolTip.Show(); } } else { if ((int)SharedViewState.Instance.CurrentView < 4) { _expressionTextProvider.Text += Text; } else if ((int)SharedViewState.Instance.CurrentView == 4) { _scriptingTextProvider.Text += Text; } else if ((int)SharedViewState.Instance.CurrentView == 5) { _customFunctionsTextProvider.Text += Text; } } }
public override void Run() { WebBrowserForm form = new WebBrowserForm(Path.Combine(ApplicationUtility.DocDirectory, "home.html")); form.Navigated += delegate(object sender, WebBrowserNavigatedEventArgs e) { string fileName = Path.GetFileName(e.Url.ToString()); switch (fileName) { case "home.html#EditCompany": new EditCompany(CompanySingleton.Instance).Run(); break; case "home.html#ListItems": new ListItems().Run(); break; case "home.html#ListVendors": new ListVendors().Run(); break; case "home.html#ListCustomers": new ListCustomers().Run(); break; case "home.html#AddPurchaseOrder": new AddPurchaseOrder().Run(); break; default: break; } }; WorkbenchSingleton.AddChild(form, "Home Page"); }
/// <summary> /// Starts the authorization process and waits for the process to complete before returning. /// </summary> /// <param name="args">Authorization operation arguments.</param> /// <returns>Returns OAuth state as received back from the server, or <c>null</c> if OAuth state /// is not used with the authorization flow, or if no OAuth state specified in the <paramref name="args"/>.</returns> public override string AuthorizeSync(A args) { OnStarted(); var authzUri = BuildAuthorizationUri(args); string retValue; using (var webBrowserForm = InitializeWebBrowserForm(authzUri)) { WebBrowserForm = webBrowserForm; OnBeforeAuthorization(args, authzUri); var result = webBrowserForm.ShowDialog(); var cancelled = result != DialogResult.OK; if (cancelled) { OnCancelled(args, authzUri); retValue = null; } else { var responseParams = ParseResponseParameters(webBrowserForm.ResponseUri); OnAfterAuthorization(args, authzUri, responseParams); retValue = ReadAuthorizationResponse(args, responseParams); } WebBrowserForm = null; } return(retValue); }
public override string GetFilePath(Mapping mapping) { var fileUrl = GetSiteAddon(mapping).FileUrl; // Get the Html var html = string.Join("", WebHelper.GetHtml(fileUrl, mapping.AddonSiteId).ToArray()); // Get the Document var doc = new HtmlDocument(); doc.LoadHtml(html); var downloadUrl = doc.DocumentNode.SelectSingleNode("//li[@class='user-action user-action-download']/span/a").GetAttributeValue("href", string.Empty); var form = new WebBrowserForm(fileUrl, AddonSiteId.curseforge, mapping.Addon.Name); if (form.ShowDialog() == DialogResult.OK) { downloadUrl = form.UseFile ? form.FileUrl : form.DownloadUrl; } else { downloadUrl = string.Empty; } return(downloadUrl); }
/// <summary> /// Creates and initializes a <see cref="WebBrowserForm"/> to use for user interaction /// in the authorization process. /// </summary> /// <param name="initialAddress">The initial address.</param> /// <returns>The <see cref="WebBrowserForm"/>.</returns> protected virtual WebBrowserForm InitializeWebBrowserForm(Uri initialAddress) { var webBrowserForm = new WebBrowserForm() { Address = initialAddress.ToString(), RedirectUri = OAuthConfig.RedirectUri, AllowInsecureCerts = OAuthConfig.AllowInsecureCerts, EnableCefConsoleLogging = EnableCefConsoleLogging, }; OnRaiseInitializeBrowserForm(new InitializeBrowserFormEventArgs(webBrowserForm)); return(webBrowserForm); }
private void CreateButton_Click(object sender, EventArgs e) { var o = SettingsManager.Options; var url = o.InternetDatabaseUrl; var pql = new Uri(url).PathAndQuery.Length; var navigateUrl = url.Substring(0, url.Length - pql) + "/Security/Login.aspx"; var form = new WebBrowserForm(); form.StartPosition = FormStartPosition.CenterParent; form.NavigateUrl = navigateUrl; form.ShowDialog(); form.Dispose(); form = null; }
private void ResetButton_Click(object sender, EventArgs e) { var o = SettingsManager.Options; var url = o.InternetDatabaseUrl; var pql = new Uri(url).PathAndQuery.Length; var navigateUrl = url.Substring(0, url.Length - pql) + "/Security/Login.aspx?ShowLogin=0&ShowCreate=0"; var form = new WebBrowserForm(); form.Size = new Size(400, 300); form.Text = "Reset Login"; form.StartPosition = FormStartPosition.CenterParent; form.NavigateUrl = navigateUrl; ControlsHelper.CheckTopMost(form); form.ShowDialog(); form.Dispose(); }
/// <summary> /// Called before a new popup window is created. /// </summary> /// <param name="browser">The parent browser window.</param> /// <param name="url">The URL of the popup.</param> /// <param name="x">The x-position of the popup.</param> /// <param name="y">The y-position of the popup.</param> /// <param name="width">The width of the popup.</param> /// <param name="height">The height of the popup.</param> /// <returns>Returns true to cancel creation of the popup window.</returns> public bool OnBeforePopup(IWebBrowser browser, string url, ref int x, ref int y, ref int width, ref int height) { WebBrowserForm popup = new WebBrowserForm(url); if (x > 0 && y > 0) { popup.Location = new Point(x, y); } if (width > 0 && height > 0) { popup.Size = new Size(width, height); } popup.Show(); return(true); }
/// <summary> /// Open a URL in the default browser. /// </summary> /// <param name="url">The URL to open.</param> public void OpenUrl(string url) { if (GlobalSettings.Instance.UsePrivateBrowsing == GlobalSettings.Boolean.No || url.StartsWith("mailto:", StringComparison.OrdinalIgnoreCase)) { Process.Start(url); } else { // If the URL is in the format of a Spotify URI then we need to shell this instead of opening // in the private browsing mode form. if (Regex.IsMatch(url, @"spotify:([^\s]+:)+[a-zA-Z0-9]+")) { Process.Start(url); } else { WebBrowserForm browser = new WebBrowserForm(url); browser.Show(); } } }
public override string GetFilePath(Mapping mapping) { var addon = _addonCache.Get(mapping.AddonTag); if (addon.IsCollectRequired) { ParseInfoSite(mapping); } var fileUrl = addon.FileUrl; var downloadUrl = string.Empty; var form = new WebBrowserForm(fileUrl, AddonSiteId.curse, mapping.Addon.Name); if (form.ShowDialog() == DialogResult.OK) { downloadUrl = form.UseFile ? form.FileUrl : form.DownloadUrl; } else { downloadUrl = string.Empty; } return(downloadUrl); }
/// <summary> /// Initialises a new instance of the <see cref="WebViewLifeSpanHandler"/> class. /// </summary> /// <param name="owner">The form that owns the associated WebView.</param> public WebViewLifeSpanHandler(WebBrowserForm owner) { this.owner = owner; }
/// <summary> /// Initializes a new instance of the <see cref="InitializeBrowserFormEventArgs"/> class. /// </summary> /// <param name="webBrowserForm">The <see cref="WebBrowserForm"/> to initialize. /// Event subscribers may set properties of the form.</param> public InitializeBrowserFormEventArgs(WebBrowserForm webBrowserForm) { WebBrowserForm = webBrowserForm; }
/// <summary> /// 图标工具点击事件 /// </summary> /// <param name="toolStripItem"></param> private void ClickItemEventFunc(ToolStripItem toolStripItem, MenuStrip menuStrip) { try { Form form; MenuStrip menu = new MenuStrip(); if ("menuOut" == menuStrip.Name) { menu = this.menuInner; } else if ("menuInner" == menuStrip.Name) { menu = this.menuOut; } for (int i = 0; i < menu.Items.Count; i++) { menu.Items[i].BackColor = Color.WhiteSmoke; } if (toolStripItem.Name == "outBrowerMenuItem") { //调用系统默认的浏览器 Process.Start("https://www.baidu.com/"); /*Process[] appProcess = Process.GetProcessesByName("MiniBlinkPinvokeDemo"); * foreach (Process prc in appProcess) * { * prc.Kill(); * } * string updateExe = $@"{AppDomain.CurrentDomain.BaseDirectory}tools\MiniBlinkPinvokeDemo.exe"; * if (File.Exists(updateExe)) * { * Process p = new Process(); * p.StartInfo.FileName = updateExe; * if (p.Start()) * { * ((Form)this.TopLevelControl).WindowState = FormWindowState.Minimized; * SetForegroundWindow(p.MainWindowHandle); * } * }*/ } else if (toolStripItem.Name == "innerBrowerMenuItem") { form = new WebBrowserForm(); DialogUtil.ShowDialog(form, this, form.Width, form.Height, new Common.prop.FormWindowProp(true, false, FormBorderStyle.FixedDialog)); } else if (toolStripItem.Name == "AccoutEncStripMenuItem")//账号管理 { form = new AccoutEncFrmList(); DialogUtil.ShowDialog(form, this, form.Width, form.Height, new Common.prop.FormWindowProp(false, false, FormBorderStyle.FixedDialog)); } else if (toolStripItem.Name == "FileEncStripMenuItem") //文件加解密 { form = new FormCrypt(); DialogUtil.ShowDialog(form, this, form.Width, form.Height, new Common.prop.FormWindowProp(false, false, FormBorderStyle.FixedDialog)); } } catch (Exception ex) { MessageHelper.ShowError(ex); } }