Creation finished, project considered finished

This commit is contained in:
2024-05-06 19:13:17 +02:00
parent fc3afaae2c
commit fbcee50f96
16 changed files with 485 additions and 71 deletions

View File

@@ -21,11 +21,14 @@
<Grid Grid.Column="0">
<Grid.RowDefinitions>
<RowDefinition Height="8*" />
<RowDefinition Height="1*" />
<RowDefinition Height="7*" />
<RowDefinition Height="2*" />
</Grid.RowDefinitions>
<ListBox Grid.Row="0" ItemsSource="{Binding Services}" SelectedItem="{Binding SelectedService}">
<Label Grid.Row="0" Content="Services" FontSize="20" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<ListBox Grid.Row="1" ItemsSource="{Binding Services}" SelectedItem="{Binding SelectedService}">
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
@@ -41,20 +44,23 @@
</ListBox.ItemTemplate>
</ListBox>
<UniformGrid Grid.Row="1" Rows="3">
<UniformGrid Grid.Row="2" Rows="3">
<Button Content="Delete selected" Command="{Binding DeleteServiceCommand}"></Button>
<Button Content="Create new" Command="{Binding CreateServiceCommand}"></Button>
<Button Content="Create new" Click="CreateNewService"></Button>
<Button Content="Expand all" Click="ExpandAllServices"/>
</UniformGrid>
</Grid>
<Grid Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition Height="8*" />
<RowDefinition Height="1*" />
<RowDefinition Height="7*" />
<RowDefinition Height="2*" />
</Grid.RowDefinitions>
<ListBox Grid.Row="0" ItemsSource="{Binding Customers}" SelectedItem="{Binding SelectedCustomer}">
<Label Grid.Row="0" Content="Customers" FontSize="20" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<ListBox Grid.Row="1" ItemsSource="{Binding Customers}" SelectedItem="{Binding SelectedCustomer}">
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
@@ -70,7 +76,7 @@
</ListBox.ItemTemplate>
</ListBox>
<UniformGrid Grid.Row="1" Rows="3">
<UniformGrid Grid.Row="2" Rows="3">
<Button Content="Delete selected" Command="{Binding DeleteCustomerCommand}"></Button>
<Button Content="Create new" Click="CreateNewCustomer"></Button>
<Button Content="Expand all" Click="ExpandAllCustomers"/>
@@ -79,11 +85,14 @@
<Grid Grid.Column="2">
<Grid.RowDefinitions>
<RowDefinition Height="8*" />
<RowDefinition Height="1*" />
<RowDefinition Height="7*" />
<RowDefinition Height="2*" />
</Grid.RowDefinitions>
<ListBox Grid.Row="0" ItemsSource="{Binding MaintainerTeams}" SelectedItem="{Binding SelectedMaintainerTeam}">
<Label Grid.Row="0" Content="Teams" FontSize="20" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<ListBox Grid.Row="1" ItemsSource="{Binding MaintainerTeams}" SelectedItem="{Binding SelectedMaintainerTeam}">
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
@@ -99,20 +108,23 @@
</ListBox.ItemTemplate>
</ListBox>
<UniformGrid Grid.Row="1" Rows="3">
<UniformGrid Grid.Row="2" Rows="3">
<Button Content="Delete selected" Command="{Binding DeleteMaintainerTeamCommand}"></Button>
<Button Content="Create new" Command="{Binding CreateMaintainerTeamCommand}"></Button>
<Button Content="Create new" Click="CreateNewMaintainerTeam"></Button>
<Button Content="Expand all" Click="ExpandAllMaintainerTeams"/>
</UniformGrid>
</Grid>
<Grid Grid.Column="3">
<Grid.RowDefinitions>
<RowDefinition Height="8*" />
<RowDefinition Height="1*" />
<RowDefinition Height="7*" />
<RowDefinition Height="2*" />
</Grid.RowDefinitions>
<ListBox Grid.Row="0" ItemsSource="{Binding Employees}" SelectedItem="{Binding SelectedEmployee}">
<Label Grid.Row="0" Content="Employees" FontSize="20" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<ListBox Grid.Row="1" ItemsSource="{Binding Employees}" SelectedItem="{Binding SelectedEmployee}">
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
@@ -128,9 +140,9 @@
</ListBox.ItemTemplate>
</ListBox>
<UniformGrid Grid.Row="1" Rows="3">
<UniformGrid Grid.Row="2" Rows="3">
<Button Content="Delete selected" Command="{Binding DeleteEmployeeCommand}"></Button>
<Button Content="Create new" Command="{Binding CreateEmployeeCommand}"></Button>
<Button Content="Create new" Click="CreateNewEmployee"></Button>
<Button Content="Expand all" Click="ExpandAllEmployees"/>
</UniformGrid>
</Grid>

