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) 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) private void tv_WordSectionDeleted(object sender, WordSectionEventArgs args)
{ {

View File

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

View File

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

View File

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