private void Popup_Closed(object sender, System.EventArgs e) { _foreignKeyBox.IsEnabled = true; PlacementTarget = _foreignKeyBox = null; _presenter.DetachView(); _presenter = null; CommandBindings.Clear(); }
public void Show(Window ownerWindow, ForeignKeyBox foreignKeyBox, int?currentProductID) { Debug.Assert(ownerWindow != null); Debug.Assert(foreignKeyBox != null); Owner = ownerWindow; _foreignKeyBox = foreignKeyBox; _presenter = new Presenter(_dataView, currentProductID); InitializeCommandBindings(); ShowDialog(); }
void ForeignKeyBox.ILookupService.BeginLookup(ForeignKeyBox foreignKeyBox) { if (foreignKeyBox.ForeignKey == _.FK_Product) { var dialogWindow = new ProductLookupWindow(); dialogWindow.Show(_ownerWindow, foreignKeyBox, CurrentRow.GetValue(_.ProductID)); } else { throw new NotSupportedException(); } }
public void Show(ForeignKeyBox foreignKeyBox, int?currentAddressID, int customerID) { if (IsOpen) { IsOpen = false; } PlacementTarget = _foreignKeyBox = foreignKeyBox; _foreignKeyBox.IsEnabled = false; _presenter = new Presenter(_dataView, currentAddressID, customerID); InitializeCommandBindings(); IsOpen = true; }
public void Show(Window ownerWindow, ForeignKeyBox foreignKeyBox, int?currentCustomerID, ForeignKeyBox shipToAddressBox, ForeignKeyBox billToAddressBox) { Debug.Assert(ownerWindow != null); Debug.Assert(foreignKeyBox != null); Debug.Assert(shipToAddressBox != null); Debug.Assert(billToAddressBox != null); Owner = ownerWindow; _foreignKeyBox = foreignKeyBox; _shipToAddressBox = shipToAddressBox; _billToAddressBox = billToAddressBox; _presenter = new Presenter(_dataView, currentCustomerID); InitializeCommandBindings(); ShowDialog(); }
void ForeignKeyBox.ILookupService.BeginLookup(ForeignKeyBox foreignKeyBox) { if (foreignKeyBox.ForeignKey == _.FK_Customer) { var dialogWindow = new CustomerLookupWindow(); dialogWindow.Show(_ownerWindow, foreignKeyBox, CurrentRow.GetValue(_.CustomerID), _shipToAddressBinding[CurrentRow], _billToAddressBinding[CurrentRow]); } else if (foreignKeyBox.ForeignKey == _.FK_ShipToAddress || foreignKeyBox.ForeignKey == _.FK_BillToAddress) { BeginLookupAddress(foreignKeyBox); } else { throw new NotSupportedException(); } }
private void BeginLookupAddress(ForeignKeyBox foreignKeyBox) { var foreignKey = (Address.PK)foreignKeyBox.ForeignKey; if (_addressLookupPopup.FK == foreignKey) { _addressLookupPopup.IsOpen = false; } else { var customerID = CurrentRow.GetValue(_.CustomerID); if (customerID.HasValue) { var addressID = foreignKeyBox.ForeignKey == _.FK_ShipToAddress ? _.ShipToAddressID : _.BillToAddressID; _addressLookupPopup.Show(foreignKeyBox, CurrentRow.GetValue(addressID), customerID.Value); } } }