If DSOFramer fails to open a document, replace the bad document with an empty document.
This commit is contained in:
parent
f6d8b8f9d3
commit
bcdc190caf
@ -146,9 +146,35 @@ namespace Volian.Controls.Library
|
||||
//System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(WordDSOTab));
|
||||
//this._DSOFramer.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("_FC.OcxState")));
|
||||
((System.ComponentModel.ISupportInitialize)(this._MyDSOFramer)).EndInit();
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
this._MyDSOFramer.Open(MyDSOFile.MyFile.FullName);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.IO.FileStream fs = MyDSOFile.MyFile.Create();
|
||||
using (DocumentAuditInfoList dail = DocumentAuditInfoList.Get(MyDocumentInfo.DocID))
|
||||
{
|
||||
if (dail.Count > 0)
|
||||
{
|
||||
DocumentAuditInfo dai = dail[0];
|
||||
foreach (DocumentAuditInfo tmpa in dail)
|
||||
{
|
||||
if (tmpa.DTS > dai.DTS) dai = tmpa;
|
||||
}
|
||||
if(MessageBox.Show("Do you want to revert to a previous version?", "Error in MS Word section",
|
||||
MessageBoxButtons.YesNo, MessageBoxIcon.Question)==DialogResult.Yes)
|
||||
fs.Write(dai.DocContent, 0, dai.DocContent.Length);
|
||||
}
|
||||
else
|
||||
MessageBox.Show("Reverting to Blank Document", "Error in MS Word section",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||
}
|
||||
fs.Close();
|
||||
this._MyDSOFramer.Open(MyDSOFile.MyFile.FullName);
|
||||
}
|
||||
this._MyDSOFramer.Menubar = false;
|
||||
this._MyDSOFramer.Titlebar = false;
|
||||
//if (_MyCount < 20)
|
||||
@ -360,10 +386,13 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
}
|
||||
public void StatusChanged(VolianStatusType type, int count, string text)
|
||||
{
|
||||
if (Parent != null && Parent.Parent != null && Parent.Parent.Parent is DisplayTabControl)
|
||||
{
|
||||
DisplayTabControl tc = Parent.Parent.Parent as DisplayTabControl;
|
||||
tc.ONStatusChanged(this, new DisplayTabControlStatusEventArgs(type, count, text));
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Before a document closes check to see if it's contents should be saved.
|
||||
/// </summary>
|
||||
|
Loading…
x
Reference in New Issue
Block a user