public void DisplayActionsTest() { MenuActionManager target = Init(); var action = new MenuAction(fooHandle, target, target.File, "MenuExit", 1); action = new MenuAction(fooHandle, target, target.File, "MenuLogout", 2); var actionHC = new MenuAction(target, target.Reports, "", 1); actionHC.Caption = "human reports"; var actionVC = new MenuAction(target, target.Reports, "", 2); actionHC.Caption = "vet reports"; action = new MenuAction(fooHandle, target, target.Reports, "MenuLogout", 3); action = new MenuAction(fooHandle, target, actionHC, "MenuExit", 1); action = new MenuAction(fooHandle, target, actionVC, "MenuExit", 1); target.DisplayActions(); Assert.AreEqual(2, m_MainForm.BarManager.MainMenu.ItemLinks.Count); Assert.AreEqual(2, ((BarSubItem)m_MainForm.BarManager.MainMenu.ItemLinks[0].Item).ItemLinks.Count); Assert.AreEqual(3, ((BarSubItem)m_MainForm.BarManager.MainMenu.ItemLinks[1].Item).ItemLinks.Count); Assert.AreEqual(1, ((BarSubItem) ((BarSubItem)m_MainForm.BarManager.MainMenu.ItemLinks[1].Item).ItemLinks[0].Item). ItemLinks.Count); Assert.AreEqual(1, ((BarSubItem) ((BarSubItem)m_MainForm.BarManager.MainMenu.ItemLinks[1].Item).ItemLinks[1].Item). ItemLinks.Count); Assert.AreEqual(EidssMenu.Get("MenuLogout", ""), (((BarSubItem)m_MainForm.BarManager.MainMenu.ItemLinks[1].Item).ItemLinks[2].Item).Caption); }
public void VisualTest() { MenuActionManager target = Init(); var action = new MenuAction(target, target.File, "MenuExit", 1); action = new MenuAction(target, target.File, "MenuLogout", 2); var actionHC = new MenuAction(target, target.Reports, "", 1); actionHC.Caption = "human reports"; var actionVC = new MenuAction(target, target.Reports, "", 2); actionVC.Caption = "vet reports"; action = new MenuAction(target, target.Reports, "MenuLogout", 3); action.SelectPermission = "Deny"; action = new MenuAction(target, actionHC, "MenuExit", 1); action = new MenuAction(target, actionVC, "MenuExit", 1); target.DisplayActions(); //PrivateObject param0 = new PrivateObject(manager); //MenuActionManager_Accessor target = new MenuActionManager_Accessor(param0); m_MainForm.ShowDialog(); }
public void RegisterActions() { if (m_MenuManager == null) { m_MenuManager = MenuActionManager.Instance; } m_MenuManager.Clear(); m_MenuManager.LoadAssemblyActions(WinUtils.AppPath() + "\\bvwin_common.dll"); string[] files = Directory.GetFiles((WinUtils.AppPath()), "eidss*.dll"); foreach (string file in files) { m_MenuManager.LoadAssemblyActions(file); } m_MenuManager.LoadAssemblyActions(WinUtils.AppPath() + "\\eidss.main.exe"); RegisterDefaultActions(); m_MenuManager.DisplayActions(); if (m_TranslationButton != null) { m_TranslationButton.RefreshPopupMenu(); } }