Beispiel #1
0
        public void SetSplitButtonToThisOrTop(string _bName, SplitButton _splitButton)
        {
            IList <PushButton> sbList = _splitButton.GetItems();

            foreach (PushButton pb in sbList)
            {
                if (pb.Name.Equals(_bName))
                {
                    _splitButton.CurrentButton = pb;
                    return;
                }
            }
            _splitButton.CurrentButton = sbList[0];
        }
        public Result OnStartup(UIControlledApplication application)
        {
            uiApplication = application;
            // now we have a default path, but let's look at
            // the load path file to see what was last selected
            var cachedPath   = String.Empty;
            var revitVersion = application.ControlledApplication.VersionNumber;
            var fileLoc      = Utils.GetVersionSaveFileLocation(revitVersion);

            if (File.Exists(fileLoc))
            {
                using (var sr = new StreamReader(fileLoc))
                {
                    cachedPath = sr.ReadToEnd().TrimEnd('\r', '\n');
                }
            }

            var revitFolder =
                new DirectoryInfo(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));

            var debugPath      = revitFolder.Parent.FullName;
            var dynamoProducts = FindDynamoInstallations(debugPath);

            Products = new List <DynamoProduct>();
            int index = -1;

            foreach (var p in dynamoProducts)
            {
                var path = VersionLoader.GetDynamoRevitPath(p, revitVersion);
                if (!File.Exists(path))
                {
                    continue;
                }

                if (path.Equals(cachedPath))
                {
                    index = Products.Count;
                }

                Products.Add(p);
            }

            // If there are multiple versions installed, then create
            // a couple of push buttons in a panel to allow selection of a version.
            // If only one version is installed, no multi-selection is required.
            if (Products.Count > 1)
            {
                RibbonPanel ribbonPanel = application.CreateRibbonPanel(Resources.DynamoVersions);

                splitButton = AddSplitButtonGroup(ribbonPanel);

                if (index != -1)
                {
                    splitButton.CurrentButton = splitButton.GetItems().ElementAt(index);
                }
            }

            string loadPath = GetDynamoRevitPath(Products.Last(), revitVersion);

            if (File.Exists(cachedPath))
            {
                loadPath = cachedPath;
            }

            if (String.IsNullOrEmpty(loadPath))
            {
                return(Result.Failed);
            }

            if (Products.Count == 1) //If only one product is installed load the Revit App directly
            {
                var ass      = Assembly.LoadFrom(loadPath);
                var revitApp = ass.CreateInstance("Dynamo.Applications.DynamoRevitApp");
                revitApp.GetType().GetMethod("OnStartup").Invoke(revitApp, new object[] { application });
            }

            return(Result.Succeeded);
        }
Beispiel #3
0
        /// <summary>
        /// Reset the top button to be the current one.
        /// Alternative solution:
        /// set RibbonItem.IsSynchronizedWithCurrentItem
        /// to false after creating the SplitButton.
        /// </summary>
        public void SetTopButtonCurrent()
        {
            IList <PushButton> sbList = _split_button.GetItems();

            _split_button.CurrentButton = sbList[0];
        }
Beispiel #4
0
        public void SetSplitButtonToTop()
        {
            IList <PushButton> sbList = sb_MU.GetItems();

            sb_MU.CurrentButton = sbList[0];
        }
        public Result OnStartup(UIControlledApplication application)
        {
            uiApplication = application;
            var revitVersion = application.ControlledApplication.VersionNumber;
            //Get the default selection data
            var selectorData = VersionSelectorData.ReadFromRegistry(revitVersion);

            var revitFolder =
                new DirectoryInfo(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));

            var debugPath      = revitFolder.Parent.FullName;
            var dynamoProducts = FindDynamoRevitInstallations(debugPath, revitVersion);

            Products = new List <DynamoProduct>();
            int index           = -1;
            var selectedVersion = selectorData.SelectedVersion.ToString(2);

            foreach (var p in dynamoProducts)
            {
                var path = VersionLoader.GetDynamoRevitPath(p, revitVersion);
                if (!File.Exists(path))
                {
                    continue;
                }

                if (p.VersionInfo.ToString(2) == selectedVersion)
                {
                    index = Products.Count;
                }

                Products.Add(p);
            }

            if (index == -1)
            {
                index = Products.Count - 1;
            }

            // If there are multiple versions installed, then create
            // a couple of push buttons in a panel to allow selection of a version.
            // If only one version is installed, no multi-selection is required.
            if (Products.Count > 1)
            {
                ribbonPanel = application.CreateRibbonPanel(Resources.DynamoVersions);

                splitButton = AddSplitButtonGroup(ribbonPanel);

                if (index != -1)
                {
                    splitButton.CurrentButton = splitButton.GetItems().ElementAt(index);
                }
            }

            string loadPath = GetDynamoRevitPath(Products.ElementAt(index), revitVersion);

            if (String.IsNullOrEmpty(loadPath))
            {
                return(Result.Failed);
            }

            if (Products.Count == 1) //If only one product is installed load the Revit App directly
            {
                var ass      = Assembly.LoadFrom(loadPath);
                var revitApp = ass.CreateInstance("Dynamo.Applications.DynamoRevitApp");
                revitApp.GetType().GetMethod("OnStartup").Invoke(revitApp, new object[] { application });
            }

            return(Result.Succeeded);
        }
