Beispiel #1
0
        /// <summary>
        /// Shows or Hides the Communicator dockable pane.
        /// </summary>
        /// <param name="application">UIApp</param>
        public void ToggleCommunicator(UIApplication application)
        {
            var dpid = new DockablePaneId(new Guid(Properties.Resources.CommunicatorGuid));
            var dp   = application.GetDockablePane(dpid);

            if (dp == null)
            {
                return;
            }

            var assembly = Assembly.GetExecutingAssembly();

            if (dp.IsShown())
            {
                dp.Hide();
                AppCommand.Instance.CommunicatorButton.LargeImage = ButtonUtil.LoadBitmapImage(assembly, "HOK.MissionControl", "communicatorOff_32x32.png");
                AppCommand.Instance.CommunicatorButton.ItemText   = "Show" + Environment.NewLine + "Communicator";
            }
            else
            {
                dp.Show();
                AppCommand.Instance.CommunicatorButton.LargeImage = ButtonUtil.LoadBitmapImage(assembly, "HOK.MissionControl", "communicatorOn_32x32.png");
                AppCommand.Instance.CommunicatorButton.ItemText   = "Hide" + Environment.NewLine + "Communicator";
            }
        }
Beispiel #2
0
        public Result OnStartup(UIControlledApplication application)
        {
            try
            {
                application.CreateRibbonTab(tabName);
            }
            catch
            {
                Log.AppendLog(LogMessageType.INFO, "Ribbon tab was not created because it already exists: " + tabName);
            }

            var assembly = Assembly.GetAssembly(GetType());
            var panel    = application.GetRibbonPanels(tabName).FirstOrDefault(x => x.Name == "Mission Control")
                           ?? application.CreateRibbonPanel(tabName, "Mission Control");
            var unused = (PushButton)panel.AddItem(new PushButtonData("StylesManager_Command", "  Styles  " + Environment.NewLine + "Manager",
                                                                      assembly.Location, "HOK.MissionControl.StylesManager.StylesManagerCommand")
            {
                LargeImage = ButtonUtil.LoadBitmapImage(assembly, "HOK.MissionControl.StylesManager", Properties.Resources.StylesManager_ImageName),
                ToolTip    = Properties.Resources.StylesManager_Description
            });

            StylesManagerHandler = new StylesManagerRequestHandler();
            StylesManagerEvent   = ExternalEvent.Create(StylesManagerHandler);

            return(Result.Succeeded);
        }
Beispiel #3
0
        /// <summary>
        /// Creates feedback button.
        /// </summary>
        private void CreateFeedbackButtons()
        {
            try
            {
                var fileExist     = false;
                var created       = m_app.GetRibbonPanels(tabName).FirstOrDefault(x => x.Name == "Help");
                var feedbackPanel = created ?? m_app.CreateRibbonPanel(tabName, "Help");

                if (File.Exists(currentDirectory + "/HOK.Feedback.dll"))
                {
                    var coreAssembly = Assembly.LoadFrom(currentDirectory + "/HOK.Feedback.dll");
                    var pb           = (PushButton)feedbackPanel.AddItem(new PushButtonData("SendFeedback_command", "Send" + Environment.NewLine + " Feedback", currentDirectory + "/HOK.Feedback.dll", "HOK.Feedback.FeedbackCommand"));
                    pb.LargeImage = ButtonUtil.LoadBitmapImage(coreAssembly, "HOK.Feedback", "comments_32x32.png");
                    pb.ToolTip    = "Submit feedback to HOK developers.";
                    AddToolTips(pb);
                    fileExist = true;
                }

                if (!fileExist)
                {
                    feedbackPanel.Visible = false;
                }
            }
            catch (Exception e)
            {
                Log.AppendLog(LogMessageType.EXCEPTION, e.Message);
            }
        }
