diff --git a/PROMS/VEPROMS User Interface/Properties/Settings.Designer.cs b/PROMS/VEPROMS User Interface/Properties/Settings.Designer.cs index cb4966be..6a594e91 100644 --- a/PROMS/VEPROMS User Interface/Properties/Settings.Designer.cs +++ b/PROMS/VEPROMS User Interface/Properties/Settings.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.18444 +// Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -374,20 +374,29 @@ namespace VEPROMS.Properties { this["SyncEnhancedDocuments"] = value; } } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("False")] - public bool SeparateWindows - { - get - { - return ((bool)(this["SeparateWindows"])); - } - set - { - this["SeparateWindows"] = value; - } - } - } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("False")] + public bool SeparateWindows { + get { + return ((bool)(this["SeparateWindows"])); + } + set { + this["SeparateWindows"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string VisioPath { + get { + return ((string)(this["VisioPath"])); + } + set { + this["VisioPath"] = value; + } + } + } } diff --git a/PROMS/VEPROMS User Interface/Properties/Settings.settings b/PROMS/VEPROMS User Interface/Properties/Settings.settings index 825b98bb..7095609a 100644 --- a/PROMS/VEPROMS User Interface/Properties/Settings.settings +++ b/PROMS/VEPROMS User Interface/Properties/Settings.settings @@ -95,5 +95,8 @@ False + + + \ No newline at end of file diff --git a/PROMS/Volian.Controls.Library/StepTabRibbon.cs b/PROMS/Volian.Controls.Library/StepTabRibbon.cs index 39fbf387..cb9dbe27 100644 --- a/PROMS/Volian.Controls.Library/StepTabRibbon.cs +++ b/PROMS/Volian.Controls.Library/StepTabRibbon.cs @@ -18,6 +18,12 @@ namespace Volian.Controls.Library { public partial class StepTabRibbon : UserControl { + private static string _SpecifiedVisioPath = null; + public static string SpecifiedVisioPath + { + get { return StepTabRibbon._SpecifiedVisioPath; } + set { StepTabRibbon._SpecifiedVisioPath = value; } + } private static bool _PastePlainTextSetting = false; public static bool PastePlainTextSetting { @@ -1035,7 +1041,6 @@ namespace Volian.Controls.Library switch (OleObjectEditors) { case 0: // None - _MyLog.WarnFormat("Equation Editor is not correctly configured in the registry."); MessageBox.Show("The Equation Editor needs to be started.", "Reminder", MessageBoxButtons.OK); break; case 1: // Equation Editor @@ -1073,6 +1078,7 @@ namespace Volian.Controls.Library } catch (Exception ex) { + _MyLog.WarnFormat("Equation Editor is not correctly configured in the registry."); string folderPath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles); folderPath += @"\Common Files\Microsoft Shared\EQUATION\EQNEDT32.EXE"; System.IO.FileInfo fi = new System.IO.FileInfo(folderPath); @@ -1086,26 +1092,39 @@ namespace Volian.Controls.Library if (fi.Exists) return fi.FullName; return null; } + if (retval == null) + _MyLog.WarnFormat("Equation Editor executable could not be found."); return retval; } + private static string GetVisio() // Added support for Visio { - string retval = null; - try + string retval = _SpecifiedVisioPath; // use the Visio path specified by the user + if (retval != null && retval != "") { - RegistryKey key = Registry.ClassesRoot; - string rootName = key.Name; - string curVer = GetDefaultKeyValue(key.Name + "\\Visio.Drawing\\CurVer"); - string clsid = GetDefaultKeyValue(key.Name + "\\" + curVer + "\\CLSID"); - retval = GetDefaultKeyValue(key.Name + "\\CLSID\\" + clsid + "\\LocalServer32"); + if (!retval.ToUpper().EndsWith(".EXE")) + retval += (retval.EndsWith("\\")) ? "visio.exe" : "\\visio.exe"; + if (!File.Exists(retval)) // visio path was invalid, so try the registry next + { + _MyLog.WarnFormat("Specified Visio Path is Invalid: {0}",retval); + retval = null; // look in the registry + } } - catch (Exception) + if (retval == null || retval == "") { - DirectoryInfo di = new DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles)); - string path = FindFile(di, "visio.exe"); - if (path != null) return path; + try + { + RegistryKey regVersionString = Registry.ClassesRoot.OpenSubKey("Visio.Drawing\\CurVer"); + RegistryKey regClassId = Registry.ClassesRoot.OpenSubKey(regVersionString.GetValue("") + "\\CLSID"); + RegistryKey regInstallPath = Registry.ClassesRoot.OpenSubKey("CLSID\\" + regClassId.GetValue("") + "\\LocalServer32"); + retval = Path.GetFullPath(regInstallPath.GetValue("").ToString()); // this will convert a short file/folder names to long file/folder names + } + catch + { + _MyLog.WarnFormat("Visio was not found in the registry."); + } } - return retval; + return retval; } private static string _EqnEdtPath = null; public static string EqnEdtPath