/// <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 bool IsTopMostOfSomeStack(IFormInterface form) { FormStack searchStack = _first; while (searchStack != null) { if (form == searchStack.GetTopmostForm()) { return(true); } searchStack = searchStack._next; } return(false); }
public void BringToFront(IFormInterface form) { FormStack searchStack = _first; while (searchStack != null) { if (form == searchStack.GetTopmostForm()) { RemoveStack(searchStack); AddStackToTop(searchStack); return; } searchStack = searchStack._next; } throw new ClientException(ClientException.Codes.UnableToFindTopmostForm, form.Text); }
/// <summary> Adds the form as modal (top of the stack) over some existing form. </summary> /// <param name="parentForm"> A form that is at the top of some stack in the list. </param> public void AddModal(IFormInterface form, IFormInterface parentForm) { FormStack searchStack = _first; IFormInterface topmost; while (searchStack != null) { topmost = searchStack.GetTopmostForm(); if (parentForm == topmost) { topmost.Disable(form); searchStack.Push(form); if (Added != null) { Added(form, false); } return; } searchStack = searchStack._next; } throw new ClientException(ClientException.Codes.InvalidParentForm, parentForm.Text); }