diff --git a/Presence.Desktop/App.axaml.cs b/Presence.Desktop/App.axaml.cs index 20da721..ada6a44 100644 --- a/Presence.Desktop/App.axaml.cs +++ b/Presence.Desktop/App.axaml.cs @@ -26,7 +26,6 @@ namespace Presence.Desktop var services = serviceCollection.BuildServiceProvider(); - var mainViewModel = services.GetRequiredService(); var groupUseCase = services.GetRequiredService(); diff --git a/Presence.Desktop/DI/ServiceCollectionExtensions.cs b/Presence.Desktop/DI/ServiceCollectionExtensions.cs index 12a21ac..1fd5ad0 100644 --- a/Presence.Desktop/DI/ServiceCollectionExtensions.cs +++ b/Presence.Desktop/DI/ServiceCollectionExtensions.cs @@ -17,8 +17,6 @@ namespace Presence.Desktop.DI .AddSingleton() .AddSingleton() .AddSingleton() - .AddTransient() - .AddTransient(); - } + .AddTransient(); } } } \ No newline at end of file diff --git a/Presence.Desktop/ViewModels/GroupViewModel.cs b/Presence.Desktop/ViewModels/GroupViewModel.cs index e7c746d..3b10b0d 100644 --- a/Presence.Desktop/ViewModels/GroupViewModel.cs +++ b/Presence.Desktop/ViewModels/GroupViewModel.cs @@ -16,6 +16,11 @@ namespace Presence.Desktop.ViewModels { public class GroupViewModel : ViewModelBase, IRoutableViewModel { + + public string? UrlPathSegment { get; } + public IScreen HostScreen { get; } + + private readonly GroupUseCase _groupUseCase; private List groupPresentersDataSource = new List(); private ObservableCollection _groups; @@ -51,10 +56,13 @@ namespace Presence.Desktop.ViewModels public ICommand RemoveAllStudentsCommand { get; } public ICommand AddStudentCommand { get; } - public GroupViewModel(GroupUseCase groupUseCase) + public GroupViewModel(IScreen screen, GroupUseCase groupUseCase) { _groupUseCase = groupUseCase; + 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)); @@ -231,9 +239,8 @@ namespace Presence.Desktop.ViewModels } _groups = new ObservableCollection(groupPresentersDataSource); } - public string? UrlPathSegment { get; } - public IScreen HostScreen { get; } + } } \ No newline at end of file diff --git a/Presence.Desktop/ViewModels/MainWindowViewModel.cs b/Presence.Desktop/ViewModels/MainWindowViewModel.cs index 8449f0d..0326870 100644 --- a/Presence.Desktop/ViewModels/MainWindowViewModel.cs +++ b/Presence.Desktop/ViewModels/MainWindowViewModel.cs @@ -1,4 +1,5 @@ using System; +using domain.UseCase; using Microsoft.Extensions.DependencyInjection; using ReactiveUI; @@ -10,7 +11,13 @@ public class MainWindowViewModel : ViewModelBase, IScreen public MainWindowViewModel(IServiceProvider serviceProvider) { - var groupViewModel = serviceProvider.GetRequiredService(); - Router.Navigate.Execute(groupViewModel); + var groupUseCase = serviceProvider.GetRequiredService(); + + Router.Navigate.Execute(new GroupViewModel (this, groupUseCase)); + + } + + + } \ No newline at end of file diff --git a/Presence.Desktop/Views/GroupView.axaml b/Presence.Desktop/Views/GroupView.axaml index 854428d..0305dca 100644 --- a/Presence.Desktop/Views/GroupView.axaml +++ b/Presence.Desktop/Views/GroupView.axaml @@ -1,145 +1,82 @@ - + x:Class="Presence.Desktop.Views.GroupView" + x:DataType="vm:GroupViewModel"> - - - - - - - - - - - + + - - + - - - - - - + + + + + + - - + - - - - - - - + + + + + + + - - + -