diff --git a/WD7UVN_SzTGUI_2023242.Client.WPF/MainWindow.xaml b/WD7UVN_SzTGUI_2023242.Client.WPF/MainWindow.xaml index b8215ac..3e009af 100644 --- a/WD7UVN_SzTGUI_2023242.Client.WPF/MainWindow.xaml +++ b/WD7UVN_SzTGUI_2023242.Client.WPF/MainWindow.xaml @@ -3,9 +3,14 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:local="clr-namespace:WD7UVN_SzTGUI_2023242.Client.WPF" + xmlns:local="clr-namespace:WD7UVN_SzTGUI_2023242.Client.WPF.ViewModels" mc:Ignorable="d" Title="Company database manager" Height="450" Width="900"> + + + + + diff --git a/WD7UVN_SzTGUI_2023242.Client.WPF/ViewModels/MainWindowViewModel.cs b/WD7UVN_SzTGUI_2023242.Client.WPF/ViewModels/MainWindowViewModel.cs new file mode 100644 index 0000000..a3ed79f --- /dev/null +++ b/WD7UVN_SzTGUI_2023242.Client.WPF/ViewModels/MainWindowViewModel.cs @@ -0,0 +1,43 @@ +using WD7UVN_HFT_2023241.Models; +using System.ComponentModel; +using System.Windows; +using CommunityToolkit.Mvvm.ComponentModel; + +namespace WD7UVN_SzTGUI_2023242.Client.WPF.ViewModels +{ + public class MainWindowViewModel : ObservableRecipient + { + private string errorMessage; + + public string ErrorMessage + { + get { return errorMessage; } + set { SetProperty(ref errorMessage, value); } + } + + public RestCollection Services { get; set; } + public RestCollection MaintainerTeams { get; set; } + public RestCollection Customers { get; set; } + public RestCollection Employees { get; set; } + + public static bool IsInDesignMode + { + get + { + var prop = DesignerProperties.IsInDesignModeProperty; + return (bool)DependencyPropertyDescriptor.FromProperty(prop, typeof(FrameworkElement)).Metadata.DefaultValue; + } + } + + public MainWindowViewModel() + { + if (!IsInDesignMode) + { + Services = new RestCollection("http://localhost:62005/", "Service", "hub"); + Employees = new RestCollection("http://localhost:62005/", "Employee", "hub"); + MaintainerTeams = new RestCollection("http://localhost:62005/", "MaintainerTeam", "hub"); + Customers = new RestCollection("http://localhost:62005/", "Customer", "hub"); + } + } + } +}