Exemplo n.º 1
0
 private void SaveConfiguration()
 {
     Settings.WriteInt("Annotations", "LocationX", Location.X);
     Settings.WriteInt("Annotations", "LocationY", Location.Y);
     Settings.WriteInt("Annotations", "Width", Size.Width);
     Settings.WriteInt("Annotations", "Height", Size.Height);
 }
Exemplo n.º 2
0
        public void SaveToIni(string section)
        {
            ISettingStore ini = Core.SettingStore;

            ini.WriteInt(section, "PaneCount", _paneHeights.Length);
            for (int i = 0; i < _paneHeights.Length; i++)
            {
                ini.WriteInt(section, "Pane" + i + "Height", _paneHeights [i]);
            }
            ini.WriteInt(section, "ActivePaneIndex", _activePaneIndex);
            ini.WriteInt(section, "SelectedResource", (_selectedResource == null) ? -1 : _selectedResource.Id);
        }
Exemplo n.º 3
0
        /**
         * Saves the settings in the INI file.
         */

        private void SaveSettings(ISettingStore settingStore)
        {
            string section   = GetFormSettingsSection();
            bool   maximized = (WindowState == FormWindowState.Maximized);

            settingStore.WriteBool(section, "Maximized", maximized);
            if (!maximized)
            {
                settingStore.WriteInt(section, "X", Location.X);
                settingStore.WriteInt(section, "Y", Location.Y);
                settingStore.WriteInt(section, "Width", (int)((float)ClientSize.Width / _scaleFactor.Width));
                settingStore.WriteInt(section, "Height", (int)((float)ClientSize.Height / _scaleFactor.Height));
            }
        }
Exemplo n.º 4
0
        public override void OK()
        {
            ISettingStore   settings   = Core.SettingStore;
            int             lastMethod = BookmarkService.DownloadMethod;
            BookmarkService service    = FavoritesPlugin._bookmarkService;

            if (_idleButton.Checked)
            {
                BookmarkService.DownloadMethod = 0;
                if (lastMethod != 0)
                {
                    service.SynchronizeBookmarks();
                }
            }
            else if (_immediateButton.Checked)
            {
                BookmarkService.DownloadMethod = 1;
                if (lastMethod != 1)
                {
                    service.SynchronizeBookmarks();
                }
            }
            else
            {
                BookmarkService.DownloadMethod = 2;
            }
            CookiesManager.SetUserCookieProviderName(typeof(FavoriteJob), _cookieProviderSelector.SelectedProfileName);
            IResource res = (IResource)_bookmarkFoldersBox.SelectedItem;

            if (res != null)
            {
                settings.WriteInt("Favorites", "CatAnnRoot", res.Id);
            }
        }
Exemplo n.º 5
0
        public override void OK()
        {
            ISettingStore ini = Core.SettingStore;
            int           markReadMS;

            if (!_chkMarkAsRead.Checked)
            {
                markReadMS = 0;
            }
            else
            {
                markReadMS = (int)_udMarkAsReadSeconds.Value * 1000;
                if (markReadMS == 0)
                {
                    markReadMS = 1;
                }
            }
            ini.WriteInt("Resources", "MarkAsReadTimeOut", markReadMS);
            ini.WriteBool("Resources", "ShowSearchContext", _chkShowContext.Checked);
            ini.WriteBool("Resources", "UseShortDateFormat", _chkUseShortDateFormat.Checked);
            ini.WriteBool("Search", "AutoSwitchToResults", _chkSwitchToTab.Checked);
            ini.WriteBool("Resources", "LinksInNewWindow", _radBrowserWindow.Checked);
            ini.WriteBool("Resources", "LinksInPreviewPane", _radPreviewPane.Checked);
            ini.WriteBool("Resources", "MinimizeToTray", _chkMinimizeToTray.Checked);

            ini.WriteInt("General", "BalloonTimeout", (int)_udPeriod.Value);
            ini.WriteInt("General", "BalloonBackgroundR", panelSample.BackColor.R);
            ini.WriteInt("General", "BalloonBackgroundG", panelSample.BackColor.G);
            ini.WriteInt("General", "BalloonBackgroundB", panelSample.BackColor.B);

            if (isValidPrefixes())
            {
                SubjectComparer.SubjectPrefixes = _editSubjectPrefixes.Text;
                ini.WriteString(SubjectComparer.csIniSection, SubjectComparer.csIniKey, _editSubjectPrefixes.Text);
            }

            Core.UIManager.DefaultFormattingFont   = new Font(_currFont, _currFontSize);
            Core.TextIndexManager.IdleIndexingMode = _chkIdleTextIndex.Checked;
        }
