/// <summary> /// 关闭一个窗口且没有保存提示 /// </summary> static public Form CloseWorkDocumentWithoutSave(string id, WorkDocumentType type) { Debug.Assert(!string.IsNullOrEmpty(id)); if (string.IsNullOrEmpty(id)) { return(null); } Form form; string key = GetKey(id, type); if (_dicIdAndView.TryGetValue(key, out form)) { ///利用关闭所有窗口时的选项:"全否" try { CloseAllWindowData.BeginCloseAllWindow(); CloseAllWindowData.Option = CloseAllWindowOption.AllNoSave; form.Close(); } finally { CloseAllWindowData.EndCloseAllWindow(); } } return(form); }
static public bool CloseProjectForm() { List <Form> listWillRemove = new List <Form>(); foreach (Form form in FormList) { FormData data = form.Tag as FormData; Debug.Assert(data != null); if (data == null) { continue; } switch (data.WorkDocumentType) { case WorkDocumentType.TmpltDesigner: case WorkDocumentType.HtmlDesigner: case WorkDocumentType.Manager: case WorkDocumentType.ProductEdit: case WorkDocumentType.HREdit: case WorkDocumentType.InviteBiddingEdit: case WorkDocumentType.KnowledgeEdit: case WorkDocumentType.ProjectEdit: listWillRemove.Add(form); break; case WorkDocumentType.SnipDesigner: ///snip设计器必须在tmplt设计器之前关闭 listWillRemove.Insert(0, form); break; } } try { CloseAllWindowData.BeginCloseAllWindow(); foreach (Form form in listWillRemove) { form.Close(); if (!form.IsDisposed) { return(false); } } } finally { CloseAllWindowData.EndCloseAllWindow(); } return(true); }
static public bool CloseAllForm(Form widthoutForm) { try { CloseAllWindowData.BeginCloseAllWindow(); List <Form> list = new List <Form>(); foreach (Form form in FormList) { if (form != widthoutForm) { FormData data = form.Tag as FormData; if (data.WorkDocumentType == WorkDocumentType.SnipDesigner) { ///snip设计器必须在tmplt设计器之前关闭 list.Insert(0, form); } else { list.Add(form); } } } foreach (Form form in list) { if (form != widthoutForm) { form.Close(); if (!form.IsDisposed) { return(false); } } } return(true); } finally { CloseAllWindowData.EndCloseAllWindow(); } }