WhoUsesService done

This commit is contained in:
2024-05-05 17:20:27 +02:00
parent 0f93e5fd25
commit 39fb1aaffa
6 changed files with 130 additions and 2 deletions

View File

@@ -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;
});
}
}
}

View File

@@ -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<Customer> 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<Customer>("http://localhost:5000/", "api/WhoUsesService?id=" + e.ID.ToString(), "hub", true);
}
}
}
}