public void ShowInitializer(string type, EventInitializer _temp, Event _eventData) { System.Windows.Forms.Form newForm = new System.Windows.Forms.Form(); windowPosition = this.Location; switch (type.ToLower()) { case "store": newForm = new StoreInitialize(_temp, _eventData); break; case "item": newForm = new ItemInitializer(_temp, _eventData); break; case "employee": newForm = new EmployeeInitializer(_temp, _eventData); break; } this.Hide(); newForm.Location = windowPosition; newForm.ShowDialog(); if (!(this is EventInitializer)) // if the current open page is not an event viewer { this.Close(); } }
public EmployeeInitializer(EventInitializer _parentRef, Event _event) { parentRef = _parentRef; eventRef = _event; InitializeComponent(); UpdateListContents(); }
//copy constructor public StoreInitialize(EventInitializer _parentRef, Event _event) { parentRef = _parentRef; eventRef = _event; InitializeComponent(); UpdatePageContents(); ResetLocalStore(); }
//used to return to the parent form protected void UnhideEventInitializer(EventInitializer _temp) { if (!_temp.Visible) { windowPosition = this.Location; this.Hide(); _temp.Location = windowPosition; _temp.Show(); _temp.UpdatePageContents(); this.Close(); } }
//hides current window and opens event creation tool private void NewButton_Click(object sender, EventArgs e) { if (EventNameTextBox.TextLength != 0) { this.Hide(); using (var eventViewer = new EventInitializer(EventNameTextBox.Text)) { switch (eventViewer.ShowDialog()) { case DialogResult.OK: UploadNewEvent(eventViewer.newEvent); break; case DialogResult.Cancel: break; } } this.Show(); } else { ErrorLabel.Text = "ERROR: No event name given."; } }