//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(); } }
//opens store form using the targeted store as the open parameter private void StoreLabel_MouseClick(object sender, MouseEventArgs e) { windowPosition = this.Location; Store foo = storedEvent.GetStoreByName(StoreLabel.Text); StoreViewer newForm = new StoreViewer(parentReference, storedEvent, foo); this.Hide(); newForm.Location = windowPosition; newForm.ShowDialog(); this.Close(); }
//opens store viewer using clicked store private void StoreNameTextBox_Click(object sender, EventArgs e) { windowPosition = this.Location; Store foo = storedEvent.stores.First(bar => bar.storeName == StoreNameTextBox.Text); StoreViewer newForm = new StoreViewer(parentReference, storedEvent, foo); this.Hide(); newForm.Location = windowPosition; newForm.ShowDialog(); this.Close(); }