コード例 #1
0
        public Result OnStartup(UIControlledApplication a)
        {
            ParentSupportMethods myParentSupportMethods = new ParentSupportMethods();

            myParentSupportMethods.myTA = this;

            string stringCommand01Button = "Set Development Path Root";

            Properties.Settings.Default.AssemblyNeedLoading = true;
            Properties.Settings.Default.Save();

            String exeConfigPath = Path.GetDirectoryName(path) + "\\" + dllName + ".dll";

            a.CreateRibbonTab(TabName);
            RibbonPanelCurrent = a.CreateRibbonPanel(TabName, PanelName);

            PushButtonData myPushButtonData01 = new PushButtonData(stringCommand01Button, stringCommand01Button, exeConfigPath, dllName + ".InvokeSetDevelopmentPath");

            ComboBoxData cbData = new ComboBoxData("DeveloperSwitch")
            {
                ToolTip = "Select an Option", LongDescription = "Select a number or letter"
            };
            ComboBox ComboBox01 = RibbonPanelCurrent.AddStackedItems(cbData, myPushButtonData01)[0] as ComboBox;

            string stringProductVersion = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE\\Pedersen Read Limited\\cSharpPlaypen joshnewzealand").GetValue("ProductVersion").ToString();

            //Bug fix here by Max Sun (01/05/19)

            ComboBox01.AddItem(new ComboBoxMemberData("Release", "Release: " + stringProductVersion));
            ComboBox01.AddItem(new ComboBoxMemberData("Development", "C# Developer Mode"));
            ComboBox01.CurrentChanged += new EventHandler <Autodesk.Revit.UI.Events.ComboBoxCurrentChangedEventArgs>(SwitchBetweenDeveloperAndRelease);

            //RibbonPanelCurrent.AddItem(myParentSupportMethods.myPushButton_01(Button_01, path));
            RibbonPanelCurrent.AddItem(myParentSupportMethods.Button01_Start("Button01_Start", Button01_Start, path));
            RibbonPanelCurrent.AddItem(myParentSupportMethods.Button02_DrawWallTypes("Button02_DrawWallTypes", Button02_DrawWallTypes, path));
            RibbonPanelCurrent.AddItem(myParentSupportMethods.Button03_SetDefault("Button03_SetDefault", Button03_SetDefault, path));
            RibbonPanelCurrent.AddItem(myParentSupportMethods.Button04_ManualOverrideColor("Button04_ManualOverrideColor", Button04_ManualOverrideColor, path));
            RibbonPanelCurrent.AddItem(myParentSupportMethods.Button07_ExtensibleStorage("Button07_ExtensibleStorage", Button07_ExtensibleStorage, path));

            PushButtonData myPushButtonData_OneClickBackup   = myParentSupportMethods.Button15_SingleClickFamilyBackup("Button15_SingleClickFamilyBackup", Button15_SingleClickFamilyBackup, path);
            PushButtonData myPushButtonData_OpenBackupFolder = new PushButtonData("Button15_OpenBackupFolder", "Open Backup Folder", exeConfigPath, dllName + ".InvokeOpenBackupFolder");

            SplitButtonData sb1 = new SplitButtonData("OneClickBackupSystem", "One Click Backup System");
            SplitButton     sb  = RibbonPanelCurrent.AddItem(sb1) as SplitButton;

            sb.AddPushButton(myPushButtonData_OneClickBackup);
            sb.AddPushButton(myPushButtonData_OpenBackupFolder);
            sb.IsSynchronizedWithCurrentItem = false;



            RibbonPanelCurrent.AddItem(myParentSupportMethods.Button1617_AddEditParameters("Button1617_AddEditParameters", Button1617_AddEditParameters, path));
            RibbonPanelCurrent.AddItem(myParentSupportMethods.Button1819_UnderstandingTransforms("Button1819_UnderstandingTransforms", Button1819_UnderstandingTransforms, path));
            RibbonPanelCurrent.AddItem(myParentSupportMethods.Button02_Uninstall("Button_02_Uninstall", Button_02_Uninstall, path));

            //PRLChecklistsPanel2.Visible = false;
            //RibbonPanel PRLChecklistsPanel2 = a.CreateRibbonPanel(TabName, PanelTransferring);
            //myParentSupportMethods.PlaceButtonOnModifyRibbon();
            return(Result.Succeeded);
        }
コード例 #2
0
        public Result OnStartup(UIControlledApplication a)
        {
            ParentSupportMethods myParentSupportMethods = new ParentSupportMethods();

            myParentSupportMethods.myTA = this;

            string stringCommand01Button = "Set Development Path Root";

            Properties.Settings.Default.AssemblyNeedLoading = true;
            Properties.Settings.Default.Save();

            String exeConfigPath = Path.GetDirectoryName(path) + "\\" + dllName + ".dll";

            a.CreateRibbonTab(TabName);
            RibbonPanelCurrent = a.CreateRibbonPanel(TabName, PanelName);

            PushButtonData myPushButtonData01 = new PushButtonData(stringCommand01Button, stringCommand01Button, exeConfigPath, dllName + ".InvokeSetDevelopmentPath");

            ComboBoxData cbData = new ComboBoxData("DeveloperSwitch")
            {
                ToolTip = "Select an Option", LongDescription = "Select a number or letter"
            };
            ComboBox ComboBox01 = RibbonPanelCurrent.AddStackedItems(cbData, myPushButtonData01)[0] as ComboBox;


            string stringProductVersion = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE\\Default Company Name\\CSharp PLAYPEN II Google 'Josh API Revit'").GetValue("ProductVersion").ToString();

            //Bug fix here by Max Sun (01/05/19)

            ComboBox01.AddItem(new ComboBoxMemberData("Release", "Release: " + stringProductVersion));
            ComboBox01.AddItem(new ComboBoxMemberData("Development", "C# Developer Mode"));
            ComboBox01.CurrentChanged += new EventHandler <Autodesk.Revit.UI.Events.ComboBoxCurrentChangedEventArgs>(SwitchBetweenDeveloperAndRelease);

            RibbonPanelCurrent.AddItem(myParentSupportMethods.myPushButton_01(Button_01, path));
            RibbonPanelCurrent.AddItem(myParentSupportMethods.myPushButton_02(Button_02, path));
            RibbonPanel PRLChecklistsPanel2 = a.CreateRibbonPanel(TabName, PanelTransferring);

            //PRLChecklistsPanel2.Visible = false;

            myParentSupportMethods.PlaceButtonOnModifyRibbon();
            return(Result.Succeeded);
        }
コード例 #3
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 myPushButton02 = RibbonPanelCurrent.GetItems()[2] as PushButton;
                PushButton myPushButton03 = RibbonPanelCurrent.GetItems()[3] as PushButton;

                //if (cBox.Current.Name == "Development") myPushButton00.ClassName = dllName + ".Invoke00Development";
                if (cBox.Current.Name == "Development")
                {
                    myPushButton02.ClassName = dllName + ".Invoke01Development";
                }
                if (cBox.Current.Name == "Development")
                {
                    myPushButton03.ClassName = dllName + ".Invoke02";
                }

                if (cBox.Current.Name == "Release")
                {
                    myPushButton02.ClassName = dllName + ".Invoke01";
                }
                if (cBox.Current.Name == "Release")
                {
                    myPushButton03.ClassName = dllName + ".Invoke02";
                }
            }

            #region catch and finally
            catch (Exception ex)
            {
                TaskDialog.Show("Catch", "Failed due to: " + ex.Message);
            }
            finally
            {
            }
            #endregion
        }
コード例 #4
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
        }