Beispiel #4
0
        /// <summary>
        /// Utility method for creating all MissionControl buttons that don't have their own AppCommand.
        /// </summary>
        /// <param name="application">UI Controlled Application.</param>
        private void CreateButtons(UIControlledApplication application)
        {
            try
            {
                application.CreateRibbonTab(tabName);
            }
            catch
            {
                Log.AppendLog(LogMessageType.INFO, "Ribbon tab was not created because it already exists: " + tabName);
            }

            var assembly = Assembly.GetAssembly(GetType());
            var panel    = application.GetRibbonPanels(tabName).FirstOrDefault(x => x.Name == "Mission Control")
                           ?? application.CreateRibbonPanel(tabName, "Mission Control");

            CommunicatorButton = (PushButton)panel.AddItem(new PushButtonData("Communicator_Command",
                                                                              "Show/Hide" + Environment.NewLine + "Communicator",
                                                                              assembly.Location, "HOK.MissionControl.Tools.Communicator.CommunicatorCommand"));

            WebsiteButton = (PushButton)panel.AddItem(new PushButtonData("WebsiteLink_Command",
                                                                         "Launch" + Environment.NewLine + "MissionControl",
                                                                         assembly.Location, "HOK.MissionControl.Tools.WebsiteLink.WebsiteLinkCommand"));
            WebsiteButton.LargeImage =
                ButtonUtil.LoadBitmapImage(assembly, "HOK.MissionControl", "missionControl_32x32.png");
            WebsiteButton.ToolTip = "Launch Mission Control website.";

            var currentAssembly  = Assembly.GetAssembly(GetType()).Location;
            var currentDirectory = Path.GetDirectoryName(currentAssembly);

            // (Konrad) Publish Family Data
            var fpAssembly = Assembly.LoadFrom(currentDirectory + "/HOK.MissionControl.FamilyPublish.dll");

            FamilyPublishButton = (PushButton)panel.AddItem(new PushButtonData("FamilyPublish_Command",
                                                                               "Publish Family" + Environment.NewLine + " Data",
                                                                               currentDirectory + "/HOK.MissionControl.FamilyPublish.dll",
                                                                               "HOK.MissionControl.FamilyPublish.FamilyPublishCommand"));
            FamilyPublishButton.LargeImage = ButtonUtil.LoadBitmapImage(fpAssembly, "HOK.MissionControl.FamilyPublish",
                                                                        "publishFamily_32x32.png");
            FamilyPublishButton.ToolTip =
                "This plug-in publishes information about Families currently loaded in the project to Mission Control.";

            // (Konrad) Links Manager
            var lmAssembly  = Assembly.LoadFrom(currentDirectory + "/HOK.MissionControl.LinksManager.dll");
            var linksButton = (PushButton)panel.AddItem(new PushButtonData("LinksManager_Command",
                                                                           "Links" + Environment.NewLine + " Manager ",
                                                                           currentDirectory + "/HOK.MissionControl.LinksManager.dll",
                                                                           "HOK.MissionControl.LinksManager.LinksManagerCommand"));

            linksButton.LargeImage = ButtonUtil.LoadBitmapImage(lmAssembly, "HOK.MissionControl.LinksManager",
                                                                "linksManager_32x32.png");
            linksButton.ToolTip =
                "Utility tool that allows users to quickly identify Imported Images, DWGs, and Styles.";
        }
Beispiel #5
0
        public Result OnStartup(UIControlledApplication application)
        {
            thisApp = this;
            m_app   = application;
            try
            {
                try
                {
                    m_app.CreateRibbonTab(tabName);
                }
                catch (Exception ex)
                {
                    Log.AppendLog(LogMessageType.EXCEPTION, ex.Message);
                }

                versionNumber    = m_app.ControlledApplication.VersionNumber;
                sourceDirectory  = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\Autodesk\\REVIT\\Addins\\" + versionNumber + "\\_HOK";
                installDirectory = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Autodesk\\REVIT\\Addins\\" + versionNumber;
                addinResources   = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\Autodesk\\REVIT\\Addins\\" + versionNumber + "\\HOK-Addin.bundle\\Contents\\Resources";

                application.ControlledApplication.ApplicationInitialized += ReadAddinSettingsOnInitialized;
                application.ApplicationClosing += ApplicationOnClosing;

                //ribbon panel
                var toolTipText = Path.Combine(addinResources, "HOK.Tooltip.txt");
                addinManagerToolTip = ToolTipReader.ReadToolTip(toolTipText, "Addin Manager");

                var panel           = m_app.CreateRibbonPanel(tabName, " Addins ");
                var currentAssembly = Assembly.GetExecutingAssembly();

                var installerButton = (PushButton)panel.AddItem(new PushButtonData("Addin Manager", "Addin Manager", currentAssembly.Location, "HOK.AddInManager.Command"));
                var pluginImage     = ButtonUtil.LoadBitmapImage(currentAssembly, typeof(AppCommand).Namespace, "pluginManager_32.png");
                installerButton.LargeImage            = pluginImage;
                installerButton.ToolTip               = addinManagerToolTip.Description;
                installerButton.AvailabilityClassName = "HOK.AddInManager.Availability";
                var contextualHelp = new ContextualHelp(ContextualHelpType.Url, addinManagerToolTip.HelpUrl);
                installerButton.SetContextualHelp(contextualHelp);
            }
            catch (Exception ex)
            {
                Log.AppendLog(LogMessageType.EXCEPTION, ex.Message);
            }
            return(Result.Succeeded);
        }
