Additional logic to try to start up the equation editor, modified message box and added to error log if it could not be started. B2016-278

This commit is contained in:
John Jenko 2016-12-06 16:32:12 +00:00
parent a9bd84ad5f
commit cc30214d31

View File

@ -1027,7 +1027,10 @@ namespace Volian.Controls.Library
// launch equation editor // launch equation editor
string EqnEdt = GetEqnEdt(); string EqnEdt = GetEqnEdt();
if (EqnEdt == null) if (EqnEdt == null)
MessageBox.Show("Equation Editor is not correctly configured in the registry.", "Warning", MessageBoxButtons.OK); {
_MyLog.WarnFormat("Equation Editor is not correctly configured in the registry.");
MessageBox.Show("The Equation Editor needs to be started.", "Reminder", MessageBoxButtons.OK);
}
else else
Process.Start(EqnEdt); Process.Start(EqnEdt);
_MyEditItem.AddChild((E_FromType)fromtype, contenttype); _MyEditItem.AddChild((E_FromType)fromtype, contenttype);
@ -1051,6 +1054,17 @@ namespace Volian.Controls.Library
} }
catch (Exception ex) catch (Exception ex)
{ {
string folderPath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);
folderPath += @"\Common Files\Microsoft Shared\EQUATION\EQNEDT32.EXE";
System.IO.FileInfo fi = new System.IO.FileInfo(folderPath);
if (fi.Exists) return fi.FullName;
folderPath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles).Replace(" (x86)", "");
folderPath += @"\Common Files\Microsoft Shared\EQUATION\EQNEDT32.EXE";
fi = new System.IO.FileInfo(folderPath);
if (fi.Exists) return fi.FullName;
folderPath = @"C:\Program Files\Common Files\Microsoft Shared\EQUATION\EQNEDT32.EXE";
fi = new System.IO.FileInfo(folderPath);
if (fi.Exists) return fi.FullName;
return null; return null;
} }
return retval; return retval;