Beispiel #6
0
        private void CreateONBOXRibbon(UIControlledApplication application)
        {
            string dll = System.Reflection.Assembly.GetExecutingAssembly().Location;

            string ribbonONBOX = "Onbox App";

            application.CreateRibbonTab(ribbonONBOX);

            IList <RibbonPanel> allProjectPanels = new List <RibbonPanel>();
            IList <RibbonPanel> allFreePanels    = new List <RibbonPanel>();

            RibbonPanel panelRenumber          = application.CreateRibbonPanel(ribbonONBOX, Properties.RibbonLanguage.RenumberElements_Title);
            RibbonPanel panelStructuralMembers = application.CreateRibbonPanel(ribbonONBOX, Properties.RibbonLanguage.StructuralElements_Title);
            RibbonPanel panelModifyElem        = application.CreateRibbonPanel(ribbonONBOX, Properties.RibbonLanguage.ModifyElements_Title);
            RibbonPanel panelTopo          = application.CreateRibbonPanel(ribbonONBOX, Properties.RibbonLanguage.Topography_Title);
            RibbonPanel panelManage        = application.CreateRibbonPanel(ribbonONBOX, Properties.RibbonLanguage.Manage_Title);
            RibbonPanel panelAbout         = application.CreateRibbonPanel(ribbonONBOX, Properties.RibbonLanguage.MoreInfo_Title);
            RibbonPanel panelNotifications = null;

            allProjectPanels.Add(panelRenumber);
            allProjectPanels.Add(panelStructuralMembers);
            allProjectPanels.Add(panelModifyElem);
            allProjectPanels.Add(panelTopo);
            allProjectPanels.Add(panelManage);
            allFreePanels.Add(panelAbout);
            allFreePanels.Add(panelNotifications);

            PushButton btnRenumberGrids = panelRenumber.AddItem(new PushButtonData(Properties.RibbonLanguage.RenumberElements_Grids, Properties.RibbonLanguage.RenumberElements_Grids.Replace("\\n", "\n"), dll, "ONBOXAppl.RenumberGridsAdvanced")) as PushButton;

            btnRenumberGrids.SetContextualHelp(new ContextualHelp(ContextualHelpType.Url, Properties.HelpLinks.btnRenumberGrids));
            SplitButton sptRenumberParking = panelRenumber.AddItem(new SplitButtonData(Properties.RibbonLanguage.RenumberElements_RenumberParkingSpaces, Properties.RibbonLanguage.RenumberElements_RenumberParkingSpaces)) as SplitButton;

            sptRenumberParking.SetContextualHelp(new ContextualHelp(ContextualHelpType.Url, Properties.HelpLinks.sptRenumberParking));
            PushButton btnRenumberBeams = panelRenumber.AddItem(new PushButtonData(Properties.RibbonLanguage.RenumberElements_RenumberBeams, Properties.RibbonLanguage.RenumberElements_RenumberBeams.Replace("\\n", "\n"), dll, "ONBOXAppl.RenumberBeams")) as PushButton;

            btnRenumberBeams.SetContextualHelp(new ContextualHelp(ContextualHelpType.Url, Properties.HelpLinks.btnRenumberBeams));
            SplitButton sptRenumberColumns = panelRenumber.AddItem(new SplitButtonData(Properties.RibbonLanguage.RenumberElements_RenumberColumns, Properties.RibbonLanguage.RenumberElements_RenumberColumns)) as SplitButton;

            sptRenumberColumns.SetContextualHelp(new ContextualHelp(ContextualHelpType.Url, Properties.HelpLinks.sptRenumberColumns));
            SplitButton sptJoinElements = panelModifyElem.AddItem(new SplitButtonData(Properties.RibbonLanguage.ModifyElements_JoinMultipleElements, Properties.RibbonLanguage.ModifyElements_JoinMultipleElements)) as SplitButton;

            sptJoinElements.SetContextualHelp(new ContextualHelp(ContextualHelpType.Url, Properties.HelpLinks.sptJoinElements));

            PushButton btnCreateBeamsFromBuilding = panelStructuralMembers.AddItem(new PushButtonData(Properties.RibbonLanguage.StructuralElements_BeamsForBuilding, Properties.RibbonLanguage.StructuralElements_BeamsForBuilding.Replace("\\n", "\n"), dll, "ONBOXAppl.BeamsFromEntireBuilding")) as PushButton;

            btnCreateBeamsFromBuilding.SetContextualHelp(new ContextualHelp(ContextualHelpType.Url, Properties.HelpLinks.btnCreateBeamsFromBuilding));
            PushButton btnCreateBeam = panelStructuralMembers.AddItem(new PushButtonData(Properties.RibbonLanguage.StructuralElements_BeamsFromWalls, Properties.RibbonLanguage.StructuralElements_BeamsFromWalls.Replace("\\n", "\n"), dll, "ONBOXAppl.BeamsFromWalls")) as PushButton;

            btnCreateBeam.SetContextualHelp(new ContextualHelp(ContextualHelpType.Url, Properties.HelpLinks.btnCreateBeam));
            PushButton btnCreateBeamsFromColumns = panelStructuralMembers.AddItem(new PushButtonData(Properties.RibbonLanguage.StructuralElements_BeamsFromColumns, Properties.RibbonLanguage.StructuralElements_BeamsFromColumns.Replace("\\n", "\n"), dll, "ONBOXAppl.BeamsFromColumns")) as PushButton;

            btnCreateBeamsFromColumns.SetContextualHelp(new ContextualHelp(ContextualHelpType.Url, Properties.HelpLinks.btnCreateBeamsFromColumns));
            PushButton btnCreateColumnsFromDwg = panelStructuralMembers.AddItem(new PushButtonData(Properties.RibbonLanguage.StructuralElements_ColumnsFromCAD, Properties.RibbonLanguage.StructuralElements_ColumnsFromCAD.Replace("\\n", "\n"), dll, "ONBOXAppl.ColumnsFromDwg")) as PushButton;

            btnCreateColumnsFromDwg.SetContextualHelp(new ContextualHelp(ContextualHelpType.Url, Properties.HelpLinks.btnCreateColumnsFromDwg));

            //PushButton btnCreateBeamsUpdate = panelModifyElem.AddItem(new PushButtonData("  Atualizar \n vigas  ", "  Atualizar \n vigas  ", dll, "ONBOXAppl.BeamUpdate")) as PushButton;
            PushButton btnElementsCopyLevel = panelModifyElem.AddItem(new PushButtonData(Properties.RibbonLanguage.ModifyElements_CopyBeamsToLevels, Properties.RibbonLanguage.ModifyElements_CopyBeamsToLevels.Replace("\\n", "\n"), dll, "ONBOXAppl.ElementsCopyToLevels")) as PushButton;

            btnElementsCopyLevel.SetContextualHelp(new ContextualHelp(ContextualHelpType.Url, Properties.HelpLinks.btnElementsCopyLevel));
            PushButton btnElmentsJoin = sptJoinElements.AddPushButton(new PushButtonData(Properties.RibbonLanguage.ModifyElements_JoinElements, Properties.RibbonLanguage.ModifyElements_JoinElements.Replace("\\n", "\n"), dll, "ONBOXAppl.ElementsJoinAdvanced")) as PushButton;

            btnElmentsJoin.SetContextualHelp(new ContextualHelp(ContextualHelpType.Url, Properties.HelpLinks.btnElmentsJoin));
            PushButton btnElmentsSelectJoin = sptJoinElements.AddPushButton(new PushButtonData(Properties.RibbonLanguage.ModifyElements_SelectElementsToJoin, Properties.RibbonLanguage.ModifyElements_SelectElementsToJoin.Replace("\\n", "\n"), dll, "ONBOXAppl.ElementJoinSelect")) as PushButton;

            btnElmentsSelectJoin.SetContextualHelp(new ContextualHelp(ContextualHelpType.Url, Properties.HelpLinks.btnElmentsSelectJoin));

            PushButton btnCreateTopoFromPointCloud = panelTopo.AddItem(new PushButtonData(Properties.RibbonLanguage.Topography_SurfaceByPointCloud, Properties.RibbonLanguage.Topography_SurfaceByPointCloud.Replace("\\n", "\n"), dll, "ONBOXAppl.TopoFromPointCloudAdvanced")) as PushButton;

            btnCreateTopoFromPointCloud.SetContextualHelp(new ContextualHelp(ContextualHelpType.Url, Properties.HelpLinks.btnCreateTopoFromPointCloud));
            //PushButton btnCreateTopoFromDwgMarks = panelTopo.AddItem(new PushButtonData("  Topografia por CAD planimétrico  ", "  Topografia por \n  planimetria  ", dll, "ONBOXAppl.TopoFromDwgMarks")) as PushButton;
            PushButton btnTopoSlope = panelTopo.AddItem(new PushButtonData(Properties.RibbonLanguage.Topography_SlopeByPads, Properties.RibbonLanguage.Topography_SlopeByPads.Replace("\\n", "\n"), dll, "ONBOXAppl.TopoSlopes")) as PushButton;

            btnTopoSlope.SetContextualHelp(new ContextualHelp(ContextualHelpType.Url, Properties.HelpLinks.btnTopoSlope));

            PushButton btnRevitZip = panelManage.AddItem(new PushButtonData(Properties.RibbonLanguage.Manage_PackageProject, Properties.RibbonLanguage.Manage_PackageProject.Replace("\\n", "\n"), dll, "ONBOXAppl.RevitZip")) as PushButton;

            btnRevitZip.SetContextualHelp(new ContextualHelp(ContextualHelpType.Url, Properties.HelpLinks.btnRevitZip));

            PushButton btnONBOXSite = panelAbout.AddItem(new PushButtonData("  Onbox  ", "  Onbox  ", dll, "ONBOXAppl.SiteONBOX")) as PushButton;
            //PushButton btnProjectExamplesFolder = panelAbout.AddItem(new PushButtonData(Properties.RibbonLanguage.About_SampleProjects, Properties.RibbonLanguage.About_SampleProjects.Replace("\\n", "\n"), dll, "ONBOXAppl.ProjectFolder")) as PushButton;
            PushButton btnInfo    = panelAbout.AddItem(new PushButtonData(Properties.RibbonLanguage.About_Title, Properties.RibbonLanguage.About_Title, dll, "ONBOXAppl.AboutONBOXApp")) as PushButton;
            PushButton btnPrivacy = panelAbout.AddItem(new PushButtonData(Properties.RibbonLanguage.About_Privacy, Properties.RibbonLanguage.About_Privacy, dll, "ONBOXAppl.Privacy")) as PushButton;

            //SplitButtons for Parking
            PushButton btnRenumberParking = sptRenumberParking.AddPushButton(new PushButtonData(Properties.RibbonLanguage.RenumberElements_ParkingSpaces, Properties.RibbonLanguage.RenumberElements_ParkingSpaces.Replace("\\n", "\n"), dll, "ONBOXAppl.RenumberParking")) as PushButton;

            btnRenumberParking.SetContextualHelp(new ContextualHelp(ContextualHelpType.Url, Properties.HelpLinks.btnRenumberParking));
            PushButton btnRenumberBlockParking = sptRenumberParking.AddPushButton(new PushButtonData(Properties.RibbonLanguage.RenumberElements_NearestSpaces, Properties.RibbonLanguage.RenumberElements_NearestSpaces.Replace("\\n", "\n"), dll, "ONBOXAppl.RenumberBlockParking")) as PushButton;

            btnRenumberBlockParking.SetContextualHelp(new ContextualHelp(ContextualHelpType.Url, Properties.HelpLinks.btnRenumberBlockParking));
            PushButton btnRenumberClearParking = sptRenumberParking.AddPushButton(new PushButtonData(Properties.RibbonLanguage.RenumberElements_ClearParkingNumbering, Properties.RibbonLanguage.RenumberElements_ClearParkingNumbering.Replace("\\n", "\n"), dll, "ONBOXAppl.RenumberCleaner")) as PushButton;

            btnRenumberClearParking.SetContextualHelp(new ContextualHelp(ContextualHelpType.Url, Properties.HelpLinks.btnRenumberClearParking));
            //SplitButtons for Columns
            PushButton btnRenumberColumns = sptRenumberColumns.AddPushButton(new PushButtonData(Properties.RibbonLanguage.RenumberElements_Columns, Properties.RibbonLanguage.RenumberElements_Columns.Replace("\\n", "\n"), dll, "ONBOXAppl.RenumberColumns")) as PushButton;

            btnRenumberColumns.SetContextualHelp(new ContextualHelp(ContextualHelpType.Url, Properties.HelpLinks.btnRenumberColumns));
            PushButton btnRenumberColumnsSelect = sptRenumberColumns.AddPushButton(new PushButtonData(Properties.RibbonLanguage.RenumberElements_SelectColumns, Properties.RibbonLanguage.RenumberElements_SelectColumns.Replace("\\n", "\n"), dll, "ONBOXAppl.RenumberColumnsSelection")) as PushButton;

            btnRenumberColumnsSelect.SetContextualHelp(new ContextualHelp(ContextualHelpType.Url, Properties.HelpLinks.btnRenumberColumnsSelect));

            BitmapImage grid32                   = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnRenumberGrid32.png", UriKind.Absolute));
            BitmapImage grid16                   = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnRenumberGrid16.png", UriKind.Absolute));
            BitmapImage parking32                = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnRenumberParking32.png", UriKind.Absolute));
            BitmapImage parking16                = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnRenumberParking16.png", UriKind.Absolute));
            BitmapImage parkingDelete16          = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnRenumberDeleteParking16.png", UriKind.Absolute));
            BitmapImage parkingDelete32          = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnRenumberDeleteParking32.png", UriKind.Absolute));
            BitmapImage parkingBlock16           = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnRenumberBlockParking16.png", UriKind.Absolute));
            BitmapImage parkingBlock32           = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnRenumberBlockParking32.png", UriKind.Absolute));
            BitmapImage beams32                  = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnRenumberBeams32.png", UriKind.Absolute));
            BitmapImage beams16                  = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnRenumberBeams16.png", UriKind.Absolute));
            BitmapImage Column16                 = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnRenumberColumns16.png", UriKind.Absolute));
            BitmapImage Column32                 = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnRenameColumns32.png", UriKind.Absolute));
            BitmapImage Column16Select           = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnRenameColumns16.png", UriKind.Absolute));
            BitmapImage Column32Select           = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnRenameColumns32Select.png", UriKind.Absolute));
            BitmapImage BeamsFromBuilding16      = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnBeamsFromBuilding16.png", UriKind.Absolute));
            BitmapImage BeamsFromBuilding32      = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnBeamsFromBuilding32.png", UriKind.Absolute));
            BitmapImage createBeam16             = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnWallsToBeams16.png", UriKind.Absolute));
            BitmapImage createBeam32             = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnWallsToBeamsCreate32.png", UriKind.Absolute));
            BitmapImage createUpdate32           = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnWallsToBeamsUpdate32.png", UriKind.Absolute));
            BitmapImage createBeamsFromColumns16 = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnColumnsToBeams16.png", UriKind.Absolute));
            BitmapImage createBeamsFromColumns32 = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnColumnsToBeams32.png", UriKind.Absolute));
            BitmapImage ColumnsFromDwg16         = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnColumnsFromDWG16.png", UriKind.Absolute));
            BitmapImage ColumnsFromDwg32         = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnColumnsFromDWG32.png", UriKind.Absolute));
            BitmapImage ElementsCopy16           = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnBeamsCopyLevels16.png", UriKind.Absolute));
            BitmapImage ElementsCopy32           = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnBeamsCopyLevels.png", UriKind.Absolute));
            BitmapImage ElementsJoin16           = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnJoinMultiple16.png", UriKind.Absolute));
            BitmapImage ElementsJoin32           = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnJoinMultiple.png", UriKind.Absolute));
            BitmapImage ElementsSelectJoin16     = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnJoinSelectMultiple16.png", UriKind.Absolute));
            BitmapImage ElementsSelectJoin32     = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnJoinSelectMultiple.png", UriKind.Absolute));
            BitmapImage TopoFromPointCloud16     = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnTopoFromPointCloud16.png", UriKind.Absolute));
            BitmapImage TopoFromPointCloud32     = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnTopoFromPointCloud32.png", UriKind.Absolute));
            BitmapImage TopoFromDWG16            = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnTopoFromDWG16.png", UriKind.Absolute));
            BitmapImage TopoFromDWG32            = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnTopoFromDWG.png", UriKind.Absolute));
            BitmapImage TopoSlope16              = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnTopoSlope16.png", UriKind.Absolute));
            BitmapImage TopoSlope32              = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnTopoSlope.png", UriKind.Absolute));
            BitmapImage ONBOX32                  = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/onBox32.png", UriKind.Absolute));
            BitmapImage ONBOX16                  = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/onBox16.png", UriKind.Absolute));
            BitmapImage INFO32                   = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnInfo32.png", UriKind.Absolute));
            BitmapImage INFO16                   = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnInfo16.png", UriKind.Absolute));
            BitmapImage privacy32                = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/privacy32.png", UriKind.Absolute));
            BitmapImage privacy16                = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/privacy16.png", UriKind.Absolute));
            //BitmapImage ProjectExamples16 = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnProjectExamplesFolder16.png", UriKind.Absolute));
            //BitmapImage ProjectExamples32 = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnProjectExamplesFolder.png", UriKind.Absolute));
            BitmapImage Package16 = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnPackage16.png", UriKind.Absolute));
            BitmapImage Package32 = new BitmapImage(new Uri("pack://application:,,,/ONBOXAppl;component/Resources/btnPackage32.png", UriKind.Absolute));

            btnRenumberGrids.LargeImage      = grid32;
            btnRenumberGrids.Image           = grid16;
            btnRenumberGrids.ToolTip         = Properties.RibbonLanguage.RenumberElements_Grids_ToolTip;
            btnRenumberGrids.LongDescription = Properties.RibbonLanguage.RenumberElements_Grids_Descrip;

            //sptRenumberParking.LongDescription = "Comando para renumerar vagas de estacionamento automaticamente.";

            btnRenumberBeams.LargeImage      = beams32;
            btnRenumberBeams.Image           = beams16;
            btnRenumberBeams.ToolTip         = Properties.RibbonLanguage.RenumberElements_RenumberBeams_ToolTip;
            btnRenumberBeams.LongDescription = Properties.RibbonLanguage.RenumberElements_RenumberBeams_Descrip;

            btnRenumberColumns.LargeImage      = Column32;
            btnRenumberColumns.Image           = Column16;
            btnRenumberColumns.ToolTip         = Properties.RibbonLanguage.RenumberElements_Columns_ToolTip;
            btnRenumberColumns.LongDescription = Properties.RibbonLanguage.RenumberElements_Columns_Descrip;

            btnRenumberColumnsSelect.LargeImage      = Column32Select;
            btnRenumberColumnsSelect.Image           = Column16Select;
            btnRenumberColumnsSelect.ToolTip         = Properties.RibbonLanguage.RenumberElements_SelectColumns_ToolTip;
            btnRenumberColumnsSelect.LongDescription = Properties.RibbonLanguage.RenumberElements_SelectColumns_Descrip;

            btnCreateBeamsFromBuilding.Image           = BeamsFromBuilding16;
            btnCreateBeamsFromBuilding.LargeImage      = BeamsFromBuilding32;
            btnCreateBeamsFromBuilding.ToolTip         = Properties.RibbonLanguage.StructuralElements_BeamsForBuilding_ToolTip;
            btnCreateBeamsFromBuilding.LongDescription = Properties.RibbonLanguage.StructuralElements_BeamsForBuilding_Descrip;

            btnCreateBeam.Image           = createBeam16;
            btnCreateBeam.LargeImage      = createBeam32;
            btnCreateBeam.ToolTip         = Properties.RibbonLanguage.StructuralElements_BeamsFromWalls_ToolTip;
            btnCreateBeam.LongDescription = Properties.RibbonLanguage.StructuralElements_BeamsFromWalls_Descrip;

            //btnCreateBeamsUpdate.LargeImage = createUpdate32;
            //btnCreateBeamsUpdate.ToolTip = "Atualizar vigas estruturais";
            //btnCreateBeamsUpdate.LongDescription = "Comando para atualizar vigas estruturais, o comando cria tipos automaticamente, é possivel também pré-dimensionar a altura da viga dentre outras opções.";

            btnCreateColumnsFromDwg.Image           = ColumnsFromDwg16;
            btnCreateColumnsFromDwg.LargeImage      = ColumnsFromDwg32;
            btnCreateColumnsFromDwg.ToolTip         = Properties.RibbonLanguage.StructuralElements_ColumnsFromCAD_ToolTip;
            btnCreateColumnsFromDwg.LongDescription = Properties.RibbonLanguage.StructuralElements_ColumnsFromCAD_Descrip;

            btnElementsCopyLevel.Image           = ElementsCopy16;
            btnElementsCopyLevel.LargeImage      = ElementsCopy32;
            btnElementsCopyLevel.ToolTip         = Properties.RibbonLanguage.ModifyElements_CopyBeamsToLevels_ToolTip;
            btnElementsCopyLevel.LongDescription = Properties.RibbonLanguage.ModifyElements_CopyBeamsToLevels_Descrip;

            btnElmentsJoin.Image                 = ElementsJoin16;
            btnElmentsJoin.LargeImage            = ElementsJoin32;
            btnElmentsJoin.ToolTip               = Properties.RibbonLanguage.ModifyElements_JoinElements_ToolTip;
            btnElmentsJoin.LongDescription       = Properties.RibbonLanguage.ModifyElements_JoinElements_Descrip;
            btnElmentsSelectJoin.Image           = ElementsSelectJoin16;
            btnElmentsSelectJoin.LargeImage      = ElementsSelectJoin32;
            btnElmentsSelectJoin.ToolTip         = Properties.RibbonLanguage.ModifyElements_SelectElementsToJoin_ToolTip;
            btnElmentsSelectJoin.LongDescription = Properties.RibbonLanguage.ModifyElements_SelectElementsToJoin_Descrip;

            btnCreateTopoFromPointCloud.Image           = TopoFromPointCloud16;
            btnCreateTopoFromPointCloud.LargeImage      = TopoFromPointCloud32;
            btnCreateTopoFromPointCloud.ToolTip         = Properties.RibbonLanguage.Topography_SurfaceByPointCloud_ToolTip;
            btnCreateTopoFromPointCloud.LongDescription = Properties.RibbonLanguage.Topography_SurfaceByPointCloud_Descrip;

            btnCreateBeamsFromColumns.ToolTip         = Properties.RibbonLanguage.StructuralElements_BeamsFromColumns_ToolTip;
            btnCreateBeamsFromColumns.LongDescription = Properties.RibbonLanguage.StructuralElements_BeamsFromColumns_Descrip;
            btnCreateBeamsFromColumns.Image           = createBeamsFromColumns16;
            btnCreateBeamsFromColumns.LargeImage      = createBeamsFromColumns32;

            //btnCreateTopoFromDwgMarks.ToolTip = "Criar topografia a partir de arquivos de CAD planimétricos";
            //btnCreateTopoFromDwgMarks.LongDescription = "Comando para criar topografia a partir de arquivos CAD não altimétricos, ou seja, o arquivo de não contém cota Z, o comando lê o arquivo de texto mais próximo que contém informação de altura do ponto.";
            //btnCreateTopoFromDwgMarks.Image = TopoFromDWG16;
            //btnCreateTopoFromDwgMarks.LargeImage = TopoFromDWG32;

            btnTopoSlope.ToolTip         = Properties.RibbonLanguage.Topography_SlopeByPads_ToolTip;
            btnTopoSlope.LongDescription = Properties.RibbonLanguage.Topography_SlopeByPads_Descrip;
            btnTopoSlope.Image           = TopoSlope16;
            btnTopoSlope.LargeImage      = TopoSlope32;

            btnONBOXSite.LargeImage      = ONBOX32;
            btnONBOXSite.Image           = ONBOX16;
            btnONBOXSite.ToolTip         = Properties.RibbonLanguage.About_Site_ToolTip;
            btnONBOXSite.LongDescription = Properties.RibbonLanguage.About_Site_Descrip;

            btnInfo.LargeImage = INFO32;
            btnInfo.Image      = INFO16;
            btnInfo.ToolTip    = Properties.RibbonLanguage.About_Onbox_ToolTip;
            btnInfo.ToolTip    = Properties.RibbonLanguage.About_Onbox_Descrip;

            btnPrivacy.LargeImage = privacy32;
            btnPrivacy.Image      = privacy16;

            //btnProjectExamplesFolder.Image = ProjectExamples16;
            //btnProjectExamplesFolder.LargeImage = ProjectExamples32;
            //btnProjectExamplesFolder.ToolTip = Properties.RibbonLanguage.About_SampleProjects_ToolTip;
            //btnProjectExamplesFolder.LongDescription = Properties.RibbonLanguage.About_SampleProjects_Descrip;

            btnRevitZip.Image           = Package16;
            btnRevitZip.LargeImage      = Package32;
            btnRevitZip.ToolTip         = Properties.RibbonLanguage.Manage_PackageProject_ToolTip;
            btnRevitZip.LongDescription = Properties.RibbonLanguage.Manage_PackageProject_Descrip;

            //SplitButtons
            btnRenumberParking.LargeImage      = parking32;
            btnRenumberParking.Image           = parking16;
            btnRenumberParking.ToolTip         = Properties.RibbonLanguage.RenumberElements_RenumberParkingSpaces_ToolTip;
            btnRenumberParking.LongDescription = Properties.RibbonLanguage.RenumberElements_RenumberParkingSpaces_Descrip;

            btnRenumberBlockParking.LargeImage      = parkingBlock32;
            btnRenumberBlockParking.Image           = parkingBlock16;
            btnRenumberBlockParking.ToolTip         = Properties.RibbonLanguage.RenumberElements_NearestSpaces_ToolTip;
            btnRenumberBlockParking.LongDescription = Properties.RibbonLanguage.RenumberElements_NearestSpaces_Descrip;

            btnRenumberClearParking.LargeImage      = parkingDelete32;
            btnRenumberClearParking.Image           = parkingDelete16;
            btnRenumberClearParking.ToolTip         = Properties.RibbonLanguage.RenumberElements_ClearParkingNumbering_ToolTip;
            btnRenumberClearParking.LongDescription = Properties.RibbonLanguage.RenumberElements_ClearParkingNumbering_Descrip;

            foreach (RibbonPanel currentRibbonPanel in allProjectPanels)
            {
                if (currentRibbonPanel != null)
                {
                    foreach (RibbonItem currentItem in currentRibbonPanel.GetItems())
                    {
                        if (currentItem is PushButton)
                        {
                            PushButton currentPushButton = currentItem as PushButton;
                            currentPushButton.AvailabilityClassName = "ONBOXAppl.ButtonAvailableOnProjectEnv";
                        }
                        if (currentItem is SplitButton)
                        {
                            SplitButton currentSplitButton = currentItem as SplitButton;
                            foreach (PushButton currentPushButton in currentSplitButton.GetItems())
                            {
                                currentPushButton.AvailabilityClassName = "ONBOXAppl.ButtonAvailableOnProjectEnv";
                            }
                        }
                    }
                }
            }

            foreach (RibbonPanel currentRibbonPanel in allFreePanels)
            {
                if (currentRibbonPanel != null)
                {
                    foreach (RibbonItem currentItem in currentRibbonPanel.GetItems())
                    {
                        if (currentItem is PushButton)
                        {
                            PushButton currentPushButton = currentItem as PushButton;
                            currentPushButton.AvailabilityClassName = "ONBOXAppl.ButtonAvailableAlways";
                        }
                        if (currentItem is SplitButton)
                        {
                            SplitButton currentSplitButton = currentItem as SplitButton;
                            foreach (PushButton currentPushButton in currentSplitButton.GetItems())
                            {
                                currentPushButton.AvailabilityClassName = "ONBOXAppl.ButtonAvailableAlways";
                            }
                        }
                    }
                }
            }
        }