Beispiel #6
0
 /// <summary>
 /// Communicator Image can only be set when we are done loading the app.
 /// </summary>
 public static void SetCommunicatorImage()
 {
     // (Konrad) This needs to run after the doc is opened, because UI elements don't get created until then.
     AppCommand.EnqueueTask(app =>
     {
         var dpid     = new DockablePaneId(new Guid(Properties.Resources.CommunicatorGuid));
         var dp       = app.GetDockablePane(dpid);
         var assembly = Assembly.GetExecutingAssembly();
         if (dp != null)
         {
             AppCommand.Instance.CommunicatorButton.LargeImage = ButtonUtil.LoadBitmapImage(assembly, "HOK.MissionControl", dp.IsShown()
                 ? "communicatorOn_32x32.png"
                 : "communicatorOff_32x32.png");
             AppCommand.Instance.CommunicatorButton.ItemText = dp.IsShown()
                 ? "Hide" + Environment.NewLine + "Communicator"
                 : "Show" + Environment.NewLine + "Communicator";
         }
     });
 }
Beispiel #7
0
        //private void CreateDataPushButtons()
        //{
        //    try
        //    {
        //        if (!File.Exists(currentDirectory + "/HOK.RevitDBManager.dll")) return;

        //        var dataPanel = m_app.CreateRibbonPanel(tabName, "Revit Data");

        //        var pb11 = (PushButton)dataPanel.AddItem(new PushButtonData("Data Sync", "Data Sync", currentDirectory + "/HOK.RevitDBManager.dll", "RevitDBManager.Command"));
        //        pb11.LargeImage = LoadBitmapImage(assembly, "sync.ico");
        //        pb11.ToolTip = "Data Sync";
        //        AddToolTips(pb11);

        //var pb12 = (PushButton)dataPanel.AddItem(new PushButtonData("Setup", "  Setup  ", currentDirectory + "/HOK.RevitDBManager.dll", "RevitDBManager.EditorCommand"));
        //pb12.LargeImage = LoadBitmapImage(assembly, "editor.ico");
        //pb12.ToolTip = "Setup";
        //AddToolTips(pb12);

        //        var pb13 = (PushButton)dataPanel.AddItem(new PushButtonData("Data Editor", "Data Editor", currentDirectory + "/HOK.RevitDBManager.dll", "RevitDBManager.ViewerCommand"));
        //        pb13.LargeImage = LoadBitmapImage(assembly, "view.ico");
        //        pb13.ToolTip = "Data Editor";
        //        AddToolTips(pb13);
        //    }
        //    catch (Exception ex)
        //    {
        //        Log.AppendLog(LogMessageType.EXCEPTION, ex.Message);
        //    }
        //}

        /// <summary>
        /// Creates all Analysis related buttons.
        /// </summary>
        private void CreateAvfPushButtons()
        {
            try
            {
                if (!File.Exists(currentDirectory + "/HOK.LPDCalculator.dll") &&
                    !File.Exists(currentDirectory + "/HOK.ViewAnalysis.dll"))
                {
                    return;
                }
                var avfPanel = m_app.CreateRibbonPanel(tabName, "Analysis");

                var splitButtonData = new SplitButtonData("HOKAnalysis", "HOK Analysis");
                var splitButton     = (SplitButton)avfPanel.AddItem(splitButtonData);
                splitButton.IsSynchronizedWithCurrentItem = true;

                if (File.Exists(currentDirectory + "/HOK.LPDCalculator.dll"))
                {
                    var assemblyPath = currentDirectory + "/HOK.LPDCalculator.dll";
                    var ass          = Assembly.LoadFrom(assemblyPath);
                    var pb15         = splitButton.AddPushButton(new PushButtonData("LPD Analysis", "LPD Analysis", currentDirectory + "/HOK.LPDCalculator.dll", "HOK.LPDCalculator.Command"));
                    pb15.LargeImage = ButtonUtil.LoadBitmapImage(ass, "HOK.LPDCalculator", "lpdCalculator_32.png");
                    pb15.ToolTip    = "Calculating Lighting Power Density";
                    AddToolTips(pb15);
                }

                if (!File.Exists(currentDirectory + "/HOK.ViewAnalysis.dll"))
                {
                    return;
                }

                var pb24 = splitButton.AddPushButton(new PushButtonData("LEED View Analysis", "LEED View Analysis", currentDirectory + "/HOK.ViewAnalysis.dll", "HOK.ViewAnalysis.Command"));
                pb24.LargeImage = LoadBitmapImage(assembly, "eq.ico");
                pb24.ToolTip    = "Calculating Area with Views for LEED IEQc 8.2";
                AddToolTips(pb24);
            }
            catch (Exception ex)
            {
                Log.AppendLog(LogMessageType.EXCEPTION, ex.Message);
            }
        }
