//creates a new window when navigating child forms to the event viewer, on child is true if protected void ShowViewer(string type, EventViewer _temp, Event _eventData) { windowPosition = this.Location; System.Windows.Forms.Form newForm = new System.Windows.Forms.Form(); switch (type.ToLower()) { case "store": newForm = new StoreViewer(_temp, _eventData); break; case "item": newForm = new ItemViewer(_temp, _eventData); break; case "employee": newForm = new Form(_temp, _eventData); break; case "manager": newForm = new ManagerViewer(_temp, _eventData); break; } this.Hide(); newForm.Location = windowPosition; newForm.ShowDialog(); if (!(this is EventViewer)) // if the current open page is not an event viewer { this.Close(); } }
private void InventoryListBox_SelectedIndexChanged(object sender, EventArgs e) { if (CheckItemSelected(InventoryListBox)) { windowPosition = this.Location; Item foo = storedEvent.GetItemByName(GetListBoxSelected(InventoryListBox)); ItemViewer tempForm = new ItemViewer(parentReference, storedEvent, foo); this.Hide(); tempForm.Location = windowPosition; tempForm.ShowDialog(); this.Close(); } }