Esempio n. 1
0
        public ActionResult MessagesScript(string version)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine("var EIDSS = { BvMessages: {");
            g_ResKeys.ForEach(key =>
            {
                string val = BvMessages.Get(key);
                if (val == null || val == key)
                {
                    val = EidssMessages.Get(key);
                }
                if (val == null || val == key)
                {
                    val = EidssFields.Get(key);
                }
                if (val == null || val == key)
                {
                    val = EidssMenu.Get(key, null);
                }
                if (val == null || val == key)
                {
                    val = key;
                }
                val = val.Replace("'", "\\'");
                sb.AppendFormat("'{0}': '{1}',", key, val);
                sb.AppendLine();
            });
            sb.AppendLine("} }");
            return(JavaScript(sb.ToString()));
        }
Esempio n. 2
0
        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);
        }