Exemplo n.º 6
0
        private void WriteDefaultAttachmentTypes()
        {
            ISettingStore ini = ICore.Instance.SettingStore;

            ini.WriteInt("Attachments", "TypeCount", 8);

            WriteAttachmentType(ini, 0, "Documents", ".txt,.doc,.xls,.ppt,.pps,.pp,.pdf,.rtf,.ps,.htm,.html,.vsd,.mpp,.mdb");
            WriteAttachmentType(ini, 1, "E-mails", ".eml,.msg");
            WriteAttachmentType(ini, 2, "Images", ".bmp,.gif,.jpg,.png,.tif,.psd,.ico");
            WriteAttachmentType(ini, 3, "Music", ".mid,.mp3,.ogg,.wav,.ra");
            WriteAttachmentType(ini, 4, "Video", ".avi,.mpg,.mpeg,.wmv,.asx,.mpe,.asf");
            WriteAttachmentType(ini, 5, "Programs", ".exe,.dll,.sh");
            WriteAttachmentType(ini, 6, "Archives", ".zip,.rar,.sit,.tgz,.gz,.tar");
            WriteAttachmentType(ini, 7, "Sources", ".c,.cpp,.cc,.h,.hpp,.cs,.java,.pas,.pl,.awk");

            ini.WriteBool("MailIndexing", "ProcessDeletedItems", false);
            ini.WriteBool("MailIndexing", "SkipBodyForIndex", false);
        }
Exemplo n.º 7
0
        public override void OK()
        {
            ISettingStore ini = Core.SettingStore;

            if (_defaultProxyButton.Checked)
            {
                ini.WriteString("HttpProxy", "Address", string.Empty);
            }
            else
            {
                string address = _address.Text;
                ini.WriteString("HttpProxy", "Address", address);
                ini.WriteInt("HttpProxy", "Port", (int)_port.Value);
                ini.WriteString("HttpProxy", "User", _user.Text);
                ini.WriteString("HttpProxy", "Password", _password.Text);
                ini.WriteBool("HttpProxy", "BypassLocal", _bypassLocal.Checked);
                ini.WriteString("HttpProxy", "BypassList", _bypassList.Text);
            }
            HttpReader.LoadHttpConfig();
        }
Exemplo n.º 8
0
        public override void OK()
        {
            _ini.WriteBool("MailFormat", "GreetingInReplies", _chkGreetingInReplies.Checked);
            _ini.WriteBool("MailFormat", "PrefixInitials", _chkPrefixInitials.Checked);
            _ini.WriteString("MailFormat", "GreetingString", _boxPrefix.Text);

            _ini.WriteBool("MailFormat", "UseSignature", _chkUseSignature.Checked);
            if (_chkUseSignature.Checked)
            {
                _ini.WriteString("MailFormat", "Signature", _signatureBox.Text);
            }

            int signatureInReplies = 1;

            if (_radReplySignatureNone.Checked)
            {
                signatureInReplies = 0;
            }
            else if (_radSignatureAfterQuoting.Checked)
            {
                signatureInReplies = 2;
            }
            _ini.WriteInt("MailFormat", "SignatureInReplies", signatureInReplies);
        }
