Exemplo n.º 1
0
        private void CreateUserInterfaceAndCommands()
        {
            try
            {
                WorkSpace dsWorkSpace = AppDs.GetWorkspace("Drafting and Annotation");

                dsWorkSpace.Activate();

                object[] objects = (object[])dsWorkSpace.GetRibbonTabs();
                int      length  = objects.Length + 1;

                ////Add a New Tab
                RibbonTab ribbonTab = dsWorkSpace.AddRibbonTab(AddinGUID, length, "DsExtension", "DsExtension");

                if (ribbonTab != null)
                {
                    RibbonPanel Panneau; RibbonRow LigneBase; RibbonRowPanel Colonne; RibbonRow Ligne; RibbonCommandButton Btn;

                    Panneau   = ribbonTab.InsertRibbonPanel(AddinGUID, 1, "Sw", "Sw");
                    LigneBase = Panneau.InsertRibbonRow(AddinGUID, "A");
                    Colonne   = LigneBase.InsertRibbonRowPanel(AddinGUID, "AA");

                    // Première colonne
                    Ligne = Colonne.InsertRibbonRow(AddinGUID, "AAA");
                    var CmdNettoyerDvp = new Cmds.CmdNettoyerDvp(AppDs, AddinGUID);
                    CmdNettoyerDvp.registerCommand();
                    ListeCmds.Add(CmdNettoyerDvp);
                    Btn = Ligne.InsertRibbonCommandButton(AddinGUID, dsRibbonButtonStyle_e.dsRibbonButtonStyle_SmallWithText, CmdNettoyerDvp.ItemName(), CmdNettoyerDvp.UserCommandID());

                    Ligne = Colonne.InsertRibbonRow(AddinGUID, "AAB");
                    var CmdSimplifierSpline = new Cmds.CmdSimplifierSpline(AppDs, AddinGUID);
                    CmdSimplifierSpline.registerCommand();
                    ListeCmds.Add(CmdSimplifierSpline);
                    Btn = Ligne.InsertRibbonCommandButton(AddinGUID, dsRibbonButtonStyle_e.dsRibbonButtonStyle_SmallWithText, CmdSimplifierSpline.ItemName(), CmdSimplifierSpline.UserCommandID());

                    Ligne = Colonne.InsertRibbonRow(AddinGUID, "AAC");
                    var CmdEffacerGravure = new Cmds.CmdEffacerGravure(AppDs, AddinGUID);
                    CmdEffacerGravure.registerCommand();
                    ListeCmds.Add(CmdEffacerGravure);
                    Btn = Ligne.InsertRibbonCommandButton(AddinGUID, dsRibbonButtonStyle_e.dsRibbonButtonStyle_SmallWithText, CmdEffacerGravure.ItemName(), CmdEffacerGravure.UserCommandID());

                    // Deuxième colonne

                    Panneau   = ribbonTab.InsertRibbonPanel(AddinGUID, 2, "Outils", "Outils");
                    LigneBase = Panneau.InsertRibbonRow(AddinGUID, "B");
                    Colonne   = LigneBase.InsertRibbonRowPanel(AddinGUID, "BB");

                    Ligne = Colonne.InsertRibbonRow(AddinGUID, "BAA");
                    var CmdPoinconner = new Cmds.Poinconner.CmdPoinconner(AppDs, AddinGUID);
                    CmdPoinconner.registerCommand();
                    ListeCmds.Add(CmdPoinconner);
                    Btn = LigneBase.InsertRibbonCommandButton(AddinGUID, dsRibbonButtonStyle_e.dsRibbonButtonStyle_SmallWithText, CmdPoinconner.ItemName(), CmdPoinconner.UserCommandID());

                    // Troisième colonne

                    Panneau   = ribbonTab.InsertRibbonPanel(AddinGUID, 3, "Dev", "Dev");
                    LigneBase = Panneau.InsertRibbonRow(AddinGUID, "R");
                    Colonne   = LigneBase.InsertRibbonRowPanel(AddinGUID, "RR");

                    Ligne = Colonne.InsertRibbonRow(AddinGUID, "RRR");
                    var Cmdlog = new Cmds.CmdLog(AppDs, AddinGUID);
                    Cmdlog.registerCommand();
                    ListeCmds.Add(Cmdlog);
                    Btn = LigneBase.InsertRibbonCommandButton(AddinGUID, dsRibbonButtonStyle_e.dsRibbonButtonStyle_SmallWithText, Cmdlog.ItemName(), Cmdlog.UserCommandID());

                    Ligne = Colonne.InsertRibbonRow(AddinGUID, "RRS");
                    var CmdTest = new Cmds.CmdTest(AppDs, AddinGUID);
                    CmdTest.registerCommand();
                    ListeCmds.Add(CmdTest);
                    Btn = LigneBase.InsertRibbonCommandButton(AddinGUID, dsRibbonButtonStyle_e.dsRibbonButtonStyle_SmallWithText, CmdTest.ItemName(), CmdTest.UserCommandID());
                }
            }
            catch (Exception e)
            { Log.Write(e); }
        }