-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial ability to create poser datasets
- Loading branch information
Showing
6 changed files
with
120 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
SightKeeper.Avalonia/DataSets/Dialogs/PoserTagViewModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Windows.Input; | ||
using FluentValidation; | ||
using SightKeeper.Application.DataSets.Tags; | ||
|
||
namespace SightKeeper.Avalonia.DataSets.Dialogs; | ||
|
||
internal sealed class PoserTagViewModel : TagViewModel, PoserTagData, IDisposable | ||
{ | ||
IReadOnlyCollection<TagData> PoserTagData.KeyPointTags => _tagsEditor.Tags; | ||
|
||
public ICommand AddKeyPointTagCommand => _tagsEditor.AddTagCommand; | ||
public IReadOnlyCollection<TagViewModel> KeyPointTags => _tagsEditor.Tags; | ||
public BehaviorObservable<bool> IsKeyPointsValid => _tagsEditor.IsValid; | ||
|
||
public PoserTagViewModel(string name, IValidator<TagData> validator) : base(name, validator) | ||
{ | ||
} | ||
|
||
public void Dispose() | ||
{ | ||
_tagsEditor.Dispose(); | ||
} | ||
|
||
private readonly TagsEditorViewModel _tagsEditor = new(); | ||
} |
23 changes: 23 additions & 0 deletions
23
SightKeeper.Avalonia/DataSets/Dialogs/PoserTagsEditorViewModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using System; | ||
using System.Reactive.Disposables; | ||
using SightKeeper.Application.DataSets.Tags; | ||
using SightKeeper.Application.Extensions; | ||
|
||
namespace SightKeeper.Avalonia.DataSets.Dialogs; | ||
|
||
internal sealed class PoserTagsEditorViewModel : TagsEditorViewModel | ||
{ | ||
protected override TagViewModel CreateTagViewModel(string name, TagDataValidator validator) | ||
{ | ||
PoserTagViewModel tag = new(name, validator); | ||
tag.IsKeyPointsValid.Subscribe(_ => UpdateIsValid()).DisposeWith(_disposable); | ||
return tag; | ||
} | ||
|
||
protected override bool IsTagValid(TagViewModel tag) | ||
{ | ||
return base.IsTagValid(tag) && ((PoserTagViewModel)tag).IsKeyPointsValid; | ||
} | ||
|
||
private readonly CompositeDisposable _disposable = new(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters