B2017-249 Handle AutoSave feature of MSWord. Handle temporary documents which were not saved when PROMS crashed or was terminated without saving.

This commit is contained in:
Rich
2017-11-06 15:25:09 +00:00
parent bc0504c42e
commit 543a64a4f2
3 changed files with 128 additions and 9 deletions

View File

@@ -86,7 +86,8 @@ namespace Volian.Controls.Library
get
{
if (_MyEdWord == null) return false; // B2017-133 Edraw Is Dirty Property
return _MyEdWord.IsDirty();
// B2017-249 Recover Temporary File And AutoSave support for MSWord
return _MyEdWord.IsDirty() || MyDSOFile.ContentIsDirty;
//LBDocumentClass doc = new LBDocumentClass(_MyEdWord.ActiveDocument());
//return !doc.Saved;
}
@@ -545,7 +546,8 @@ namespace Volian.Controls.Library
{
if (OverrideClose)
return false;
if (IsDirty)
// B2017-249 Recover Temporary File And AutoSave support for MSWord
if (IsDirty || MyDSOFile.MyDocument.ContentIsDirty)
{
// Unfortunately, the only way to handle view mode for DSO Framer is to not save.
if (PanelViewEditMode == E_ViewMode.View || !_AllowedToEdit)
@@ -554,12 +556,24 @@ namespace Volian.Controls.Library
return false;
}
//if (MessageBox.Show("Save changes to " + _MyDisplayTabItem.MyItemInfo.TabTitle + "\r\n" + _MyDisplayTabItem.MyItemInfo.TabToolTip, "Document has Changed", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
if (MessageBox.Show("Save changes to " + _MyDisplayTabItem.Text + "\r\n" + _MyDisplayTabItem.Tooltip, "Document has Changed", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
// B2017-249 Recover Temporary File And AutoSave support for MSWord
if (MessageBox.Show("Save changes to " + (MyDSOFile.MyDocument.ContentIsDirty ? "Recovered Version of " : "") + _MyDisplayTabItem.Text + "\r\n" + _MyDisplayTabItem.Tooltip,
(IsDirty ? "Document has Changed" : "Previous Changes were not saved."), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
return SaveDSO();
//Console.WriteLine("Delete {0}", MyDSOFile.MyFile.Name);
DeleteOnClose = true;
return false;
}
return true;
}
// B2017-249 Recover Temporary File And AutoSave support for MSWord
private bool _DeleteOnClose = false;
public bool DeleteOnClose
{
get { return _DeleteOnClose; }
set { _DeleteOnClose = value; }
}
public static bool IgnoreEnter = false;
private bool _In_DSOTabPanel_Enter=false;
/// <summary>
@@ -638,6 +652,8 @@ namespace Volian.Controls.Library
components.Remove(_MyEdWord);
_MyEdWord.Dispose();
_MyEdWord = null;
// B2017-249 Recover Temporary File And AutoSave support for MSWord
if (DeleteOnClose) MyDSOFile.MyFile.Delete();
_Count--;
}
}