Added ability for user to enter the path to Visio
Use the user specified path to Visio, else look in the registry
This commit is contained in:
parent
ca9e0b2c1c
commit
dd65177acd
@ -1,7 +1,7 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -95,5 +95,8 @@
|
||||
<Setting Name="SeparateWindows" Type="System.Boolean" Scope="User">
|
||||
<Value Profile="(Default)">False</Value>
|
||||
</Setting>
|
||||
<Setting Name="VisioPath" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)" />
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user