Added a IsBeingDeleted flag to the event arguments for closing a Word Document

Added a IsBeingDeleted argument to the CloseWordItem method
Added a IsBeingDeleted Property to the DSOTabPanel so that it does not ask if	it should save changes if the section is being deleted.
This commit is contained in:
Rich 2010-12-16 22:16:49 +00:00
parent 580ace24ad
commit 1757d238d5
4 changed files with 26 additions and 3 deletions

View File

@ -839,7 +839,7 @@ namespace VEPROMS
}
private void tv_SectionShouldClose(object sender, vlnTreeSectionInfoEventArgs args)
{
if (!args.MySectionInfo.IsStepSection) tc.CloseWordItem(args.MySectionInfo);
if (!args.MySectionInfo.IsStepSection) tc.CloseWordItem(args.MySectionInfo,args.IsDeleting);
}
private void tv_WordSectionDeleted(object sender, WordSectionEventArgs args)
{

View File

@ -434,6 +434,12 @@ namespace Volian.Controls.Library
}
return true;
}
private bool _IsBeingDeleted = false;
public bool IsBeingDeleted
{
get { return _IsBeingDeleted; }
set { _IsBeingDeleted = value; }
}
/// <summary>
/// Cleans-up the DSO Framer window
/// </summary>
@ -455,7 +461,8 @@ namespace Volian.Controls.Library
{
if (_MyDSOFramer != null)
{
SaveDirty();
if(!IsBeingDeleted)
SaveDirty();
_MyDSOFramer.Close();
Controls.Remove(_MyDSOFramer);
components.Remove(_MyDSOFramer);

View File

@ -404,6 +404,10 @@ namespace Volian.Controls.Library
}
}
public void CloseWordItem(ItemInfo myItemInfo)
{
CloseWordItem(myItemInfo, false);
}
public void CloseWordItem(ItemInfo myItemInfo, bool isBeingDeleted)
{
CleanUpClosedItems();
string key = "Doc - " + myItemInfo.MyContent.MyEntry.MyDocument.DocID.ToString();
@ -413,6 +417,7 @@ namespace Volian.Controls.Library
myTabItem = _MyDisplayTabItems[key];
if (myTabItem.MyDSOTabPanel != null)
{
myTabItem.MyDSOTabPanel.IsBeingDeleted = isBeingDeleted;
CloseTabItem(myTabItem);
}
}

View File

@ -27,6 +27,12 @@ namespace Volian.Controls.Library
public delegate void WordSectionDeletedEvent(object sender, WordSectionEventArgs args);
public partial class vlnTreeSectionInfoEventArgs
{
private bool _IsDeleting = false;
public bool IsDeleting
{
get { return _IsDeleting; }
set { _IsDeleting = value; }
}
private SectionInfo _MySectionInfo;
public SectionInfo MySectionInfo
{
@ -37,6 +43,11 @@ namespace Volian.Controls.Library
{
_MySectionInfo = mySectionInfo;
}
public vlnTreeSectionInfoEventArgs(SectionInfo mySectionInfo,bool isDeleting)
{
_MySectionInfo = mySectionInfo;
_IsDeleting = isDeleting;
}
}
public partial class vlnTreeEventArgs
{
@ -1064,7 +1075,7 @@ namespace Volian.Controls.Library
}
else if (_LastSectionInfo != null)
{
OnSectionShouldClose(this, new vlnTreeSectionInfoEventArgs(_LastSectionInfo));
OnSectionShouldClose(this, new vlnTreeSectionInfoEventArgs(_LastSectionInfo,true));
// always return false because an event gets fired to delete tree nodes.
if (!DeleteItemInfoAndChildren(_LastSectionInfo))
{