Beispiel #8
0
        /// <summary>
        /// Creates a beta installed button.
        /// </summary>
        private void CreateInstallerPanel()
        {
            try
            {
                var installerPanel = m_app.CreateRibbonPanel(tabName, "Installer");

                var installerButton = (PushButton)installerPanel.AddItem(new PushButtonData("AddinInstallerCommand",
                                                                                            "Beta Addin" + Environment.NewLine + "Installer",
                                                                                            currentAssembly,
                                                                                            "HOK.BetaToolsManager.AddinInstallerCommand"));

                var assembly = Assembly.GetExecutingAssembly();
                installerButton.LargeImage            = ButtonUtil.LoadBitmapImage(assembly, typeof(AppCommand).Namespace, "betaPluginManager_32x32.png");
                installerButton.Image                 = installerButton.LargeImage;
                installerButton.ToolTip               = "HOK Beta Tools Installer";
                installerButton.AvailabilityClassName = "HOK.BetaToolsManager.Availability";
            }
            catch (Exception ex)
            {
                Log.AppendLog(LogMessageType.EXCEPTION, ex.Message);
            }
        }
Beispiel #9
0
        public Result OnStartup(UIControlledApplication application)
        {
            thisApp    = this;
            mainWindow = null;
            ctrApp     = application.ControlledApplication;

            try
            {
                application.CreateRibbonTab(tabName);
            }
            catch (Exception ex)
            {
                Log.AppendLog(LogMessageType.EXCEPTION, ex.Message);
            }

            var created = application.GetRibbonPanels(tabName).FirstOrDefault(x => x.Name == "Customizations");
            var panel   = created ?? application.CreateRibbonPanel(tabName, "Customizations");

            var currentAssembly = Assembly.GetAssembly(GetType());
            var moverImage      = ButtonUtil.LoadBitmapImage(currentAssembly, typeof(AppCommand).Namespace, "elementMover_32.png");

            var moverButton = (PushButton)panel.AddItem(new PushButtonData("ElementMoverCommand",
                                                                           "Element" + Environment.NewLine + "Mover",
                                                                           currentAssembly.Location,
                                                                           "HOK.ElementMover.MoverCommand"));

            moverButton.LargeImage = moverImage;

            const string instructionFile = @"V:\RVT-Data\HOK Program\Documentation\Element Mover_Instruction.pdf";

            if (File.Exists(instructionFile))
            {
                var contextualHelp = new ContextualHelp(ContextualHelpType.Url, instructionFile);
                moverButton.SetContextualHelp(contextualHelp);
            }

            ctrApp.DocumentChanged += CtrApp_DocumentChanged;
            return(Result.Succeeded);
        }
        /// <summary>
        /// Main method for loading and parsing of the beta/installed folders.
        /// </summary>
        private void LoadAddinsOnStartup()
        {
            var addins = File.Exists(InstallDirectory + "BetaSettings.json")
                ? DeserializeSetting(InstallDirectory + "BetaSettings.json")
                : null;

            var dic = new Dictionary <string, AddinWrapper>();

            // (Konrad) It's possible for user to be offline, and have no access to Beta HOK Drive.
            // In that case we still want to create addins, but instead use the Temp location on local drive.
            var betaTemp2 = Directory.Exists(BetaDirectory)
                ? BetaTempDirectory
                : Directory.Exists(TempDirectory)
                    ? TempDirectory
                    : string.Empty;

            if (betaTemp2 != string.Empty)
            {
                if (!Directory.Exists(TempDirectory))
                {
                    Directory.CreateDirectory(TempDirectory);
                }

                // (Konrad) Create a copy of all installed plugins by copying the temp dir from beta
                // We only do this if Beta is accessible otherwise we use local temp
                if (Directory.Exists(BetaDirectory))
                {
                    CopyAll(BetaTempDirectory, TempDirectory);
                }

                // (Konrad) We use the direcotry on the local drive that was already copied over to scan for addins.
                var availableAddins = Directory.GetFiles(betaTemp2, "*.addin");

                // Cleans any holdovers from old beta addins
                RemoveLegacyPlugins(availableAddins);

                // (Konrad) Get all addins from beta directory
                foreach (var file in availableAddins)
                {
                    var dllRelativePath = ParseXml(file); // relative to temp
                    var dllPath         = TempDirectory + dllRelativePath;
                    if (!File.Exists(dllPath))
                    {
                        continue;
                    }

                    // (Konrad) Using LoadFrom() instead of LoadFile() because
                    // LoadFile() doesn't load dependent assemblies causing exception later.
                    var    assembly = Assembly.LoadFrom(dllPath);
                    Type[] types;
                    try
                    {
                        types = assembly.GetTypes();
                    }
                    catch (ReflectionTypeLoadException e)
                    {
                        types = e.Types;
                    }
                    foreach (var t in types.Where(x => x != null &&
                                                  (x.GetInterface("IExternalCommand") != null ||
                                                   x.GetInterface("IExternalApplication") != null)))
                    {
                        MemberInfo info          = t;
                        var        nameAttr      = (NameAttribute)info.GetCustomAttributes(typeof(NameAttribute), true).FirstOrDefault();
                        var        descAttr      = (DescriptionAttribute)t.GetCustomAttributes(typeof(DescriptionAttribute), true).FirstOrDefault();
                        var        imageAttr     = (ImageAttribute)t.GetCustomAttributes(typeof(ImageAttribute), true).FirstOrDefault();
                        var        namespaceAttr = (NamespaceAttribute)t.GetCustomAttributes(typeof(NamespaceAttribute), true).FirstOrDefault();
                        var        panelNameAttr = (PanelNameAttribute)t.GetCustomAttributes(typeof(PanelNameAttribute), true).FirstOrDefault();

                        if (nameAttr == null || descAttr == null || imageAttr == null ||
                            namespaceAttr == null || panelNameAttr == null)
                        {
                            continue;
                        }

                        var bitmap =
                            (BitmapSource)ButtonUtil.LoadBitmapImage(assembly, namespaceAttr.Namespace,
                                                                     imageAttr.ImageName);
                        var version   = assembly.GetName().Version.ToString();
                        var installed = false;
                        var addin     = addins?.FirstOrDefault(x => x.DllRelativePath == dllRelativePath);
                        if (addin != null)
                        {
                            installed = addin.IsInstalled;

                            if (installed)
                            {
                                // if directory doesn't exist in "installed" it means that it was not yet installed before.
                                if (!Directory.Exists(
                                        InstallDirectory + new DirectoryInfo(addin.BetaResourcesPath).Name))
                                {
                                    Directory.CreateDirectory(
                                        InstallDirectory + new DirectoryInfo(addin.BetaResourcesPath).Name);
                                    CopyAll(betaTemp2 + new DirectoryInfo(addin.BetaResourcesPath).Name,
                                            InstallDirectory + new DirectoryInfo(addin.BetaResourcesPath).Name);
                                }
                                else
                                {
                                    // directory exists, which means it was installed before
                                    // let's automatically copy the latest version in
                                    // we can use temp directory here since it was already either updated with latest
                                    // or is the only source of files (no network drive)
                                    CopyAll(TempDirectory + new DirectoryInfo(addin.BetaResourcesPath).Name,
                                            InstallDirectory + new DirectoryInfo(addin.BetaResourcesPath).Name);
                                }
                            }
                        }

                        var aw = new AddinWrapper
                        {
                            Name              = nameAttr.Name,
                            Description       = descAttr.Description,
                            Image             = bitmap,
                            ImageName         = imageAttr.ImageName,
                            CommandNamespace  = t.FullName,
                            Version           = version,
                            IsInstalled       = installed,
                            InstalledVersion  = version,
                            BetaResourcesPath = Path.GetDirectoryName(dllPath),
                            AddinFilePath     = file,
                            DllRelativePath   = dllRelativePath,
                            AutoUpdate        = true,
                            Panel             = panelNameAttr.PanelName
                        };

                        if (t.GetInterface("IExternalCommand") != null)
                        {
                            var buttonTextAttr =
                                (ButtonTextAttribute)t.GetCustomAttributes(typeof(ButtonTextAttribute), true)
                                .FirstOrDefault();

                            aw.ButtonText = buttonTextAttr?.ButtonText;
                        }
                        else
                        {
                            var additionalButtonNamesAttr = (AdditionalButtonNamesAttribute)t
                                                            .GetCustomAttributes(typeof(AdditionalButtonNamesAttribute), true)
                                                            .FirstOrDefault();

                            aw.AdditionalButtonNames = additionalButtonNamesAttr?.AdditionalNames;
                        }

                        dic.Add(aw.Name, aw);
                    }
                }
            }
            var output = new ObservableCollection <AddinWrapper>(dic.Values.ToList().OrderBy(x => x.Name));

            Addins = output;
        }