View File

@@ -55,5 +55,59 @@ namespace WD7UVN_SzTGUI_2023242.Client.WPF
Window window = new CreateNewCustomer(viewModel);
window.Show();
}
private void CreateNewEmployee(object sender, RoutedEventArgs e)
{
CreateNewEmployeeViewModel viewModel = new CreateNewEmployeeViewModel();
viewModel.NewEmployeeCreated += (newEmployee) =>
{
var getAllEmployeesViewModel = (MainWindowViewModel)DataContext;
if (getAllEmployeesViewModel != null)
{
Application.Current.Dispatcher.Invoke(() =>
{
getAllEmployeesViewModel.Employees.Add(newEmployee);
});
}
};
Window window = new CreateNewEmployee(viewModel);
window.Show();
}
private void CreateNewMaintainerTeam(object sender, RoutedEventArgs e)
{
CreateNewMaintainerTeamViewModel viewModel = new CreateNewMaintainerTeamViewModel();
viewModel.NewMaintainerTeamCreated += (newMaintainerTeam) =>
{
var getAllMaintainerTeamsViewModel = (MainWindowViewModel)DataContext;
if (getAllMaintainerTeamsViewModel != null)
{
Application.Current.Dispatcher.Invoke(() =>
{
getAllMaintainerTeamsViewModel.MaintainerTeams.Add(newMaintainerTeam);
});
}
};
Window window = new CreateNewMaintainerTeam(viewModel);
window.Show();
}
private void CreateNewService(object sender, RoutedEventArgs e)
{
CreateNewServiceViewModel viewModel = new CreateNewServiceViewModel();
viewModel.NewServiceCreated += (newService) =>
{
var getAllServicesViewModel = (MainWindowViewModel)DataContext;
if (getAllServicesViewModel != null)
{
Application.Current.Dispatcher.Invoke(() =>
{
getAllServicesViewModel.Services.Add(newService);
});
}
};
Window window = new CreateNewService(viewModel);
window.Show();
}
}
}

View File

@@ -0,0 +1,56 @@
using WD7UVN_HFT_2023241.Models;
using System.ComponentModel;
using System.Windows;
using CommunityToolkit.Mvvm.ComponentModel;
using System.Windows.Input;
using CommunityToolkit.Mvvm.Input;
using System;
namespace WD7UVN_SzTGUI_2023242.Client.WPF.ViewModels
{
public class CreateNewEmployeeViewModel : ObservableRecipient
{
public Action CloseAction { get; set; }
public event Action<Employee> NewEmployeeCreated;
public Employee newEmployee;
public Employee NewEmployee
{
get { return newEmployee; }
set
{
SetProperty(ref newEmployee, value);
(CreateCommand as RelayCommand).NotifyCanExecuteChanged();
}
}
public ICommand CreateCommand { get; set; }
public static bool IsInDesignMode
{
get
{
var prop = DesignerProperties.IsInDesignModeProperty;
return (bool)DependencyPropertyDescriptor.FromProperty(prop, typeof(FrameworkElement)).Metadata.DefaultValue;
}
}
public CreateNewEmployeeViewModel()
{
newEmployee = new Employee();
if (!IsInDesignMode)
{
CreateCommand = new RelayCommand(() =>
{
NewEmployeeCreated?.Invoke(NewEmployee);
CloseAction();
},
() =>
{
return NewEmployee != null;
});
}
}
}
}

View File

@@ -0,0 +1,56 @@
using WD7UVN_HFT_2023241.Models;
using System.ComponentModel;
using System.Windows;
using CommunityToolkit.Mvvm.ComponentModel;
using System.Windows.Input;
using CommunityToolkit.Mvvm.Input;
using System;
namespace WD7UVN_SzTGUI_2023242.Client.WPF.ViewModels
{
public class CreateNewMaintainerTeamViewModel : ObservableRecipient
{
public Action CloseAction { get; set; }
public event Action<MaintainerTeam> NewMaintainerTeamCreated;
public MaintainerTeam newMaintainerTeam;
public MaintainerTeam NewMaintainerTeam
{
get { return newMaintainerTeam; }
set
{
SetProperty(ref newMaintainerTeam, value);
(CreateCommand as RelayCommand).NotifyCanExecuteChanged();
}
}
public ICommand CreateCommand { get; set; }
public static bool IsInDesignMode
{
get
{
var prop = DesignerProperties.IsInDesignModeProperty;
return (bool)DependencyPropertyDescriptor.FromProperty(prop, typeof(FrameworkElement)).Metadata.DefaultValue;
}
}
public CreateNewMaintainerTeamViewModel()
{
newMaintainerTeam = new MaintainerTeam();
if (!IsInDesignMode)
{
CreateCommand = new RelayCommand(() =>
{
NewMaintainerTeamCreated?.Invoke(NewMaintainerTeam);
CloseAction();
},
() =>
{
return NewMaintainerTeam != null;
});
}
}
}
}

