using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; using Foo.Platform.Win32; using System.Runtime.InteropServices; using System.Diagnostics; using System.Reflection; namespace Foo.WorkspaceMgr.Launchers { internal class Launcher_Visio : ILaunch { #region ILaunch Members /// /// Checks to see if the file exists in the system i.e. can be reached over /// the network. if FileExists fails, we shouldn't be able to launch it. /// /// location of the path + file to launch /// public FuncDepBoolType IQueryLaunch(string strArtifactLocation) { if (!String.IsNullOrEmpty(strArtifactLocation) && (strArtifactLocation.Length > 3)) { if (File.Exists(strArtifactLocation)) return FuncDepBoolType.Success; else return FuncDepBoolType.ArtifactLocationUnavailable; } else { return FuncDepBoolType.ParametersInvalid; } } public const string Excel_ProgId = "Visio.Application"; /// /// Generic Launcher should be able to handle any file type. Launched the .Net Way. /// ~this is the same as if the User clicks on the file. /// /// location of the path + file to launch /// public FuncDepBoolType ILaunch(string strArtifactLocation) { Microsoft.Office.Interop.Visio.Application app = null; app = new Microsoft.Office.Interop.Visio.Application(); // Mark the Application as visible app.Visible = true; app.Documents.Open(strArtifactLocation); // Keep Track of all our Excel Instances ///WorkspaceState.Launched_ExcelInstances.Add(app); return FuncDepBoolType.Success; //if (!String.IsNullOrEmpty(strArtifactLocation) && (strArtifactLocation.Length > 3)) //{ // Process.Start(strArtifactLocation); //} //return FuncDepBoolType.ParametersInvalid; } #endregion } }