Exemplo n.º 9
0
        private void ShowExceptionDialog()
        {
            if (_exceptionDialogVisible)
            {
                return;
            }

            _exceptionDialogVisible = true;
            bool exceptionFatal = false;

            try
            {
                while (true)
                {
                    QueuedException qex = null;
                    lock ( _exceptionQueue )
                    {
                        if (_exceptionQueue.Count > 0)
                        {
                            qex = (QueuedException)_exceptionQueue.Dequeue();
                        }
                    }
                    if (qex == null)
                    {
                        break;
                    }

                    if ((qex.Flags & ExceptionReportFlags.Fatal) != 0)
                    {
                        exceptionFatal = true;
                    }

                    Exception ex = qex.Exception;
                    if (ex is AsyncProcessorException)
                    {
                        ex = ex.InnerException;
                    }
                    if (ex is TargetInvocationException)
                    {
                        ex = ex.InnerException;
                    }

                    ISettingStore ini = Core.SettingStore;
                    using (ExceptionReportForm dlg = new ExceptionReportForm())
                    {
                        ProxySettings proxySettings = new ProxySettings();
                        try
                        {
                            string address = ini.ReadString("HttpProxy", "Address");
                            proxySettings.CustomProxy = address.Length > 0;
                            if (proxySettings.CustomProxy)
                            {
                                proxySettings.Host     = address;
                                proxySettings.Port     = ini.ReadInt("HttpProxy", "Port", 3128);
                                proxySettings.Login    = ini.ReadString("HttpProxy", "User");
                                proxySettings.Password = ini.ReadString("HttpProxy", "Password");
                            }
                            dlg.SetProxy(proxySettings);
                        }
                        catch (Exception pex)
                        {
                            Trace.WriteLine("Failed to set exception reporter proxy: " + pex.ToString());
                        }
                        // Setup our submitter
                        dlg.Submitter  = new RPCExceptionSubmitter();
                        dlg.ProjectKey = "OM";
                        dlg.DisplaySubmissionResult = true;
                        string userName = ini.ReadString("ErrorReport", "UserName");
                        string password = ini.ReadString("ErrorReport", "Password");
                        if (userName.Length > 0 && password.Length > 0)
                        {
                            dlg.SetITNLogin(userName, password);
                        }
                        else
                        {
                            dlg.SetDefaultLogin("om_anonymous", "guest");
                        }

                        if ((qex.Flags & ExceptionReportFlags.AttachLog) != 0)
                        {
                            dlg.AttachLog = true;
                        }

                        dlg.SetBuildNumber(Assembly.GetExecutingAssembly().GetName().Version.Build);

                        IWin32Window ownerWindow = (_ownerControl == null || _ownerControl.IsDisposed) ? null : _ownerControl;

                        if (dlg.ReportException(ownerWindow, ex, GetExceptionDescription()) == DialogResult.OK)
                        {
                            if (dlg.ITNUserName != "om_anonymous")
                            {
                                ini.WriteString("ErrorReport", "UserName", dlg.ITNUserName);
                                ini.WriteString("ErrorReport", "Password", dlg.ITNPassword);
                            }

                            if (dlg.AttachLog)
                            {
                                LogManager.SubmitErrorLog();
                            }
                            proxySettings = dlg.ProxySettings;
                            if (!proxySettings.CustomProxy)
                            {
                                ini.WriteString("HttpProxy", "Address", string.Empty);
                            }
                            else
                            {
                                ini.WriteString("HttpProxy", "Address", proxySettings.Host);
                                ini.WriteInt("HttpProxy", "Port", proxySettings.Port);
                                ini.WriteString("HttpProxy", "User", proxySettings.Login);
                                ini.WriteString("HttpProxy", "Password", proxySettings.Password);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(null, "An exception has occured in the application, and the exception reporter failed to present it.\n\n" + ex.Message + "\n\nThe application will now be terminated.", "Fatal Error", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                exceptionFatal = true;
            }
            _exceptionDialogVisible = false;

            if (exceptionFatal)
            {
                (Core.MainWindow as MainFrame).ForceClose();
            }
        }