/// <summary> Removes a top-most form. </summary> /// <remarks> If the specified form is not a top-most form, nothing happens. </remarks> /// <returns> True if this form was the last of a stack. </returns> public bool Remove(IFormInterface form) { FormStack searchStack = _first; while (searchStack != null) { if (form == searchStack.GetTopmostForm()) { searchStack.Pop(); bool last = searchStack.IsEmpty(); if (last) { RemoveStack(searchStack); } else { searchStack.GetTopmostForm().Enable(); } if (Removed != null) { Removed(form, last); } return(last); } searchStack = searchStack._next; } Error.Warn(String.Format("Unable to find form '{0}' as a top-most form.", form.Text)); return(false); }
public void Previous(Form currentForm, int returnAttempts = 1) { Form currentStackedForm = null; int counter = 1; do { currentStackedForm = FormStack.Pop(); counter++; } while (counter <= returnAttempts); if (FormStack.Count.Equals(0)) { MainForm.Close(); } if (currentForm.Name.Equals("frmImportFile")) { //currentForm.Show(); MainForm.realPropertyTaxProjectionManager.FormSwitch = ((frmImportFile)currentForm).realPropertyTaxProjectionManager.FormSwitch; } currentForm.Dispose(); //close the current form currentStackedForm = FormStack.Peek(); currentStackedForm.Show(); }