public void LaunchNavis2Bcf()
{
// Don't Support Automation
if (Autodesk.Navisworks.Api.Application.IsAutomated)
{
throw new InvalidOperationException("Invalid when running using Automation");
}
//Find the plugin
PluginRecord m_pr = Autodesk.Navisworks.Api.Application.Plugins.FindPlugin("Navis2BCF.Plugin.CASE");
if (m_pr != null && m_pr is DockPanePluginRecord && m_pr.IsEnabled)
{
//need to load the assebly from here otherwise navis will crash!
string m_dllfolder = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Ionic.Zip.dll");
if (!File.Exists(m_dllfolder))
{
MessageBox.Show("Required Ionic Library Not Found");
return;
}
Assembly.LoadFrom(m_dllfolder);
// check if it needs loading
if (m_pr.LoadedPlugin == null)
{
string exeConfigPath = this.GetType().Assembly.Location;
m_pr.LoadPlugin();
}
DockPanePlugin m_dpp = m_pr.LoadedPlugin as DockPanePlugin;
if (m_dpp != null)
{
// switch the Visible flag
m_dpp.Visible = !m_dpp.Visible;
}
}
}