View File

@@ -0,0 +1,56 @@
using WD7UVN_HFT_2023241.Models;
using System.ComponentModel;
using System.Windows;
using CommunityToolkit.Mvvm.ComponentModel;
using System.Windows.Input;
using CommunityToolkit.Mvvm.Input;
using System;
namespace WD7UVN_SzTGUI_2023242.Client.WPF.ViewModels
{
public class CreateNewServiceViewModel : ObservableRecipient
{
public Action CloseAction { get; set; }
public event Action<Service> NewServiceCreated;
public Service newService;
public Service NewService
{
get { return newService; }
set
{
SetProperty(ref newService, value);
(CreateCommand as RelayCommand).NotifyCanExecuteChanged();
}
}
public ICommand CreateCommand { get; set; }
public static bool IsInDesignMode
{
get
{
var prop = DesignerProperties.IsInDesignModeProperty;
return (bool)DependencyPropertyDescriptor.FromProperty(prop, typeof(FrameworkElement)).Metadata.DefaultValue;
}
}
public CreateNewServiceViewModel()
{
newService = new Service();
if (!IsInDesignMode)
{
CreateCommand = new RelayCommand(() =>
{
NewServiceCreated?.Invoke(NewService);
CloseAction();
},
() =>
{
return NewService != null;
});
}
}
}
}

View File

@@ -5,7 +5,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WD7UVN_SzTGUI_2023242.Client.WPF.Windows"
mc:Ignorable="d"
Title="CreateNewCustomer" Height="550" Width="350">
Title="Create new customer" Height="550" Width="350">
<Grid>
<Grid.RowDefinitions>

View File

@@ -1,6 +1,5 @@
using System;
using System.Windows;
using WD7UVN_HFT_2023241.Models;
using WD7UVN_SzTGUI_2023242.Client.WPF.ViewModels;
namespace WD7UVN_SzTGUI_2023242.Client.WPF.Windows

View File

@@ -5,8 +5,65 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WD7UVN_SzTGUI_2023242.Client.WPF.Windows"
mc:Ignorable="d"
Title="CreateNewEmployee" Height="450" Width="800">
Title="Create new employee" Height="550" Width="350">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="9*" />
<RowDefinition Height="1*" />
</Grid.RowDefinitions>
<ListBox Grid.Row="0">
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Setter Property="VerticalContentAlignment" Value="Stretch" />
<Setter Property="Padding" Value="0" />
<Setter Property="Margin" Value="0" />
</Style>
</ListBox.ItemContainerStyle>
<Border BorderBrush="Black" BorderThickness="1" Margin="5">
<StackPanel>
<Grid>
<Grid.Resources>
<Style TargetType="TextBox">
<Setter Property="VerticalContentAlignment" Value="Center"/>
</Style>
</Grid.Resources>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*" />
<ColumnDefinition Width="8*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Label Grid.Row="0" Grid.Column="0" Content="ID:" />
<TextBox Grid.Row="0" Grid.Column="1" Text="{Binding NewEmployee.ID}" />
<Label Grid.Row="1" Grid.Column="0" Content="Name:" />
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding NewEmployee.NAME}" />
<Label Grid.Row="2" Grid.Column="0" Content="Email:" />
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding NewEmployee.EMAIL}" />
<Label Grid.Row="3" Grid.Column="0" Content="Phone:" />
<TextBox Grid.Row="3" Grid.Column="1" Text="{Binding NewEmployee.PHONE}" />
<Label Grid.Row="4" Grid.Column="0" Content="Maintainer ID:" />
<TextBox Grid.Row="4" Grid.Column="1" Text="{Binding NewEmployee.MAINTAINER_ID}" />
<Label Grid.Row="5" Grid.Column="0" Content="Manager ID:" />
<TextBox Grid.Row="5" Grid.Column="1" Text="{Binding NewEmployee.MANAGER_ID}" />
</Grid>
</StackPanel>
</Border>
</ListBox>
<Button Grid.Row="1" Content="Create" Command="{Binding CreateCommand}"/>
</Grid>
</Window>

View File

