protected override void Save() { try { if (NoChanges()) { return; } if (!_preset.Name.EqualsIgnoreCase(Name.Trim())) { if (_presetService.GetByGame(_settingsService.CurrentGame).Any(preset => preset.Name.EqualsIgnoreCase(Name.Trim()))) { _dialogService.ShowWarningDialog("无法使用此名称作为另一个预设,已经存在此名称。 其他的更改已保存。"); } else { _presetService.Rename(_preset, Name.Trim()); } } if (Binary == null || (Binary.Name == "-- None --" && Binary.Game == null)) { Binary = null; } _preset.IsGlobalENBLocalEnabled = IsGlobalENBLocalEnabled; _preset.Description = Description?.Trim(); _preset.Binary = Binary; _presetService.SaveChanges(); } catch (Exception exception) { _dialogService.ShowErrorDialog(exception.Message); } finally { Close(); } }
protected override void Save() { try { if (NoChanges()) { return; } if (!_preset.Name.EqualsIgnoreCase(Name.Trim())) { if (_presetService.GetByGame(_settingsService.CurrentGame).Any(preset => preset.Name.EqualsIgnoreCase(Name.Trim()))) { _dialogService.ShowWarningDialog("Cannot use this name as another preset already has this name. Other changes will be saved."); } else { _presetService.Rename(_preset, Name.Trim()); } } if (Binary == null || (Binary.Name == "-- None --" && Binary.Game == null)) { Binary = null; } _preset.IsGlobalENBLocalEnabled = IsGlobalENBLocalEnabled; _preset.Description = Description?.Trim(); _preset.Binary = Binary; _presetService.SaveChanges(); } catch (Exception exception) { _dialogService.ShowErrorDialog(exception.Message); } finally { Close(); } }