Moved MS Word Terminate code to WordDoc.cs
Added a new parameter to SaveWordDoc call
This commit is contained in:
parent
3a27bf6eb6
commit
1741b0e3e0
@ -71,7 +71,7 @@ namespace DataLoader
|
||||
string title = null; // for docname, remove the '.lib', i.e. substring(0,8)
|
||||
DateTime dts = DateTime.Now;
|
||||
string tmpRtfFileName = GetLibDocData(fi, ci, ref title);
|
||||
int Docid = SaveWordDoc(tmpRtfFileName, title, null, ci);
|
||||
int Docid = SaveWordDoc(tmpRtfFileName, title, null, ci, string.Empty);
|
||||
File.Delete(tmpRtfFileName);
|
||||
return Docid;
|
||||
}
|
||||
|
@ -95,6 +95,7 @@ namespace DataLoader
|
||||
while (ex != null)
|
||||
{
|
||||
sb.Append("\r\n" + "".PadRight((++indent)*2,' ') + string.Format("{0} - {1}",ex.GetType().Name,ex.Message));
|
||||
sb.Append(ex.StackTrace);
|
||||
ex=ex.InnerException;
|
||||
}
|
||||
MyError = sb.ToString();
|
||||
@ -227,13 +228,6 @@ namespace DataLoader
|
||||
ldr.ClearData();
|
||||
bool suc = ldr.LoadFolders(tbVePromsPath.Text);
|
||||
}
|
||||
private System.Diagnostics.Process [] WordProcesses
|
||||
{
|
||||
get
|
||||
{
|
||||
return System.Diagnostics.Process.GetProcessesByName("WINWORD");
|
||||
}
|
||||
}
|
||||
|
||||
private void btnConvert_Click(object sender, System.EventArgs e)
|
||||
{
|
||||
@ -245,14 +239,14 @@ namespace DataLoader
|
||||
try
|
||||
{
|
||||
//TextConvert.ResetSpecialCharacters();
|
||||
System.Diagnostics.Process[] wordProcesses = WordProcesses;
|
||||
System.Diagnostics.Process[] wordProcesses = WordDoc.WordProcesses;
|
||||
MyFrmErrors.Clear();
|
||||
if (wordProcesses.Length > 0)
|
||||
{
|
||||
AddError("{0} copies of MS Word are running", wordProcesses.Length);
|
||||
if (MessageBox.Show("MS Word is Running and must be stopped before proceeding.\n\nStop MS Word?", "MS Word is Running", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
{
|
||||
TerminateProcesses(wordProcesses);
|
||||
WordDoc.TerminateProcesses(wordProcesses);
|
||||
MyFrmErrors.Clear();
|
||||
}
|
||||
else
|
||||
@ -314,23 +308,13 @@ namespace DataLoader
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
AddError("===================== Fatal Error ==========================\r\n{0} - {1}", ex.GetType().Name, ex.Message);
|
||||
AddError(ex,"===================== Fatal Error ==========================\r\n{0} - {1}", ex.GetType().Name, ex.Message);
|
||||
SaveLogFiles();
|
||||
MessageBox.Show(ex.Message, "Fatal Error During Loading", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
_MyLog.Fatal(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private void TerminateProcesses(System.Diagnostics.Process [] wordProcesses)
|
||||
{
|
||||
foreach (System.Diagnostics.Process proc in wordProcesses)
|
||||
{
|
||||
// TODO: Determine if Word is Visible
|
||||
// If it is let it run
|
||||
// otherwise Kill it.
|
||||
proc.Kill();
|
||||
}
|
||||
}
|
||||
public void UpdateLabels(int incPrc, int incSec, int incStp)
|
||||
{
|
||||
if (incPrc == 0 && incSec == 0 && incStp == 0)//Reset
|
||||
|
Loading…
x
Reference in New Issue
Block a user