@@ -1,27 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using WD7UVN_SzTGUI_2023242.Client.WPF.ViewModels;
namespace WD7UVN_SzTGUI_2023242.Client.WPF.Windows
{
/// <summary>
/// Interaction logic for CreateNewEmployee.xaml
/// </summary>
public partial class CreateNewEmployee : Window
{
public CreateNewEmployee()
public CreateNewEmployee(CreateNewEmployeeViewModel viewModel)
{
InitializeComponent();
DataContext = viewModel;
viewModel.CloseAction = new Action(() => this.Close());
}
}
}

View File

@@ -5,8 +5,57 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WD7UVN_SzTGUI_2023242.Client.WPF.Windows"
mc:Ignorable="d"
Title="CreateNewMaintainerTeam" Height="450" Width="800">
Title="Create new team" Height="550" Width="350">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="9*" />
<RowDefinition Height="1*" />
</Grid.RowDefinitions>
<ListBox Grid.Row="0">
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Setter Property="VerticalContentAlignment" Value="Stretch" />
<Setter Property="Padding" Value="0" />
<Setter Property="Margin" Value="0" />
</Style>
</ListBox.ItemContainerStyle>
<Border BorderBrush="Black" BorderThickness="1" Margin="5">
<StackPanel>
<Grid>
<Grid.Resources>
<Style TargetType="TextBox">
<Setter Property="VerticalContentAlignment" Value="Center"/>
</Style>
</Grid.Resources>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*" />
<ColumnDefinition Width="8*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Label Grid.Row="0" Grid.Column="0" Content="ID:" />
<TextBox Grid.Row="0" Grid.Column="1" Text="{Binding NewMaintainerTeam.ID}" />
<Label Grid.Row="1" Grid.Column="0" Content="Name:" />
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding NewMaintainerTeam.NAME}" />
<Label Grid.Row="2" Grid.Column="0" Content="Email:" />
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding NewMaintainerTeam.EMAIL}" />
<Label Grid.Row="3" Grid.Column="0" Content="Leader ID:" />
<TextBox Grid.Row="3" Grid.Column="1" Text="{Binding NewMaintainerTeam.LEADER_ID}" />
</Grid>
</StackPanel>
</Border>
</ListBox>
<Button Grid.Row="1" Content="Create" Command="{Binding CreateCommand}"/>
</Grid>
</Window>

View File

@@ -1,27 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using WD7UVN_SzTGUI_2023242.Client.WPF.ViewModels;
namespace WD7UVN_SzTGUI_2023242.Client.WPF.Windows
{
/// <summary>
/// Interaction logic for CreateNewMaintainerTeam.xaml
/// </summary>
public partial class CreateNewMaintainerTeam : Window
{
public CreateNewMaintainerTeam()
public CreateNewMaintainerTeam(CreateNewMaintainerTeamViewModel viewModel)
{
InitializeComponent();
DataContext = viewModel;
viewModel.CloseAction = new Action(() => this.Close());
}
}
}

View File

@@ -5,8 +5,77 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WD7UVN_SzTGUI_2023242.Client.WPF.Windows"
mc:Ignorable="d"
Title="CreateNewService" Height="450" Width="800">
Title="Create new service" Height="550" Width="350">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="9*" />
<RowDefinition Height="1*" />
</Grid.RowDefinitions>
<ListBox Grid.Row="0">
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Setter Property="VerticalContentAlignment" Value="Stretch" />
<Setter Property="Padding" Value="0" />
<Setter Property="Margin" Value="0" />
</Style>
</ListBox.ItemContainerStyle>
<Border BorderBrush="Black" BorderThickness="1" Margin="5">
<StackPanel>
<Grid>
<Grid.Resources>
<Style TargetType="TextBox">
<Setter Property="VerticalContentAlignment" Value="Center"/>
</Style>
</Grid.Resources>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*" />
<ColumnDefinition Width="8*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Label Grid.Row="0" Grid.Column="0" Content="ID:" />
<TextBox Grid.Row="0" Grid.Column="1" Text="{Binding NewService.ID}" />
<Label Grid.Row="1" Grid.Column="0" Content="Name:" />
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding NewService.NAME}" />
<Label Grid.Row="2" Grid.Column="0" Content="IP address:" />
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding NewService.IP}" />
<Label Grid.Row="3" Grid.Column="0" Content="Port:" />
<TextBox Grid.Row="3" Grid.Column="1" Text="{Binding NewService.PORT}" />
<Label Grid.Row="4" Grid.Column="0" Content="Domain:" />
<TextBox Grid.Row="4" Grid.Column="1" Text="{Binding NewService.SERVICE_DOMAIN}" />
<Label Grid.Row="5" Grid.Column="0" Content="Account:" />
<TextBox Grid.Row="5" Grid.Column="1" Text="{Binding NewService.ACCOUNT}" />
<Label Grid.Row="6" Grid.Column="0" Content="Version:" />
<TextBox Grid.Row="6" Grid.Column="1" Text="{Binding NewService.VERSION}" />
<Label Grid.Row="7" Grid.Column="0" Content="Notes:" />
<TextBox Grid.Row="7" Grid.Column="1" Text="{Binding NewService.NOTES}" />
<Label Grid.Row="8" Grid.Column="0" Content="Maintainer ID:" />
<TextBox Grid.Row="8" Grid.Column="1" Text="{Binding NewService.MAINTAINER_ID}" />
</Grid>
</StackPanel>
</Border>
</ListBox>
<Button Grid.Row="1" Content="Create" Command="{Binding CreateCommand}"/>
</Grid>
</Window>

