Esempio n. 1
0
        public void ExitFullscreen()
        {
            this.FormBorderStyle = FormBorderStyle.Sizable;
            this.WindowState     = FormWindowState.Normal;

            HostWebBrowser.Focus();
        }
Esempio n. 2
0
        public void EnterFullscreen()
        {
            this.FormBorderStyle = FormBorderStyle.None;
            this.WindowState     = FormWindowState.Maximized;

            HostWebBrowser.Focus();
        }
Esempio n. 3
0
 /// <summary>
 /// The .net webbrowser control aggressively caches content, so we can force refresh on first load if 'RefreshOnFirstLoad' option is set.
 /// May need to turn this bool flag into hashtable based on url so that nested web pages are refreshed on first load as well.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void HostWebBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
 {
     if (this.Settings.WebBrowserRefreshOnFirstLoad &&
         CheckForStaleCache(HostWebBrowser.Url.ToString()))
     {
         HostWebBrowser.Refresh(WebBrowserRefreshOption.Completely);
     }
 }
Esempio n. 4
0
        private void ChildWebBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            if (HostWebBrowser.Url.AbsolutePath == "blank")
            {
                return;
            }

            if (this.Settings.WebBrowserRefreshOnFirstLoad &&
                CheckForStaleCache(HostWebBrowser.Url.ToString()))
            {
                HostWebBrowser.Refresh(WebBrowserRefreshOption.Completely);
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Window load event where we will set up WebBrowser control to load our app
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MainForm_Load(object sender, EventArgs e)
        {
            if (this.Settings.ScriptingLoggerEnabled)
            {
                loggerForm = new LoggerForm();
                loggerForm.AttachHost(this, Title, this.Icon);
                Logger = loggerForm;
                loggerForm.Show();
            }
            else
            {
                consoleLogToolStripMenuItem.Visible        = false;
                notificationIconToolStripSeparator.Visible = false;
            }

            scriptInterface = new ScriptInterface(this, loggerForm);

            this.HostWebBrowser.ScriptErrorsSuppressed     = this.Settings.WebBrowserScriptErrorsSuppressed;
            this.HostWebBrowser.WebBrowserShortcutsEnabled = this.Settings.WebBrowserShortcutsEnabled;

            if (this.Settings.WebBrowserDefaultUrl == "")
            {
                StringBuilder sb = new StringBuilder();

                sb.Append("<h3>Exoskeleton default page</h3>");
                sb.Append("Please create a settings.xos file in the same folder as the executable");

                HostWebBrowser.DocumentText = sb.ToString();
            }
            else
            {
                string url = ResolveExoUrlPath(this.Settings.WebBrowserDefaultUrl);

                // For (only) filesystem based uri's, convert relative paths to absolute.
                Uri startingUri = null;
                try
                {
                    startingUri = new Uri(url);
                    if (startingUri.IsFile)
                    {
                        FileInfo fi = new FileInfo(url);
                        startingUri = new Uri(fi.FullName);
                    }
                }
                catch
                {
                    FileInfo fi = new FileInfo(url);
                    startingUri = new Uri(fi.FullName);
                }

                try
                {
                    HostWebBrowser.Url = startingUri;
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString(), "Error assigning host browser url", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                if (this.Settings.WebBrowserAutoRefreshSecs > 0)
                {
                    RefreshTimer.Interval = this.Settings.WebBrowserAutoRefreshSecs * 1000;
                    RefreshTimer.Enabled  = true;
                }
            }

            HostWebBrowser.ObjectForScripting             = scriptInterface;
            HostWebBrowser.IsWebBrowserContextMenuEnabled = this.Settings.WebBrowserContextMenu;

            HostWebBrowser.Focus();
        }
Esempio n. 6
0
 private void RefreshTimer_Tick(object sender, EventArgs e)
 {
     HostWebBrowser.Refresh(WebBrowserRefreshOption.Completely);
 }