/// <summary> /// Этот метод вызывается в тот момент, когда следует зарегистрировать команды, /// Создать панель, вставить пункты меню /// </summary> protected override void OnCreateTools() { base.OnCreateTools(); string icoName = "IcoObject"; //RegisterCommand((int)Commands.Create, "$Создание объекта", LoadIconResource(icoName), LoadIconResource(icoName)); // Регистрируем команду создания //Регистрируем команды контекстного меню объекта RegisterObjectCommand((int)ObjectCommands.ObjectContextCommand, "Собрать геометрию...", LoadIconResource("IcoCommand"), LoadIconResource("IcoCommand")); // Регистрируем команду заливки для контекстного меню RegisterObjectCommand((int)ObjectCommands.OutCommand, "Вывести геометрию...", LoadIconResource("IcoCommand"), LoadIconResource("IcoCommand")); // Регистрируем команду заливки для контекстного меню //Регистрируем иконку объекта RegisterObjectTypeIcon((int)ObjectTypeIcons.NewObject, LoadIconResource(icoName)); //Добавляем пункты и подпункты меню TFlex.Menu submenu = new TFlex.Menu(); submenu.CreatePopup(); //submenu.Append((int)Commands.Create, "Nesting Factory", this); TFlex.Application.ActiveMainWindow.InsertPluginSubMenu("Nesting Factory", submenu, MainWindow.InsertMenuPosition.PluginSamples, this); //Создаём панель с кнопками "Звёзды" int[] cmdIDs = new int[] { (int)Commands.Create, (int)Commands.Start, (int)Commands.Out }; CreateToolbar("Nesting Factory", cmdIDs); }
protected override void OnCreateTools() { //base.OnCreateTools(); RegisterCommand( (int)Commands.Export, "Экспорт", TFlexOmpFix.Properties.Resources.omp_icon, TFlexOmpFix.Properties.Resources.omp_icon ); RegisterCommand( (int)Commands.Settings, "Настройки", TFlexOmpFix.Properties.Resources.settings, TFlexOmpFix.Properties.Resources.settings ); TFlex.Menu submenu = new TFlex.Menu(); submenu.CreatePopup(); submenu.Append((int)Commands.Export, "&Экспорт в КИС \"Омега\"", this); submenu.Append((int)Commands.Settings, "&Настройки экспорта", this); TFlex.Application.ActiveMainWindow.InsertPluginSubMenu( "Экспорт", submenu, MainWindow.InsertMenuPosition.PluginSamples, this ); int[] cmdIDs = new int[] { (int)Commands.Export, (int)Commands.Settings }; CreateToolbar("Экспорт", cmdIDs); CreateMainBarPanel("Экспорт", cmdIDs, this.ID, true); TFlex.RibbonGroup ribbonGroup = TFlex.RibbonBar.ApplicationsTab.AddGroup("Экспорт"); ribbonGroup.AddButton((int)Commands.Export, this); ribbonGroup.AddButton((int)Commands.Settings, this); //MessageBox.Show("Test!!!"); if (TFlex.Application.ActiveDocument != null) { TFlex.Application.ActiveDocument.AttachPlugin(this); } }
/// <summary> /// In this function, the application must create its own toolbar, /// register their menu items as well as create other user interface means /// (non-modal windows, etc.). /// </summary> protected override void OnCreateTools() { base.OnCreateTools(); RegisterCommand((int)Commands.AddConnection, "Add Connection", new Icon(Properties.Resources.connect_to_database, new Size(16, 16)), new Icon(Properties.Resources.connect_to_database, new Size(24, 24))); RegisterCommand((int)Commands.ServerExplorer, "Server Explorer", new Icon(Properties.Resources.server_explorer, new Size(16, 16)), new Icon(Properties.Resources.server_explorer, new Size(24, 24))); TFlex.Menu submenu = new TFlex.Menu(); submenu.CreatePopup(); submenu.Append((int)Commands.AddConnection, "Add Connection", this); TFlex.Application.ActiveMainWindow.InsertPluginSubMenu("Data Sources", submenu, MainWindow.InsertMenuPosition.EndOfTools, this); int[] cmdIDs = new int[] { (int)Commands.AddConnection, (int)Commands.ServerExplorer }; CreateToolbar("Data Sources", cmdIDs); CreateMainBarPanel("Data Sources", cmdIDs, this.ID, true); TFlex.RibbonGroup ribbonGroup = TFlex.RibbonBar.ApplicationsTab.AddGroup("Data Sources"); ribbonGroup.AddButton((int)Commands.AddConnection, this); ribbonGroup.AddButton((int)Commands.ServerExplorer, this); serverExplorer = CreateFloatingWindow(0, "Server Explorer"); serverExplorer.Caption = "Server Explorer"; serverExplorer.Visible = false; }