Beispiel #1
0
        /// <summary>
        /// Show the options window then save settings.
        /// </summary>
        private void ShowOptions()
        {
            _prefs.LoadData();

            if (!_prefs.Settings.AllowUserEdit)
            {
                MessageBox.Show(@"Scriptmonkey options window has been disabled by your system administrator.", @"Scriptmonkey Options");
                return;
            }

            Options form = new Options(_prefs);
            if (form.ShowDialog() != DialogResult.Cancel)
            {
                _prefs = form.Prefs;
                _prefs.Save(true);
                _prefs.ReloadData();
                _refreshCounter = 0;
                if (_prefs.Settings.RefreshOnSave)
                {
                    try
                    {
                        // Refresh the page (run on refresh is disabled by default so navigate to the current location)
                        ((HTMLDocument)_browser.Document).parentWindow.execScript(
                            "window.location.href = window.location.href;");
                    }
                    catch (Exception ex)
                    {
                        if (LogAndCheckDebugger(ex, "Try refresh after save"))
                            throw;
                    }
                }
                _link?.SendAction("refresh");
            }
            form.Dispose();
        }