View File

@@ -1,27 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using WD7UVN_SzTGUI_2023242.Client.WPF.ViewModels;
namespace WD7UVN_SzTGUI_2023242.Client.WPF.Windows
{
/// <summary>
/// Interaction logic for CreateNewService.xaml
/// </summary>
public partial class CreateNewService : Window
{
public CreateNewService()
public CreateNewService(CreateNewServiceViewModel viewModel)
{
InitializeComponent();
DataContext = viewModel;
viewModel.CloseAction = new Action(() => this.Close());
}
}
}

View File

@@ -1,4 +1,5 @@
using System.Windows;
using WD7UVN_SzTGUI_2023242.Client.WPF.ViewModels;
namespace WD7UVN_SzTGUI_2023242.Client.WPF.Windows
{
@@ -14,7 +15,19 @@ namespace WD7UVN_SzTGUI_2023242.Client.WPF.Windows
private void CreateNewEmployee(object sender, RoutedEventArgs e)
{
Window window = new CreateNewEmployee();
CreateNewEmployeeViewModel viewModel = new CreateNewEmployeeViewModel();
viewModel.NewEmployeeCreated += (newEmployee) =>
{
var getAllEmployeesViewModel = (GetAllEmployeesViewModel)DataContext;
if (getAllEmployeesViewModel != null)
{
Application.Current.Dispatcher.Invoke(() =>
{
getAllEmployeesViewModel.Employees.Add(newEmployee);
});
}
};
Window window = new CreateNewEmployee(viewModel);
window.Show();
}
}

View File

@@ -1,4 +1,5 @@
using System.Windows;
using WD7UVN_SzTGUI_2023242.Client.WPF.ViewModels;
namespace WD7UVN_SzTGUI_2023242.Client.WPF.Windows
{
@@ -14,7 +15,19 @@ namespace WD7UVN_SzTGUI_2023242.Client.WPF.Windows
private void CreateNewMaintainerTeam(object sender, RoutedEventArgs e)
{
Window window = new CreateNewMaintainerTeam();
CreateNewMaintainerTeamViewModel viewModel = new CreateNewMaintainerTeamViewModel();
viewModel.NewMaintainerTeamCreated += (newMaintainerTeam) =>
{
var getAllMaintainerTeamsViewModel = (GetAllMaintainerTeamsViewModel)DataContext;
if (getAllMaintainerTeamsViewModel != null)
{
Application.Current.Dispatcher.Invoke(() =>
{
getAllMaintainerTeamsViewModel.MaintainerTeams.Add(newMaintainerTeam);
});
}
};
Window window = new CreateNewMaintainerTeam(viewModel);
window.Show();
}
}

View File

@@ -1,4 +1,5 @@
using System.Windows;
using WD7UVN_SzTGUI_2023242.Client.WPF.ViewModels;
namespace WD7UVN_SzTGUI_2023242.Client.WPF.Windows
{
@@ -14,7 +15,19 @@ namespace WD7UVN_SzTGUI_2023242.Client.WPF.Windows
private void CreateNewService(object sender, RoutedEventArgs e)
{
Window window = new CreateNewService();
CreateNewServiceViewModel viewModel = new CreateNewServiceViewModel();
viewModel.NewServiceCreated += (newService) =>
{
var getAllServicesViewModel = (GetAllServicesViewModel)DataContext;
if (getAllServicesViewModel != null)
{
Application.Current.Dispatcher.Invoke(() =>
{
getAllServicesViewModel.Services.Add(newService);
});
}
};
Window window = new CreateNewService(viewModel);
window.Show();
}
}