Ejemplo n.º 1
0
        private void SelectionChanged(ISavedPresetEntry entry)
        {
            if (_ignoreNext)
            {
                _ignoreNext = false;
                return;
            }

            if (entry == null)
            {
                return;
            }
            SelectedPresetFilename = entry.Filename;
            _currentUserPresetData = null;

            if (!_partiallyIgnoreNext && _presetable != null)
            {
                PresetSelected?.Invoke(this, new ChangedPresetEventArgs(_presetable.PresetableKey, entry.ToString()));

                try {
                    _presetable.ImportFromPresetData(entry.ReadData());
                } catch (Exception) {
                    return; // TODO: Informing
                }
            }

            SetChanged(false);
        }
Ejemplo n.º 2
0
        public void SwitchToPreset(ISavedPresetEntry entry)
        {
            var backup = Controls.CurrentPresetName == null || Controls.CurrentPresetChanged;

            if (backup && WarnIfChanged && ModernDialog.ShowMessage(
                    string.Format(ControlsStrings.Controls_LoadPresetWarning, entry.DisplayName),
                    ControlsStrings.Common_AreYouSure, MessageBoxButton.YesNo) != MessageBoxResult.Yes)
            {
                return;
            }

            Controls.LoadPreset(entry.Filename, backup);
        }
Ejemplo n.º 3
0
 public bool Equals(ISavedPresetEntry other)
 {
     return(other != null && string.Equals(VirtualFilename, other.VirtualFilename, StringComparison.OrdinalIgnoreCase));
 }
Ejemplo n.º 4
0
 public bool Equals(ISavedPresetEntry other) {
     return other != null && string.Equals(Filename, other.Filename, StringComparison.OrdinalIgnoreCase);
 }
Ejemplo n.º 5
0
 public static string ReadData([NotNull] this ISavedPresetEntry preset)
 {
     return(preset.ReadBinaryData().ToUtf8String());
 }
Ejemplo n.º 6
0
 private void SwitchTo(string value)
 {
     _partiallyIgnoreNext = true;
     CurrentUserPreset    = SavedPresets.FirstOrDefault(x => x.ToString() == value);
     _partiallyIgnoreNext = false;
 }
Ejemplo n.º 7
0
        public void SwitchToPreset(ISavedPresetEntry entry) {
            var backup = Controls.CurrentPresetName == null || Controls.CurrentPresetChanged;
            if (backup && WarnIfChanged && ModernDialog.ShowMessage(
                    string.Format(ControlsStrings.Controls_LoadPresetWarning, entry.DisplayName),
                    ControlsStrings.Common_AreYouSure, MessageBoxButton.YesNo) != MessageBoxResult.Yes) {
                return;
            }

            Controls.LoadPreset(entry.Filename, backup);
        }
Ejemplo n.º 8
0
 private void SwitchTo(string value) {
     _partiallyIgnoreNext = true;
     CurrentUserPreset = SavedPresets.FirstOrDefault(x => x.ToString() == value);
     _partiallyIgnoreNext = false;
 }
Ejemplo n.º 9
0
        private void SelectionChanged(ISavedPresetEntry entry) {
            if (_ignoreNext) {
                _ignoreNext = false;
                return;
            }

            if (entry == null) return;
            SelectedPresetFilename = entry.Filename;
            _currentUserPresetData = null;

            if (!_partiallyIgnoreNext && _presetable != null) {
                PresetSelected?.Invoke(this, new ChangedPresetEventArgs(_presetable.PresetableKey, entry.ToString()));

                try {
                    _presetable.ImportFromPresetData(entry.ReadData());
                } catch (Exception) {
                    return; // TODO: Informing
                }
            }

            SetChanged(false);
        }