public searchCustomer(searchCustomerTypeEnum displayType) { InitializeComponent(); dataContext = new searchCustomer_ModelView(displayType); this.DataContext = dataContext; dataContext.NewCustomerRequested += (s, a) => { newCustomerUC = new NewCustomerUC(displayType); newCustomerWindow = new Window() { Title = "Új ügyfél", Content = newCustomerUC, SizeToContent = SizeToContent.WidthAndHeight }; newCustomerVM = newCustomerUC.DataContext as NewCustomer_ViewModel; newCustomerVM.CustomerInserted += (so, ar) => { dataContext.selectedCustomer = (CustomerBaseRepresentation)so; dataContext.OnCustomerSelected(EventArgs.Empty); newCustomerWindow.Close(); }; newCustomerWindow.Show(); }; DataProxy.Instance.CustomersChanged += (s, a) => { dataContext.RefreshCustomerList(); }; }
private void BuildSearchContactWindow() { contactPicker = new searchCustomer(searchCustomerTypeEnum.Contact); contactPicker_VM = contactPicker.DataContext as searchCustomer_ModelView; contactPickerWindow = new Window() { Title = "Kapcsolattartó választó", Content = contactPicker, SizeToContent = SizeToContent.WidthAndHeight }; contactPicker_VM.CustomerSelected += (s, a) => { DataProxy.Instance.AddContact(viewModel.selectedCustomer, (PersonRepresentation)s); ((FirmRepresentation)viewModel.selectedCustomer).contacts.Add((CustomerBaseRepresentation)s); contactPickerWindow.Hide(); }; }