|
|
@@ -26,6 +26,12 @@ public partial class SubmitDocsViewModel : ModuleViewModel
|
|
|
|
|
|
[ObservableProperty]
|
|
|
private DataEntryTagModel _tags;
|
|
|
+
|
|
|
+ [ObservableProperty]
|
|
|
+ private bool _isSelecting = false;
|
|
|
+
|
|
|
+ private AvaloniaMenuItem AddButton;
|
|
|
+ private AvaloniaMenuItem MergeButton;
|
|
|
|
|
|
public SubmitDocsViewModel()
|
|
|
{
|
|
|
@@ -38,7 +44,7 @@ public partial class SubmitDocsViewModel : ModuleViewModel
|
|
|
() => new Filter<DataEntryTag>().All(),
|
|
|
() => DefaultCacheFileName<DataEntryTagShell>());
|
|
|
|
|
|
- PrimaryMenu.Add(new AvaloniaMenuItem(Images.plus, () =>
|
|
|
+ AddButton = new AvaloniaMenuItem(Images.plus, () =>
|
|
|
{
|
|
|
var menu = new CoreMenu<IImage>();
|
|
|
|
|
|
@@ -46,11 +52,41 @@ public partial class SubmitDocsViewModel : ModuleViewModel
|
|
|
menu.AddItem("Browse Library", BrowseLibrary);
|
|
|
|
|
|
return menu;
|
|
|
- }));
|
|
|
+ });
|
|
|
+ MergeButton = new AvaloniaMenuItem(Images.lines, () =>
|
|
|
+ {
|
|
|
+ var menu = new CoreMenu<IImage>();
|
|
|
+ menu.AddItem("Merge Documents", MergeDocuments);
|
|
|
+ menu.AddItem("Clear Selection", ClearSelection);
|
|
|
+ return menu;
|
|
|
+ })
|
|
|
+ {
|
|
|
+ IsVisible = false
|
|
|
+ };
|
|
|
+ PrimaryMenu.Add(AddButton);
|
|
|
+ PrimaryMenu.Add(MergeButton);
|
|
|
|
|
|
ProgressVisible = true;
|
|
|
}
|
|
|
|
|
|
+ private Task<bool> ClearSelection()
|
|
|
+ {
|
|
|
+ IsSelecting = false;
|
|
|
+ Documents.SelectNone();
|
|
|
+ return Task.FromResult(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ partial void OnIsSelectingChanged(bool value)
|
|
|
+ {
|
|
|
+ AddButton.IsVisible = !value;
|
|
|
+ MergeButton.IsVisible = value;
|
|
|
+ }
|
|
|
+
|
|
|
+ private async Task<bool> MergeDocuments()
|
|
|
+ {
|
|
|
+ throw new NotImplementedException();
|
|
|
+ }
|
|
|
+
|
|
|
protected override async Task<TimeSpan> OnRefresh()
|
|
|
{
|
|
|
await Task.WhenAll(Documents.RefreshAsync(false), Tags.RefreshAsync(false));
|
|
|
@@ -63,10 +99,28 @@ public partial class SubmitDocsViewModel : ModuleViewModel
|
|
|
[RelayCommand]
|
|
|
private void Click(DataEntryDocumentShell shell)
|
|
|
{
|
|
|
- Navigation.Navigate<SubmitDocsEditorViewModel>(model =>
|
|
|
+ if (IsSelecting)
|
|
|
{
|
|
|
- model.DataEntryDocument = shell;
|
|
|
- });
|
|
|
+ shell.IsSelected = !shell.IsSelected;
|
|
|
+ if(!Documents.Items.Any(x => x.IsSelected))
|
|
|
+ {
|
|
|
+ IsSelecting = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ Navigation.Navigate<SubmitDocsEditorViewModel>(model =>
|
|
|
+ {
|
|
|
+ model.DataEntryDocument = shell;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ [RelayCommand]
|
|
|
+ private void Hold(DataEntryDocumentShell shell)
|
|
|
+ {
|
|
|
+ IsSelecting = true;
|
|
|
+ shell.IsSelected = true;
|
|
|
}
|
|
|
|
|
|
private async Task<bool> AddImage<T, TOptions>(TOptions options)
|