Beispiel #11
0
        private void CreateCustomPushButtons()
        {
            try
            {
                var fileExist = false;
                var created   = m_app.GetRibbonPanels(tabName).FirstOrDefault(x => x.Name == "Customizations");
                var hokPanel  = created ?? m_app.CreateRibbonPanel(tabName, "Customizations");

                if (File.Exists(currentDirectory + "/HOK.SheetManager.dll"))
                {
                    var pb6 = (PushButton)hokPanel.AddItem(new PushButtonData("Sheet Manager", "Sheet" + Environment.NewLine + " Manager", currentDirectory + "/HOK.SheetManager.dll", "HOK.SheetManager.cmdSheetManager"));
                    pb6.LargeImage = ButtonUtil.LoadBitmapImage(assembly, typeof(AppCommand).Namespace, "sheetManager_32.png");
                    pb6.ToolTip    = "Sheet Manager";
                    AddToolTips(pb6);
                    fileExist = true;
                }

                if (File.Exists(currentDirectory + "/HOK.ElementFlatter.dll"))
                {
                    var efAssemblyPath = currentDirectory + "/HOK.ElementFlatter.dll";
                    var pbFlatter      = (PushButton)hokPanel.AddItem(new PushButtonData("FlattenCommand", "Flatten" + Environment.NewLine + "Model", efAssemblyPath, "HOK.ElementFlatter.Command"));
                    pbFlatter.ToolTip = "Element Flatter";
                    var efAssembly = Assembly.LoadFrom(efAssemblyPath);
                    pbFlatter.LargeImage = ButtonUtil.LoadBitmapImage(efAssembly, "HOK.ElementFlatter", "elementFlattener_32.png");
                    AddToolTips(pbFlatter);
                    fileExist = true;
                }

                //if (File.Exists(currentDirectory + "/HOK.ModelManager.dll"))
                //{
                //    var splitButtonData = new SplitButtonData("ModelManager", "Model Manager");
                //    var splitButton = (SplitButton)hokPanel.AddItem(splitButtonData);
                //    var contextualHelp = new ContextualHelp(ContextualHelpType.Url, @"V:\RVT-Data\HOK Program\Documentation\ModelManager_Instruction.pdf");
                //    splitButton.SetContextualHelp(contextualHelp);

                //    var pb16 = splitButton.AddPushButton(new PushButtonData("Project Replication", "Project Replication", currentDirectory + "/HOK.ModelManager.dll", "HOK.ModelManager.ProjectCommand"));
                //    pb16.LargeImage = LoadBitmapImage(assembly, "project.png");
                //    pb16.ToolTip = "Model Manager - Project Replication";
                //    AddToolTips(pb16);
                //    hokPanel.AddSeparator();
                //    fileExist = true;
                //}

                if (File.Exists(currentDirectory + "/HOK.RoomsToMass.dll"))
                {
                    var splitButtonData = new SplitButtonData("MassTool", "3D Mass");
                    var splitButton     = (SplitButton)hokPanel.AddItem(splitButtonData);
                    splitButton.IsSynchronizedWithCurrentItem = true;
                    var contextualHelp = new ContextualHelp(ContextualHelpType.Url, @"V:\RVT-Data\HOK Program\Documentation\Mass Tool_Instruction.pdf");
                    splitButton.SetContextualHelp(contextualHelp);

                    var pb8 = splitButton.AddPushButton(new PushButtonData("Create Mass", "Create Mass", currentDirectory + "/HOK.RoomsToMass.dll", "HOK.RoomsToMass.Command"));
                    pb8.LargeImage   = ButtonUtil.LoadBitmapImage(assembly, typeof(AppCommand).Namespace, "createMass_32.png");
                    pb8.ToolTip      = "Creates 3D Mass from rooms, areas and floors.";
                    pb8.ToolTipImage = LoadBitmapImage(assembly, "tooltip.png");
                    AddToolTips(pb8);

                    var pb10 = splitButton.AddPushButton(new PushButtonData("Mass Commands", "Mass Commands", currentDirectory + "/HOK.RoomsToMass.dll", "HOK.RoomsToMass.AssignerCommand"));
                    pb10.LargeImage = ButtonUtil.LoadBitmapImage(assembly, typeof(AppCommand).Namespace, "massCommands_32.png");
                    pb10.ToolTip    = "Assign parameters or split elements";
                    AddToolTips(pb10);
                    fileExist = true;
                }

                if (!fileExist)
                {
                    hokPanel.Visible = false;
                }
            }
            catch (Exception ex)
            {
                Log.AppendLog(LogMessageType.EXCEPTION, ex.Message);
            }
        }
