Пример #1
0
        public SettingsDlg(AlvSettings alvSettings, bool firstTimeShown)
        {
            log.Debug("Creating SettingsDlg form");

            InitializeComponent();
            this.settings   = alvSettings;
            this.totalCmd   = new TotalCmdIntegration();
            this.logBrowser = LogBrowserSettings.Instance;


            //Load values from filter entry
            this.showMarkersCheckBox.Checked                 = this.settings.MainFormUI.ShowMarkers;
            this.exitAppOnESCCheckBox.Checked                = this.settings.MainFormUI.ExitAppOnESC;
            this.autoScrollCheckBox.Checked                  = this.settings.MainFormUI.AutoScrollWhenAutoRefresh;
            this.autoScrollShowTwoItemsCheckBox.Checked      = this.settings.MainFormUI.AutoScrollShowTwoItems;
            this.autoRefreshPeriodEdit.Value                 = this.settings.MainFormUI.AutoRefreshPeriod;
            this.addOnlyBaseNameInRecentListCheckBox.Checked = this.settings.MainFormUI.AddOnlyBaseNameInRecentList;
            this.rememberFiltersEnabledCheckBox.Checked      = this.settings.MainFormUI.RememberFiltersEnabled;
            this.trimClassColumnFromLeftCheckBox.Checked     = this.settings.MainFormUI.TrimClassColumnFromLeft;
            this.showLogIconsCheckBox.Checked                = this.settings.MainFormUI.ShowLogIcons;

            this.extDiffPathEdit.Text       = settings.TextDiff.DiffPath;
            this.extDiffParametersEdit.Text = settings.TextDiff.DiffParameters;

            this.extTextEditPathEdit.Text       = settings.TextEditor.TextEditorPath;
            this.extTextEditParametersEdit.Text = settings.TextEditor.TextEditorParameteres;

            this.topLevelFolders.Text = this.logBrowser.TopLevelFolders;
            this.openAndExitOnDoubleClickCheckBox.Checked = this.logBrowser.ShowAndCloseOnDoubleClick;

            this.integrateWithTotalCmdCheckBox.Checked = this.totalCmd.IsLogViewerIntegrated;
            if (this.totalCmd.IsInstalled)
            {
                this.integrateWithTotalCmdCheckBox.Enabled = true;
                this.totalCmdStatusLabel.Text = "Total Commander is installed on this computer.";
            }
            else
            {
                this.integrateWithTotalCmdCheckBox.Enabled = false;
                this.totalCmdStatusLabel.Text = "Total Commander wasn't found on this computer.";
            }

            try
            {
                alvWasAssociated = FileAssociation.IsAssociated(".log", "AdvancedLogViewer");
                associateWithAlvCheckBox.Checked = alvWasAssociated || firstTimeShown;
            }
            catch
            {
                MessageBox.Show("Can't get information about associated application with LOG extension. Run ALV as Administrator.", "Administration rights required", MessageBoxButtons.OK, MessageBoxIcon.Error);
                associateWithAlvCheckBox.Enabled = false;
            }
            this.automaticUpdateEnabledCheckBox.Checked = this.settings.AutomaticUpdates.EnableAutomaticCheck;
            this.automaticUpdateCheckPeriodEdit.Value   = this.settings.AutomaticUpdates.CheckInterval;

            log.Debug("SettingsDlg form created");
        }
        public SettingsDlg(AlvSettings alvSettings, bool firstTimeShown)
        {
            log.Debug("Creating SettingsDlg form");

            InitializeComponent();
            this.settings   = alvSettings;
            this.totalCmd   = new TotalCmdIntegration();
            this.logBrowser = LogBrowserSettings.Instance;


            //Load values from filter entry
            this.showMarkersCheckBox.Checked                 = this.settings.MainFormUI.ShowMarkers;
            this.exitAppOnESCCheckBox.Checked                = this.settings.MainFormUI.ExitAppOnESC;
            this.autoScrollCheckBox.Checked                  = this.settings.MainFormUI.AutoScrollWhenAutoRefresh;
            this.autoScrollShowTwoItemsCheckBox.Checked      = this.settings.MainFormUI.AutoScrollShowTwoItems;
            this.autoRefreshPeriodEdit.Value                 = this.settings.MainFormUI.AutoRefreshPeriod;
            this.addOnlyBaseNameInRecentListCheckBox.Checked = this.settings.MainFormUI.AddOnlyBaseNameInRecentList;
            this.rememberFiltersEnabledCheckBox.Checked      = this.settings.MainFormUI.RememberFiltersEnabled;
            this.trimClassColumnFromLeftCheckBox.Checked     = this.settings.MainFormUI.TrimClassColumnFromLeft;
            this.showLogIconsCheckBox.Checked                = this.settings.MainFormUI.ShowLogIcons;
            this.messageWordWrapCheckBox.Checked             = this.settings.MainFormUI.MessageWordWrap;
            foreach (FontFamily font in FontFamily.Families)
            {
                FontComboBox.Items.Add(font.Name);
            }
            FontComboBox.SelectedItem = this.settings.MainFormUI.MessageFontFamily;
            MessageFontSize.Value     = (decimal)this.settings.MainFormUI.MessageFontSize;

            this.extDiffPathEdit.Text       = settings.TextDiff.DiffPath;
            this.extDiffParametersEdit.Text = settings.TextDiff.DiffParameters;

            this.extTextEditPathEdit.Text       = settings.TextEditor.TextEditorPath;
            this.extTextEditParametersEdit.Text = settings.TextEditor.TextEditorParameteres;

            this.topLevelFolders.Text = this.logBrowser.TopLevelFolders;
            this.openAndExitOnDoubleClickCheckBox.Checked = this.logBrowser.ShowAndCloseOnDoubleClick;

            this.integrateWithTotalCmdCheckBox.Checked = this.totalCmd.IsLogViewerIntegrated;
            if (this.totalCmd.IsInstalled)
            {
                this.integrateWithTotalCmdCheckBox.Enabled = true;
                this.totalCmdStatusLabel.Text = "Total Commander is installed on this computer.";
            }
            else
            {
                this.integrateWithTotalCmdCheckBox.Enabled = false;
                this.totalCmdStatusLabel.Text = "Total Commander wasn't found on this computer.";
            }

            try
            {
                alvWasAssociated = FileAssociation.IsAssociated(".log", "AdvancedLogViewer");
                associateWithAlvCheckBox.Checked = alvWasAssociated || firstTimeShown;
            }
            catch
            {
                MessageBox.Show("Can't get information about associated application with LOG extension. Run ALV as Administrator.", "Administration rights required", MessageBoxButtons.OK, MessageBoxIcon.Error);
                associateWithAlvCheckBox.Enabled = false;
            }
            try
            {
                explorerContextMenuWasPresent     = Registry.GetValue(@"HKEY_CURRENT_USER\SOFTWARE\Classes\Folder\Shell\Browse for Logs\command", null, null) != null;
                showBrowseWithAlvCheckBox.Checked = explorerContextMenuWasPresent;
            }
            catch
            {
                MessageBox.Show("Can't get information about explorer context menu. Run ALV as Administrator.", "Administration rights required", MessageBoxButtons.OK, MessageBoxIcon.Error);
                showBrowseWithAlvCheckBox.Enabled = false;
            }
            this.automaticUpdateEnabledCheckBox.Checked = this.settings.AutomaticUpdates.EnableAutomaticCheck;
            this.automaticUpdateCheckPeriodEdit.Value   = this.settings.AutomaticUpdates.CheckInterval;

            log.Debug("SettingsDlg form created");
        }