diff --git a/UI/ViewModels/BulkAddViewModel.cs b/UI/ViewModels/BulkAddViewModel.cs index cc611f1..69e871c 100644 --- a/UI/ViewModels/BulkAddViewModel.cs +++ b/UI/ViewModels/BulkAddViewModel.cs @@ -27,8 +27,7 @@ public partial class BulkAddViewModel : ViewModelBase { this._mainWindow = mainWindow; - this.WindowTitle = string.Format("{0} - " + Resources.ButtonBulkAdd, - this.TagDatabaseService.DatabaseName); + this.WindowTitle = $"{this.TagDatabaseService.DatabaseName} - {Resources.ButtonBulkAdd}"; this._tags = [ diff --git a/UI/ViewModels/HierarchyTreeViewModel.cs b/UI/ViewModels/HierarchyTreeViewModel.cs index 4f2c47c..6c3c141 100644 --- a/UI/ViewModels/HierarchyTreeViewModel.cs +++ b/UI/ViewModels/HierarchyTreeViewModel.cs @@ -186,7 +186,7 @@ public partial class HierarchyTreeViewModel : ViewModelBase, IDisposable foreach (var tag in tagViewModels) { - tag.Tag = updatedTag; + tag.UpdateTag(updatedTag); tag.RefreshSelf(); tag.RefreshParentsString(); } @@ -267,7 +267,7 @@ public partial class HierarchyTreeViewModel : ViewModelBase, IDisposable foreach (var deletedTag in result.Deleted) { - await Dispatcher.UIThread.InvokeAsync(() => this.WipeTagNodesAsync(deletedTag.id)); + await Dispatcher.UIThread.InvokeAsync(() => this.WipeTagNodes(deletedTag.id)); if (this.SelectedTag?.Id == deletedTag.id) this.SelectedTag = null; } @@ -280,7 +280,7 @@ public partial class HierarchyTreeViewModel : ViewModelBase, IDisposable } } - private void WipeTagNodesAsync(int idToDelete) + private void WipeTagNodes(int idToDelete) { if (this.ChildNodeMap.TryGetValue(idToDelete, out var parentList)) { diff --git a/UI/ViewModels/TagItemViewModel.cs b/UI/ViewModels/TagItemViewModel.cs index 86565cd..3359ed7 100644 --- a/UI/ViewModels/TagItemViewModel.cs +++ b/UI/ViewModels/TagItemViewModel.cs @@ -61,6 +61,10 @@ public partial class TagItemViewModel(Tag tag, Func, List> get ? string.Join("; ", this.Tag.Parents) : string.Empty; + public void UpdateTag(Tag tag) + { + this.Tag = tag; + } public void BeginEdit() @@ -117,12 +121,6 @@ public partial class TagItemViewModel(Tag tag, Func, List> get this.OnPropertyChanged(nameof(this.HasChildren)); } - public void SyncId() - { - this.OnPropertyChanged(nameof(this.Id)); - this.OnPropertyChanged(nameof(this.OnDatabase)); - } - protected override void OnPropertyChanged(PropertyChangedEventArgs e) { base.OnPropertyChanged(e); @@ -130,20 +128,4 @@ public partial class TagItemViewModel(Tag tag, Func, List> get if (!this._isInitialising && e.PropertyName!.StartsWith("Editing")) this.UserEditedTag?.Invoke(this, EventArgs.Empty); } - - private void Validate() - { - var parentNames = this.EditingParents.Split(';', - StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries) - .ToList(); - - if (string.IsNullOrWhiteSpace(this.EditingName)) - throw new ArgumentException(Resources.ErrorBlankTagName); - - if (!this.EditingIsTopLevel && parentNames.Count == 0) - throw new InvalidOperationException(Resources.ErrorOrphanTagAttempt); - - if (parentNames.Contains(this.EditingName)) - throw new InvalidOperationException(Resources.ErrorSelfParentAttempt); - } } \ No newline at end of file