void newshipmentForm_Closed(object sender, EventArgs e) { shipmentForm = null; }
private void BtnShipment_Click(object sender, RoutedEventArgs e) { if (shipmentForm == null || shipmentForm.IsActive) { shipmentForm = new Shipment(); shipmentForm.Show(); //Add a event handler to set null our window object when it will be closed shipmentForm.Closed += new EventHandler(newshipmentForm_Closed); } //If the window was created and your window isn't active //we call the method Activate to call the specific window to front else { shipmentForm.Activate(); } }