private void TryLoadIgnore(string fileName, bool silent) { try { _ignore = DVDProfilerSerializer <Ignore.IgnoreConfiguration> .Deserialize(fileName); } catch { if (!silent) { MessageBox.Show("The ignore file cannot be read.", "Read error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } _ignore = null; } if (_ignore != null) { IgnoreFileTextBox.Text = fileName; UpdateIgnoreLabel(); } else { IgnoreFileTextBox.Text = string.Empty; IgnoresLoadedLabel.Text = string.Empty; } }
private void ClearIgnore() { if (_ignore == null) { return; } _ignore = new Ignore.IgnoreConfiguration(); if (string.IsNullOrEmpty(IgnoreFileTextBox.Text)) { SaveIgnore(); } else { SaveIgnore(IgnoreFileTextBox.Text); } }
private void IgnoreCheckedProfiles() { ResultListView.ItemChecked -= OnResultListViewItemChecked; try { if (_ignore == null) { _ignore = new Ignore.IgnoreConfiguration(); } var rules = (_ignore.Rule ?? Enumerable.Empty <Ignore.Rule>()).ToList(); foreach (var row in GetResults(true)) { IgnoreProfile(rules, row); } _ignore.Rule = rules.ToArray(); if (string.IsNullOrEmpty(IgnoreFileTextBox.Text)) { SaveIgnore(); } else { SaveIgnore(IgnoreFileTextBox.Text); } SwitchButtons(); ApplyResultIgnores(); } finally { ResultListView.ItemChecked += OnResultListViewItemChecked; } }
public MainForm(Collection collection) { _collection = collection; _configuration = null; _ignore = null; if (Properties.Settings.Default.UpgradeRequired) { Properties.Settings.Default.Upgrade(); Properties.Settings.Default.UpgradeRequired = false; Properties.Settings.Default.Save(); } InitializeComponent(); Icon = Properties.Resources.DJDSOFT; if (collection != null) { LoadCollectionButton.Enabled = false; } else { var collectionFile = Properties.Settings.Default.CollectionFile; if (!string.IsNullOrEmpty(collectionFile) && File.Exists(collectionFile)) { try { TryLoadCollection(collectionFile); } catch { } } } var configurationFile = Properties.Settings.Default.ConfigurationFile; if (!string.IsNullOrEmpty(configurationFile) && File.Exists(configurationFile)) { try { TryLoadConfiguration(configurationFile, true); } catch { } } var ignoreFile = Properties.Settings.Default.IgnoreFile; if (!string.IsNullOrEmpty(ignoreFile) && File.Exists(ignoreFile)) { try { TryLoadIgnore(ignoreFile, true); } catch { } } SwitchButtons(); var toolTip = new ToolTip() { AutoPopDelay = 10000, InitialDelay = 1000, ReshowDelay = 1000, IsBalloon = true, ShowAlways = false, ToolTipIcon = ToolTipIcon.Info, ToolTipTitle = "Ignore", }; const string ToolTipText = "The ignore feature is for profiles that fail the check but will never be successful either."; toolTip.SetToolTip(IgnoreFileLabel, ToolTipText); toolTip.SetToolTip(IgnoreFileTextBox, ToolTipText); toolTip.SetToolTip(LoadIgnoreButton, ToolTipText); toolTip.SetToolTip(ClearIgnoreButton, ToolTipText); toolTip.SetToolTip(IgnoresLoadedLabel, ToolTipText); }