Пример #1
0
        ////private uint idCmd;

        ////public Menu(IntPtr hmenu, uint indexMenu, uint idCmd, uint idCmdLast)
        ////{
        ////    this.hmenu = hmenu;
        ////    this.indexMenu = indexMenu;
        ////    this.idCmd = idCmd;
        ////    this.idCmdLast = idCmdLast;
        ////}

        internal Menu(IntPtr hmenu, uint indexMenu, uint idCmdLast, IMenuHost menuHost)
        {
            Contract.Requires(hmenu != null);
            Contract.Requires(menuHost != null);

            this.hmenu     = hmenu;
            this.indexMenu = indexMenu;
            this.idCmdLast = idCmdLast;
            this.menuHost  = menuHost;
        }
Пример #2
0
        ////private uint idCmd;

        ////public Menu(IntPtr hmenu, uint indexMenu, uint idCmd, uint idCmdLast)
        ////{
        ////    this.hmenu = hmenu;
        ////    this.indexMenu = indexMenu;
        ////    this.idCmd = idCmd;
        ////    this.idCmdLast = idCmdLast;
        ////}

        internal Menu(IntPtr hmenu, uint indexMenu, uint idCmdLast, IMenuHost menuHost)
        {
            if (hmenu == null)
            {
                throw new ArgumentNullException(nameof(hmenu));
            }
            ////Contract.Requires(hmenu != null);
            ////Contract.Requires(menuHost != null);

            this.hmenu     = hmenu;
            this.indexMenu = indexMenu;
            this.idCmdLast = idCmdLast;
            this.menuHost  = menuHost;
        }
Пример #3
0
        public void BuildContextMenu(IMenuHost menuHost, IEnumerable<IDataObject> selection, bool isContext)
        {
            if (isContext)
                return;

            var dataObjects = selection.ToArray();
            if (dataObjects.Count() != 1)
                return;

            var itemNames = menuHost.GetItems().ToList();
            const string indexItemName = "SetInfo";
            var insertIndex = itemNames.IndexOf(indexItemName) + 1;

            _selected = dataObjects.FirstOrDefault();
            if (_selected == null)
                return;
            if (!_selected.Type.IsMountable)
                return;

            var icon = IconLoader.GetIcon(@"/Resources/menu_icon.svg");
            menuHost.AddItem(ADD_INFORMATION_TO_PILOT, "Д_обавить информацию с диска", icon, insertIndex);
        }
Пример #4
0
 public void BuildContextMenu(IMenuHost menuHost, IEnumerable<IStorageDataObject> selection)
 {
     //todo: подумать какие могут быть нужны команды для работы с файлами
 }
Пример #5
0
 public void BuildMenu(IMenuHost menuHost)
 {
     var menuItem = menuHost.GetItems().First();
     menuHost.AddSubItem(menuItem, ABOUT_PROGRAM_MENU, "О интеграции с КОМПАС", null, 0);
     menuHost.AddItem(ABOUT_PROGRAM_MENU, "О интеграции с КОМПАС", null, 1);
 }