added create method in mainwindow code-behind
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using WD7UVN_SzTGUI_2023242.Client.WPF.ViewModels;
|
||||||
using WD7UVN_SzTGUI_2023242.Client.WPF.Windows;
|
using WD7UVN_SzTGUI_2023242.Client.WPF.Windows;
|
||||||
|
|
||||||
namespace WD7UVN_SzTGUI_2023242.Client.WPF
|
namespace WD7UVN_SzTGUI_2023242.Client.WPF
|
||||||
@@ -36,5 +37,23 @@ namespace WD7UVN_SzTGUI_2023242.Client.WPF
|
|||||||
Window window = new GetAllMaintainerTeams();
|
Window window = new GetAllMaintainerTeams();
|
||||||
window.Show();
|
window.Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void CreateNewCustomer(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user