Beispiel #12
0
        /// <summary>
        /// Creates all of the Utilities buttons.
        /// </summary>
        private void CreateHOKPushButtons()
        {
            try
            {
                var utilityExist = false;
                var utilPanel    = m_app.CreateRibbonPanel(tabName, "Utilities");

                if (File.Exists(currentDirectory + "/HOK.ElementTools.dll") || File.Exists(currentDirectory + "/HOK.ParameterTools.dll"))
                {
                    var splitButtonData = new SplitButtonData("HOKUtilities", "HOK Utilities");
                    var splitButton     = (SplitButton)utilPanel.AddItem(splitButtonData);
                    var contextualHelp  = new ContextualHelp(ContextualHelpType.Url, @"V:\RVT-Data\HOK Program\Documentation\HOK Utilities_Instruction.pdf");
                    splitButton.SetContextualHelp(contextualHelp);

                    if (File.Exists(currentDirectory + "/HOK.ElementTools.dll"))
                    {
                        var pb1 = splitButton.AddPushButton(new PushButtonData("Element Tools", "Element Tools", currentDirectory + "/HOK.ElementTools.dll", "HOK.ElementTools.cmdElementTools"));
                        //pb1.LargeImage = LoadBitmapImage(assembly, "element.ico");
                        pb1.LargeImage = ButtonUtil.LoadBitmapImage(assembly, typeof(AppCommand).Namespace, "element.ico");
                        pb1.ToolTip    = "Room and Area Elements Tools";
                        AddToolTips(pb1);
                        utilityExist = true;
                    }

                    if (File.Exists(currentDirectory + "/HOK.ParameterTools.dll"))
                    {
                        var pb2 = splitButton.AddPushButton(new PushButtonData("Parameter Tools", "Parameter Tools", currentDirectory + "/HOK.ParameterTools.dll", "HOK.ParameterTools.cmdParameterTools"));
                        pb2.LargeImage = ButtonUtil.LoadBitmapImage(assembly, typeof(AppCommand).Namespace, "parameter.ico");
                        pb2.ToolTip    = "Parameter Tools";
                        AddToolTips(pb2);
                        utilityExist = true;
                    }

                    if (File.Exists(currentDirectory + "/HOK.FinishCreator.dll"))
                    {
                        var pb3 = splitButton.AddPushButton(new PushButtonData("Finish Creator", "Finish Creator", currentDirectory + "/HOK.FinishCreator.dll", "HOK.FinishCreator.FinishCommand"));
                        pb3.LargeImage = ButtonUtil.LoadBitmapImage(assembly, typeof(AppCommand).Namespace, "finish.png");
                        pb3.ToolTip    = "Create floor finishes from the selected rooms.";
                        AddToolTips(pb3);
                        utilityExist = true;
                    }

                    if (File.Exists(currentDirectory + "/HOK.CeilingHeight.dll"))
                    {
                        var pb4 = splitButton.AddPushButton(new PushButtonData("Ceiling Height", "Ceiling Heights", currentDirectory + "/HOK.CeilingHeight.dll", "HOK.CeilingHeight.CeilingCommand"));
                        pb4.LargeImage = ButtonUtil.LoadBitmapImage(assembly, typeof(AppCommand).Namespace, "height.png");
                        pb4.ToolTip    = "Select rooms to measure the height from floors to ceilings.";
                        AddToolTips(pb4);
                        utilityExist = true;
                    }

                    if (File.Exists(currentDirectory + "/HOK.LevelManager.dll"))
                    {
                        var pb5 = splitButton.AddPushButton(new PushButtonData("Level Manager", "Level Manager", currentDirectory + "/HOK.LevelManager.dll", "HOK.LevelManager.LevelCommand"));
                        pb5.LargeImage = ButtonUtil.LoadBitmapImage(assembly, typeof(AppCommand).Namespace, "level.png");
                        pb5.ToolTip    = "Rehost elements from one level to anather. ";
                        AddToolTips(pb5);
                        utilityExist = true;
                    }

                    if (File.Exists(currentDirectory + "/HOK.ViewDepth.dll"))
                    {
                        var pb18 = splitButton.AddPushButton(new PushButtonData("View Depth", "View Depth", currentDirectory + "/HOK.ViewDepth.dll", "HOK.ViewDepth.ViewCommand"));
                        pb18.LargeImage   = ButtonUtil.LoadBitmapImage(assembly, typeof(AppCommand).Namespace, "camera.ico");
                        pb18.ToolTip      = "Override the graphics of the element based on the distance";
                        pb18.ToolTipImage = LoadBitmapImage(assembly, "viewTooltip.png");
                        AddToolTips(pb18);
                        utilityExist = true;
                    }

                    if (File.Exists(currentDirectory + "/HOK.Arrowhead.dll"))
                    {
                        var pb19 = splitButton.AddPushButton(new PushButtonData("Leader Arrowhead", "Leader Arrowhead", currentDirectory + "/HOK.Arrowhead.dll", "HOK.Arrowhead.ArrowCommand"));
                        pb19.LargeImage = ButtonUtil.LoadBitmapImage(assembly, typeof(AppCommand).Namespace, "arrowhead_32.png");
                        pb19.ToolTip    = "Assign a leader arrowhead style to all tag types.";
                        AddToolTips(pb19);
                        utilityExist = true;
                    }

                    if (File.Exists(currentDirectory + "/HOK.WorksetView.dll"))
                    {
                        var pb19 = splitButton.AddPushButton(new PushButtonData("View Creator", "View Creator", currentDirectory + "/HOK.WorksetView.dll", "HOK.WorksetView.WorksetCommand"));
                        pb19.LargeImage = ButtonUtil.LoadBitmapImage(assembly, typeof(AppCommand).Namespace, "workset.png");
                        pb19.ToolTip    = "Create 3D Views for each workset.";
                        AddToolTips(pb19);
                        utilityExist = true;
                    }

                    if (File.Exists(currentDirectory + "/HOK.DoorRoom.dll"))
                    {
                        var pb21 = splitButton.AddPushButton(new PushButtonData("Door Link", "Door Link", currentDirectory + "/HOK.DoorRoom.dll", "HOK.DoorRoom.DoorCommand"));
                        pb21.LargeImage = ButtonUtil.LoadBitmapImage(assembly, typeof(AppCommand).Namespace, "doorTool_32.png");
                        pb21.ToolTip    = "Set shared parameters with To and From room data.";
                        AddToolTips(pb21);
                        utilityExist = true;
                    }

                    if (File.Exists(currentDirectory + "/HOK.RoomUpdater.dll"))
                    {
                        var pb22 = splitButton.AddPushButton(new PushButtonData("Room Updater", "Room Updater", currentDirectory + "/HOK.RoomUpdater.dll", "HOK.RoomUpdater.RoomCommand"));
                        pb22.LargeImage = ButtonUtil.LoadBitmapImage(assembly, typeof(AppCommand).Namespace, "container.png");
                        pb22.ToolTip    = "Populate room parameters values into enclosed elements.";
                        AddToolTips(pb22);
                        utilityExist = true;
                    }

                    if (File.Exists(currentDirectory + "/HOK.RoomElevation.dll"))
                    {
                        var pb23 = splitButton.AddPushButton(new PushButtonData("Room Elevation", "Room Elevation", currentDirectory + "/HOK.RoomElevation.dll", "HOK.RoomElevation.ElevationCommand"));
                        pb23.LargeImage = ButtonUtil.LoadBitmapImage(assembly, typeof(AppCommand).Namespace, "elevation.png");
                        pb23.ToolTip    = "Create elevation views by selecting rooms and walls to be faced.";
                        AddToolTips(pb23);
                        utilityExist = true;
                    }

                    if (File.Exists(currentDirectory + "/HOK.CameraDuplicator.dll"))
                    {
                        var pb25 = splitButton.AddPushButton(new PushButtonData("View Mover", "View Mover", currentDirectory + "/HOK.CameraDuplicator.dll", "HOK.CameraDuplicator.CameraCommand"));
                        pb25.LargeImage = ButtonUtil.LoadBitmapImage(assembly, typeof(AppCommand).Namespace, "cameraview.png");
                        pb25.ToolTip    = "Duplicate camera views of plan views from one project to the other.";
                        AddToolTips(pb25);
                        utilityExist = true;
                    }

                    if (File.Exists(currentDirectory + "/HOK.RenameFamily.dll"))
                    {
                        var pb26 = splitButton.AddPushButton(new PushButtonData("Rename Family", "Rename Family", currentDirectory + "/HOK.RenameFamily.dll", "HOK.RenameFamily.RenameCommand"));
                        pb26.LargeImage = ButtonUtil.LoadBitmapImage(assembly, typeof(AppCommand).Namespace, "update.png");
                        pb26.ToolTip    = "Rename families and types as assigned in .csv file.";
                        AddToolTips(pb26);
                        utilityExist = true;
                    }

                    if (File.Exists(currentDirectory + "/HOK.XYZLocator.dll"))
                    {
                        var pb27 = splitButton.AddPushButton(new PushButtonData("XYZ Locator", "XYZ Locator", currentDirectory + "/HOK.XYZLocator.dll", "HOK.XYZLocator.XYZCommand"));
                        pb27.LargeImage = ButtonUtil.LoadBitmapImage(assembly, typeof(AppCommand).Namespace, "location.ico");
                        pb27.ToolTip    = "Report location of a 3D family using shared coordinates";
                        AddToolTips(pb27);
                        utilityExist = true;
                    }

                    if (File.Exists(currentDirectory + "/HOK.RoomMeasure.dll"))
                    {
                        var pb28 = splitButton.AddPushButton(new PushButtonData("Room W X L", "Room W X L", currentDirectory + "/HOK.RoomMeasure.dll", "HOK.RoomMeasure.MeasureCommand"));
                        pb28.LargeImage = ButtonUtil.LoadBitmapImage(assembly, typeof(AppCommand).Namespace, "kruler.png");
                        pb28.ToolTip    = "Measuring the width and length of all rooms in the project";
                        AddToolTips(pb28);
                        utilityExist = true;
                    }
                }
                if (!utilityExist)
                {
                    utilPanel.Visible = false;
                }
            }
            catch (Exception ex)
            {
                Log.AppendLog(LogMessageType.EXCEPTION, ex.Message);
            }
        }