Beispiel #7
0
        public void SwitchBetweenDeveloperAndRelease(object sender, Autodesk.Revit.UI.Events.ComboBoxCurrentChangedEventArgs e)
        {
            try
            {
                ComboBox cBox = sender as ComboBox;

                //PushButton myPushButton00 = RibbonPanelCurrent.GetItems()[1] as PushButton;
                PushButton  myPushButton01_Start                     = RibbonPanelCurrent.GetItems().Where(x => x.Name == "Button01_Start").First() as PushButton;
                PushButton  myPushButton02_DrawWallTypes             = RibbonPanelCurrent.GetItems().Where(x => x.Name == "Button02_DrawWallTypes").First() as PushButton;
                PushButton  myPushButton03_SetDefault                = RibbonPanelCurrent.GetItems().Where(x => x.Name == "Button03_SetDefault").First() as PushButton;
                PushButton  myPushButton04_ManualOverrideColor       = RibbonPanelCurrent.GetItems().Where(x => x.Name == "Button04_ManualOverrideColor").First() as PushButton;
                PushButton  myPushButton07_ExtensibleStorage         = RibbonPanelCurrent.GetItems().Where(x => x.Name == "Button07_ExtensibleStorage").First() as PushButton;
                SplitButton mSplitButton_OneClickBackupSystem        = RibbonPanelCurrent.GetItems().Where(x => x.Name == "OneClickBackupSystem").First() as SplitButton;
                PushButton  myPushButton15_SingleClickFamilyBackup   = mSplitButton_OneClickBackupSystem.GetItems()[0] as PushButton;
                PushButton  myPushButton1617_AddEditParameters       = RibbonPanelCurrent.GetItems().Where(x => x.Name == "Button1617_AddEditParameters").First() as PushButton;
                PushButton  myPushButton1819_UnderstandingTransforms = RibbonPanelCurrent.GetItems().Where(x => x.Name == "Button1819_UnderstandingTransforms").First() as PushButton;
                PushButton  myPushButton_02_Uninstall                = RibbonPanelCurrent.GetItems().Where(x => x.Name == "Button_02_Uninstall").First() as PushButton;


                if (cBox.Current.Name == "Development")
                {
                    myPushButton_02_Uninstall.ClassName = dllName + ".Invoke02_Uninstall";
                }
                if (cBox.Current.Name == "Development")
                {
                    myPushButton01_Start.ClassName = dllName + ".DevInvoke01_Start";
                }
                if (cBox.Current.Name == "Development")
                {
                    myPushButton02_DrawWallTypes.ClassName = dllName + ".DevInvoke02_DrawWallTypes";
                }
                if (cBox.Current.Name == "Development")
                {
                    myPushButton03_SetDefault.ClassName = dllName + ".DevInvoke03_SetDefault";
                }
                if (cBox.Current.Name == "Development")
                {
                    myPushButton04_ManualOverrideColor.ClassName = dllName + ".DevInvoke04_ManualOverrideColor";
                }
                if (cBox.Current.Name == "Development")
                {
                    myPushButton07_ExtensibleStorage.ClassName = dllName + ".DevInvoke07_ExtensibleStorage";
                }
                if (cBox.Current.Name == "Development")
                {
                    myPushButton15_SingleClickFamilyBackup.ClassName = dllName + ".DevInvoke15_SingleClickFamilyBackup";
                }
                if (cBox.Current.Name == "Development")
                {
                    myPushButton1617_AddEditParameters.ClassName = dllName + ".DevInvoke1617_AddEditParameters";
                }
                if (cBox.Current.Name == "Development")
                {
                    myPushButton1819_UnderstandingTransforms.ClassName = dllName + ".DevInvoke1819_UnderstandingTransforms";
                }

                if (cBox.Current.Name == "Release")
                {
                    myPushButton_02_Uninstall.ClassName = dllName + ".Invoke02_Uninstall";
                }
                if (cBox.Current.Name == "Release")
                {
                    myPushButton01_Start.ClassName = dllName + ".Invoke01_Start";
                }
                if (cBox.Current.Name == "Release")
                {
                    myPushButton02_DrawWallTypes.ClassName = dllName + ".Invoke02_DrawWallTypes";
                }
                if (cBox.Current.Name == "Release")
                {
                    myPushButton03_SetDefault.ClassName = dllName + ".Invoke03_SetDefault";
                }
                if (cBox.Current.Name == "Release")
                {
                    myPushButton04_ManualOverrideColor.ClassName = dllName + ".Invoke04_ManualOverrideColor";
                }
                if (cBox.Current.Name == "Release")
                {
                    myPushButton07_ExtensibleStorage.ClassName = dllName + ".Invoke07_ExtensibleStorage";
                }
                if (cBox.Current.Name == "Release")
                {
                    myPushButton15_SingleClickFamilyBackup.ClassName = dllName + ".Invoke15_SingleClickFamilyBackup";
                }
                if (cBox.Current.Name == "Release")
                {
                    myPushButton1617_AddEditParameters.ClassName = dllName + ".Invoke1617_AddEditParameters";
                }
                if (cBox.Current.Name == "Release")
                {
                    myPushButton1819_UnderstandingTransforms.ClassName = dllName + ".Invoke1819_UnderstandingTransforms";
                }


                string FILE_NAME = System.Environment.GetEnvironmentVariable("ProgramData") + "\\Pedersen Read Limited"; // cSharpPlaypen joshnewzealand

                if (true)                                                                                                //grouping for clarity will alwasy be true
                {
                    if (!System.IO.Directory.Exists(FILE_NAME))
                    {
                        System.IO.Directory.CreateDirectory(FILE_NAME);
                    }
                    FILE_NAME = FILE_NAME + "\\cSharpPlaypen joshnewzealand"; //
                    if (!System.IO.Directory.Exists(FILE_NAME))
                    {
                        System.IO.Directory.CreateDirectory(FILE_NAME);
                    }
                    FILE_NAME = (FILE_NAME + "\\Location Of Shared Parameters File.txt");
                }

                if (true) //write line
                {
                    string path = "";
                    if (cBox.Current.Name == "Release")
                    {
                        path = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE\\Pedersen Read Limited\\cSharpPlaypen joshnewzealand").GetValue("TARGETDIR").ToString();
                    }
                    if (cBox.Current.Name == "Development")
                    {
                        string dllModuleName = "_929_Bilt2020_PlaypenChild";
                        path = Properties.Settings.Default.DevelopmentPathRoot + "\\" + dllModuleName + "\\AddIn";
                    }

                    System.IO.File.Create(FILE_NAME).Dispose();
                    System.IO.StreamWriter objWriter = new System.IO.StreamWriter(FILE_NAME, true);
                    objWriter.WriteLine(path);
                    objWriter.Close();
                }
            }

            #region catch and finally
            catch (Exception ex)
            {
                TaskDialog.Show("Catch", "Failed due to: " + ex.Message);
            }
            finally
            {
            }
            #endregion
        }
Beispiel #8
0
        public void SetSplitButtonFarClipToTop()
        {
            IList <PushButton> sbList = sbFarClip.GetItems();

            sbFarClip.CurrentButton = sbList[0];
        }