diff --git a/WD7UVN_SzTGUI_2023242.Client.WPF/ViewModels/GetAllServicesViewModel.cs b/WD7UVN_SzTGUI_2023242.Client.WPF/ViewModels/GetAllServicesViewModel.cs index 8a9c553..ad2d95d 100644 --- a/WD7UVN_SzTGUI_2023242.Client.WPF/ViewModels/GetAllServicesViewModel.cs +++ b/WD7UVN_SzTGUI_2023242.Client.WPF/ViewModels/GetAllServicesViewModel.cs @@ -24,6 +24,7 @@ namespace WD7UVN_SzTGUI_2023242.Client.WPF.ViewModels (DeleteServiceCommand as RelayCommand).NotifyCanExecuteChanged(); (GetResponsibleEmployeeCommand as RelayCommand).NotifyCanExecuteChanged(); (GetMaintainersCommand as RelayCommand).NotifyCanExecuteChanged(); + (GetUserCommand as RelayCommand).NotifyCanExecuteChanged(); } } @@ -31,6 +32,7 @@ namespace WD7UVN_SzTGUI_2023242.Client.WPF.ViewModels public ICommand DeleteServiceCommand { get; set; } public ICommand GetResponsibleEmployeeCommand { get; set; } public ICommand GetMaintainersCommand { get; set; } + public ICommand GetUserCommand { get; set; } public static bool IsInDesignMode { @@ -84,6 +86,16 @@ namespace WD7UVN_SzTGUI_2023242.Client.WPF.ViewModels { return SelectedService != null; }); + + GetUserCommand = new RelayCommand(() => + { + Window window = new GetUsers(SelectedService); + window.Show(); + }, + () => + { + return SelectedService != null; + }); } } } diff --git a/WD7UVN_SzTGUI_2023242.Client.WPF/ViewModels/GetUsersViewModel.cs b/WD7UVN_SzTGUI_2023242.Client.WPF/ViewModels/GetUsersViewModel.cs new file mode 100644 index 0000000..f0b5e69 --- /dev/null +++ b/WD7UVN_SzTGUI_2023242.Client.WPF/ViewModels/GetUsersViewModel.cs @@ -0,0 +1,29 @@ +using WD7UVN_HFT_2023241.Models; +using System.ComponentModel; +using System.Windows; +using CommunityToolkit.Mvvm.ComponentModel; + +namespace WD7UVN_SzTGUI_2023242.Client.WPF.ViewModels +{ + public class GetUsersViewModel : ObservableRecipient + { + public RestCollection Clients { get; set; } + + public static bool IsInDesignMode + { + get + { + var prop = DesignerProperties.IsInDesignModeProperty; + return (bool)DependencyPropertyDescriptor.FromProperty(prop, typeof(FrameworkElement)).Metadata.DefaultValue; + } + } + + public GetUsersViewModel(Service e) + { + if (!IsInDesignMode) + { + Clients = new RestCollection("http://localhost:5000/", "api/WhoUsesService?id=" + e.ID.ToString(), "hub", true); + } + } + } +} diff --git a/WD7UVN_SzTGUI_2023242.Client.WPF/WD7UVN_SzTGUI_2023242.Client.WPF.csproj.user b/WD7UVN_SzTGUI_2023242.Client.WPF/WD7UVN_SzTGUI_2023242.Client.WPF.csproj.user index d7b9424..fd09240 100644 --- a/WD7UVN_SzTGUI_2023242.Client.WPF/WD7UVN_SzTGUI_2023242.Client.WPF.csproj.user +++ b/WD7UVN_SzTGUI_2023242.Client.WPF/WD7UVN_SzTGUI_2023242.Client.WPF.csproj.user @@ -37,6 +37,9 @@ Code + + Code + @@ -72,5 +75,8 @@ Designer + + Designer + \ No newline at end of file diff --git a/WD7UVN_SzTGUI_2023242.Client.WPF/Windows/GetAll/GetAllServices.xaml b/WD7UVN_SzTGUI_2023242.Client.WPF/Windows/GetAll/GetAllServices.xaml index 3c8e580..605afe2 100644 --- a/WD7UVN_SzTGUI_2023242.Client.WPF/Windows/GetAll/GetAllServices.xaml +++ b/WD7UVN_SzTGUI_2023242.Client.WPF/Windows/GetAll/GetAllServices.xaml @@ -13,8 +13,8 @@ - - + + @@ -90,6 +90,7 @@