From a3e8920712739903c1b67511a152f4a0e9ba6b2e Mon Sep 17 00:00:00 2001 From: Class_Student Date: Thu, 19 Dec 2024 10:27:17 +0300 Subject: [PATCH] init commit --- Presence.Desktop/App.axaml | 4 ++- Presence.Desktop/ViewModels/GroupViewModel.cs | 27 +++++++++++++--- .../ViewModels/PresenceViewModel.cs | 30 +++++++++++++++++- Presence.Desktop/Views/GroupView.axaml | 4 +++ Presence.Desktop/Views/GroupView.axaml.cs | 3 ++ Presence.Desktop/Views/PresenceView.axaml | 25 +++++++++++---- .../bin/Debug/net8.0/Presence.Desktop.dll | Bin 228352 -> 230912 bytes .../bin/Debug/net8.0/Presence.Desktop.exe | Bin 143360 -> 143360 bytes .../bin/Debug/net8.0/Presence.Desktop.pdb | Bin 23388 -> 24004 bytes Presence.Desktop/bin/Debug/net8.0/data.dll | Bin 34304 -> 34304 bytes Presence.Desktop/bin/Debug/net8.0/data.pdb | Bin 19900 -> 19900 bytes Presence.Desktop/bin/Debug/net8.0/domain.dll | Bin 22016 -> 22016 bytes Presence.Desktop/bin/Debug/net8.0/domain.pdb | Bin 18340 -> 18340 bytes .../net8.0/Avalonia/Presence.Desktop.dll | Bin 228352 -> 230912 bytes .../net8.0/Avalonia/Presence.Desktop.pdb | Bin 23388 -> 24004 bytes .../obj/Debug/net8.0/Avalonia/resources | Bin 182494 -> 183312 bytes .../net8.0/Presence.Desktop.AssemblyInfo.cs | 2 +- .../Presence.Desktop.AssemblyInfoInputs.cache | 2 +- ...nce.Desktop.csproj.AssemblyReference.cache | Bin 33426 -> 33426 bytes .../obj/Debug/net8.0/Presence.Desktop.dll | Bin 207872 -> 209408 bytes .../obj/Debug/net8.0/Presence.Desktop.pdb | Bin 22176 -> 22540 bytes Presence.Desktop/obj/Debug/net8.0/apphost.exe | Bin 143360 -> 143360 bytes .../obj/Debug/net8.0/ref/Presence.Desktop.dll | Bin 11776 -> 12288 bytes .../refint/Avalonia/Presence.Desktop.dll | Bin 11776 -> 12288 bytes .../Debug/net8.0/refint/Presence.Desktop.dll | Bin 12288 -> 12800 bytes .../Debug/net8.0/console_ui.AssemblyInfo.cs | 2 +- .../console_ui.AssemblyInfoInputs.cache | 2 +- data/bin/Debug/net8.0/data.dll | Bin 34304 -> 34304 bytes data/bin/Debug/net8.0/data.pdb | Bin 19900 -> 19900 bytes data/obj/Debug/net8.0/data.AssemblyInfo.cs | 2 +- .../net8.0/data.AssemblyInfoInputs.cache | 2 +- data/obj/Debug/net8.0/data.dll | Bin 34304 -> 34304 bytes data/obj/Debug/net8.0/data.pdb | Bin 19900 -> 19900 bytes data/obj/Debug/net8.0/ref/data.dll | Bin 14848 -> 14848 bytes data/obj/Debug/net8.0/refint/data.dll | Bin 14848 -> 14848 bytes domain/bin/Debug/net8.0/data.dll | Bin 34304 -> 34304 bytes domain/bin/Debug/net8.0/data.pdb | Bin 19900 -> 19900 bytes domain/bin/Debug/net8.0/domain.dll | Bin 22016 -> 22016 bytes domain/bin/Debug/net8.0/domain.pdb | Bin 18340 -> 18340 bytes .../obj/Debug/net8.0/domain.AssemblyInfo.cs | 2 +- .../net8.0/domain.AssemblyInfoInputs.cache | 2 +- .../domain.csproj.AssemblyReference.cache | Bin 14589 -> 14589 bytes domain/obj/Debug/net8.0/domain.dll | Bin 22016 -> 22016 bytes domain/obj/Debug/net8.0/domain.pdb | Bin 18340 -> 18340 bytes domain/obj/Debug/net8.0/ref/domain.dll | Bin 10240 -> 10240 bytes domain/obj/Debug/net8.0/refint/domain.dll | Bin 10240 -> 10240 bytes .../Debug/net8.0/presence_api.AssemblyInfo.cs | 2 +- .../presence_api.AssemblyInfoInputs.cache | 2 +- ui/obj/Debug/net8.0/ui.AssemblyInfo.cs | 2 +- .../Debug/net8.0/ui.AssemblyInfoInputs.cache | 2 +- 50 files changed, 92 insertions(+), 25 deletions(-) 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"/> +