diff options
| author | Michael <[email protected]> | 2017-05-23 20:36:16 -0400 |
|---|---|---|
| committer | Michael <[email protected]> | 2017-05-23 20:36:16 -0400 |
| commit | 44a4de1c173a0ab88ff3aa519b3a25888f2eff85 (patch) | |
| tree | 005bd432271a8f004cbd8762cef0727f32602829 /ShiftOS.WinForms/Applications/WebBrowser.cs | |
| parent | 660c42a19c831b9768d7bb6845b22474459a311e (diff) | |
| download | shiftos_thereturn-44a4de1c173a0ab88ff3aa519b3a25888f2eff85.tar.gz shiftos_thereturn-44a4de1c173a0ab88ff3aa519b3a25888f2eff85.tar.bz2 shiftos_thereturn-44a4de1c173a0ab88ff3aa519b3a25888f2eff85.zip | |
web browser + fix shiftorium merge conflict
Diffstat (limited to 'ShiftOS.WinForms/Applications/WebBrowser.cs')
| -rw-r--r-- | ShiftOS.WinForms/Applications/WebBrowser.cs | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/ShiftOS.WinForms/Applications/WebBrowser.cs b/ShiftOS.WinForms/Applications/WebBrowser.cs new file mode 100644 index 0000000..751e7e2 --- /dev/null +++ b/ShiftOS.WinForms/Applications/WebBrowser.cs @@ -0,0 +1,97 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using ShiftOS.Engine; + +namespace ShiftOS.WinForms.Applications +{ + [WinOpen("web_browser")] + [AppscapeEntry("Web Browser", "We're going surfing on the Internet! This application allows you to break the bounds of the Digital Society and connect to the outer Internet inside ShiftOS.", + 4096, 10000, "color_depth_24_bits", "Networking")] + [Launcher("Web Browser", false, null, "Networking")] + [DefaultTitle("Web Browser")] + [DefaultIcon("iconShiftnet")] + public partial class WebBrowser : UserControl, IShiftOSWindow + { + public WebBrowser() + { + InitializeComponent(); + uiupdate = new Timer(); + uiupdate.Tick += (o, a) => + { + btnback.Location = new Point(2, 2); + btnforward.Location = new Point(btnback.Left + btnback.Width + 2, 2); + txturl.Location = new Point(btnforward.Left + btnforward.Width + 2, 2); + txturl.Width = flcontrols.Width - btnback.Width - 2 - btnforward.Width - 2 - (btngo.Width * 2) - 2; + btngo.Location = new Point(flcontrols.Width - btngo.Width - 2, 2); + btnback.Enabled = wbmain.CanGoBack; + btnforward.Enabled = wbmain.CanGoForward; + }; + uiupdate.Interval = 100; + } + + Timer uiupdate = null; + + public void OnLoad() + { + uiupdate.Start(); + wbmain.Url = new Uri("http://getshiftos.ml/"); + } + + public void OnSkinLoad() + { + } + + public bool OnUnload() + { + uiupdate.Stop(); + return true; + } + + public void OnUpgrade() + { + } + + private void btnback_Click(object sender, EventArgs e) + { + wbmain.GoBack(); + } + + private void btnforward_Click(object sender, EventArgs e) + { + wbmain.GoForward(); + } + + private void btngo_Click(object sender, EventArgs e) + { + wbmain.Navigate(txturl.Text); + } + + private void wbmain_NewWindow(object sender, CancelEventArgs e) + { + e.Cancel = true; + if (Shiftorium.UpgradeInstalled("web_browser_new_window")) + { + AppearanceManager.SetupWindow(new WebBrowser()); + } + } + + private void txturl_KeyDown(object sender, KeyEventArgs e) + { + if (e.KeyCode == Keys.Enter) + btngo_Click(sender, EventArgs.Empty); + } + + private void wbmain_Navigated(object sender, WebBrowserNavigatedEventArgs e) + { + txturl.Text = wbmain.Url.ToString(); + AppearanceManager.SetWindowTitle(this, wbmain.DocumentTitle + " - " + NameChangerBackend.GetNameRaw(this.GetType())); + } + } +} |
