diff --git a/Presence.Desktop/ViewModels/GroupViewModel.cs b/Presence.Desktop/ViewModels/GroupViewModel.cs index 7d6f5fb..9df72bb 100644 --- a/Presence.Desktop/ViewModels/GroupViewModel.cs +++ b/Presence.Desktop/ViewModels/GroupViewModel.cs @@ -8,12 +8,24 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Reactive.Linq; +using System.Threading.Tasks; +using System.Windows.Input; using Tmds.DBus.Protocol; namespace Presence.Desktop.ViewModels { public class GroupViewModel : ViewModelBase, IRoutableViewModel { + public ICommand OpenFileDialog { get; } + public Interaction SelectFileInteraction => _SelectFileInteraction; + public readonly Interaction _SelectFileInteraction; + private string? _selectedFile; + public string? SelectedFile + { + get => _selectedFile; + set => this.RaiseAndSetIfChanged(ref _selectedFile, value); + } + private readonly List _groupPresentersDataSource = new List(); private ObservableCollection _groups; public ObservableCollection Groups => _groups; @@ -50,6 +62,8 @@ namespace Presence.Desktop.ViewModels _groups = new ObservableCollection(_groupPresentersDataSource); _groupUseCase = groupUseCase; + _SelectFileInteraction = new Interaction(); + OpenFileDialog = ReactiveCommand.CreateFromTask(SelectFile); _users = new ObservableCollection(); RefreshGroups(); @@ -72,7 +86,7 @@ namespace Presence.Desktop.ViewModels { Users.Add(item); } - } + } private void RefreshGroups() @@ -98,5 +112,11 @@ namespace Presence.Desktop.ViewModels } public string? UrlPathSegment { get; } public IScreen HostScreen { get; } + + private async Task SelectFile() + { + Console.WriteLine("clock"); + SelectedFile = await _SelectFileInteraction.Handle("Chose csv file"); + } } } \ No newline at end of file diff --git a/Presence.Desktop/Views/GroupView.axaml b/Presence.Desktop/Views/GroupView.axaml index e63b8c6..0aa048c 100644 --- a/Presence.Desktop/Views/GroupView.axaml +++ b/Presence.Desktop/Views/GroupView.axaml @@ -27,7 +27,7 @@ - +