private void OnTrackChanges(SettingsItems item, bool turnOn) { if (turnOn) { this._ChangedItems |= item; } else { this._ChangedItems &= ~item; } this._Apply.Enabled = (this._ChangedItems != SettingsItems.None); }
public void SetFIlterItem(LocalFilter localFilter) { foreach (var localFilterItem in localFilter.FilterItems) { var settingItem = SettingsItems.FirstOrDefault(item => item.Name == localFilterItem.Name); if (settingItem != null) { AddSelected(settingItem.Name, localFilterItem.Id); } } IsChecked = localFilter.IsActive; FilterId = localFilter.Id; Parent.HasChanged(false); }
private void OnTryApplySettings(bool closeForm) { if (this._ChangedItems != SettingsItems.None) { if ((this._ImageDestinations & ImageDestinations.File) == ImageDestinations.File) { // working directory check if (!Settings.IsValidPath(this._WorkingDirectoryPath.Text)) { MessageBox.Show(this, ApplicationManager.GetString("InvalidDirectoryName"), System.Windows.Forms.MessageBoxIcon.Warning); return; } if (!Directory.Exists(this._WorkingDirectoryPath.Text)) { MessageBox.Show(this, ApplicationManager.GetString("DirectoryNotExist"), System.Windows.Forms.MessageBoxIcon.Warning); return; } // file name check if (!Settings.IsValidFileNameFormat(this._FileNameSelector.Text)) { MessageBox.Show(this, ApplicationManager.GetString("InvalidFileName"), System.Windows.Forms.MessageBoxIcon.Warning); return; } // external app path check if (this._UseExternalApp.Checked) { if (!Settings.IsValidPathToExecutable(this._ExternalAppPath.Text)) { MessageBox.Show(this, ApplicationManager.GetString("InvalidExecutablePath"), System.Windows.Forms.MessageBoxIcon.Warning); return; } if (!File.Exists(this._ExternalAppPath.Text)) { MessageBox.Show(this, ApplicationManager.GetString("ExternalAppNotFound"), System.Windows.Forms.MessageBoxIcon.Warning); return; } } this._Settings.WorkingDirectory = this._WorkingDirectoryPath.Text; this._Settings.UseFileOverwrite = this._UseFileOverwrite.Checked; this._Settings.UpdateFileNameFormat(this._FileNameSelector.Text); if (this._Settings.UseExternalApp = this._UseExternalApp.Checked) { this._Settings.ExternalApp = this._ExternalAppPath.Text; } } this._Settings.IncludeCursor = this._IncludeCursor.Checked; this._Settings.AutoStartup = this._AutoStartup.Checked; this._Settings.AlwaysOnTop = this._AlwaysOnTop.Checked; this._Settings.ImageDestinations = this._ImageDestinations; this._CurrentFormatId = this._Settings.FileType.FormatId; this._ChangedItems = SettingsItems.None; this._Apply.Enabled = false; this.TopMost = this._Settings.AlwaysOnTop; Configuration.Current.Settings.FromSettings(this._Settings); Configuration.Save(this._Settings); } if (closeForm) { this.Close(); } }