protected override async void Edit(Binary binary) { string newName = ((string)await _dialogService.ShowInputDialog("Please enter a name for this binary:", DialogHostName, binary.Name)).Trim(); if (!ShouldEdit(binary, newName)) { return; } foreach (Preset preset in _presetService.Items.Where(preset => binary.Equals(preset.Binary))) { preset.Binary = new Binary(newName, SettingsService.CurrentGame); } _presetService.SaveChanges(); DataService.Rename(binary, newName); }
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(); } }