diff --git a/Presence.Desktop/App.axaml b/Presence.Desktop/App.axaml index e74235a..8de791d 100644 --- a/Presence.Desktop/App.axaml +++ b/Presence.Desktop/App.axaml @@ -7,5 +7,7 @@ + - \ No newline at end of file + + diff --git a/Presence.Desktop/ViewModels/GroupViewModel.cs b/Presence.Desktop/ViewModels/GroupViewModel.cs index 3b10b0d..7d6ca0e 100644 --- a/Presence.Desktop/ViewModels/GroupViewModel.cs +++ b/Presence.Desktop/ViewModels/GroupViewModel.cs @@ -53,8 +53,12 @@ namespace Presence.Desktop.ViewModels public ReactiveCommand OnDeleteUserClicks { get; } public ReactiveCommand EditUserCommand { get; } + public ReactiveCommand NextPageCommand { get; } + + public ICommand RemoveAllStudentsCommand { get; } public ICommand AddStudentCommand { get; } + public GroupViewModel(IScreen screen, GroupUseCase groupUseCase) { @@ -62,7 +66,6 @@ namespace Presence.Desktop.ViewModels HostScreen = screen; - HostScreen.Router.Navigate.Execute(new PresenceViewModel()); OnDeleteUserClicks = ReactiveCommand.Create(OnDeleteUserClick, this.WhenAnyValue(vm => vm.CanDelete)); EditUserCommand = ReactiveCommand.Create(OnEditUserClick, this.WhenAnyValue(vm => vm.CanEdit)); @@ -85,6 +88,8 @@ namespace Presence.Desktop.ViewModels this.RaisePropertyChanged(nameof(CanDelete)); this.RaisePropertyChanged(nameof(CanEdit)); }; + + NextPageCommand = ReactiveCommand.Create(NextPageButton); } private void SetUsers() @@ -125,12 +130,24 @@ namespace Presence.Desktop.ViewModels private void RemoveAllStudents() { - if (SelectedGroupItem == null) return; + if (SelectedGroupItem == null) return; + + _groupUseCase.RemoveAllStudentsFromGroup(SelectedGroupItem.Id); + SelectedGroupItem.users = new List(); + SetUsers(); + - _groupUseCase.RemoveAllStudentsFromGroup(SelectedGroupItem.Id); - SelectedGroupItem.users = new List(); - SetUsers(); } + + + + private void NextPageButton() + { + HostScreen.Router.Navigate.Execute(new PresenceViewModel()); + } + + + private void AddStudent() { diff --git a/Presence.Desktop/ViewModels/PresenceViewModel.cs b/Presence.Desktop/ViewModels/PresenceViewModel.cs index 4c06266..958042f 100644 --- a/Presence.Desktop/ViewModels/PresenceViewModel.cs +++ b/Presence.Desktop/ViewModels/PresenceViewModel.cs @@ -1,4 +1,6 @@ using ReactiveUI; +using System.Collections.Generic; +using System.Collections.ObjectModel; namespace Presence.Desktop.ViewModels; @@ -6,4 +8,30 @@ public class PresenceViewModel : ViewModelBase, IRoutableViewModel { public string? UrlPathSegment { get; } public IScreen HostScreen { get; } -} + + public ObservableCollection People { get; } + + + public PresenceViewModel() + { + var people = new List + { + new Person("Neil", "Armstrong"), + new Person("Buzz", "Lightyear"), + new Person("James", "Kirk") + }; + People = new ObservableCollection(people); + } + + public class Person + { + public string FirstName { get; set; } + public string LastName { get; set; } + + public Person(string firstName, string lastName) + { + FirstName = firstName; + LastName = lastName; + } + } +} \ No newline at end of file diff --git a/Presence.Desktop/Views/GroupView.axaml b/Presence.Desktop/Views/GroupView.axaml index 0305dca..1672e30 100644 --- a/Presence.Desktop/Views/GroupView.axaml +++ b/Presence.Desktop/Views/GroupView.axaml @@ -54,6 +54,10 @@ Command="{Binding AddStudentCommand}" HorizontalAlignment="Center" Width="250"/> +