Adding Customers now works.
This commit is contained in:
@@ -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 CreateNewCustomer(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Window window = new CreateNewCustomer();
|
||||
CreateNewCustomerViewModel viewModel = new CreateNewCustomerViewModel();
|
||||
viewModel.NewCustomerCreated += (newCustomer) =>
|
||||
{
|
||||
var getAllCustomersViewModel = (GetAllCustomersViewModel)DataContext;
|
||||
if (getAllCustomersViewModel != null)
|
||||
{
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
getAllCustomersViewModel.Customers.Add(newCustomer);
|
||||
});
|
||||
}
|
||||
};
|
||||
Window window = new CreateNewCustomer(viewModel);
|
||||
window.Show();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="9*" />
|
||||
<RowDefinition Height="1*" />
|
||||
<RowDefinition Height="8*" />
|
||||
<RowDefinition Height="2*" />
|
||||
</Grid.RowDefinitions>
|
||||
<ListBox ItemsSource="{Binding MaintainerTeams}" Grid.Row="0" SelectedItem="{Binding SelectedMaintainerTeam}">
|
||||
<ListBox.ItemContainerStyle>
|
||||
@@ -64,9 +64,10 @@
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
|
||||
<UniformGrid Rows="2" Grid.Row="1">
|
||||
<UniformGrid Rows="3" Grid.Row="1">
|
||||
<Button Content="Edit selected" Command="{Binding UpdateMaintainerTeamCommand}"/>
|
||||
<Button Content="Create new" Click="CreateNewMaintainerTeam" />
|
||||
<Button Content="Who works in this team" Command="{Binding GetColleaguesCommand}" />
|
||||
</UniformGrid>
|
||||
</Grid>
|
||||
</Window>
|
||||
Reference in New Issue
Block a user