Esempio n. 1
0
        void PopulatePendingRequestsMenuTier()
        {
            var pendingRequestsMenuTier = new MenuTier(Resources.MenuTierLabel_PendingRequests);

            if (_state.UnreadErrors.Count > 0)
            {
                pendingRequestsMenuTier.MenuItems.Add(
                    new ReadNewErrorMessagesMenuItem(_state, _state.UnreadErrors));
            }

            if (_state.PendingFileTransferCount > 0)
            {
                pendingRequestsMenuTier.MenuItems.Add(
                    new ViewPendingFileTransfersMenu(_state));
            }

            if (_state.StalledFileTransferIds.Count > 0)
            {
                pendingRequestsMenuTier.MenuItems.Add(
                    new ViewStalledFileTransfersMenu(_state));
            }

            if (_state.UnreadTextMessageCount > 0)
            {
                foreach (var id in _state.TextSessionIdsWithUnreadMessages)
                {
                    var textSession = _state.LocalServer.GetConversationById(id).Value;

                    pendingRequestsMenuTier.MenuItems.Add(
                        new ReadNewTextMessagesMenuItem(_state, textSession));
                }
            }

            TieredMenu.AddTier(pendingRequestsMenuTier);
        }
Esempio n. 2
0
        /// <summary>
        /// 根据用户的权限加载菜单
        /// </summary>
        /// <param name="moduleControllers"></param>
        /// <returns></returns>
        public List <MenuTier> GetMenuTier(List <string> moduleControllers)
        {
            var result = (from m1 in _menuRepository.Entities.Select(x => new { x.SysNo, MenuName = x.MenuName, x.Sort, x.ParentNo, x.IsSelected, x.StatusDB })
                          join m2 in _menuRepository.Entities.Select(x => new { x.SysNo, MenuName = x.MenuName, x.Sort, x.ParentNo, x.IsSelected, x.StatusDB })
                          on m1.SysNo equals m2.ParentNo.Value
                          join m3 in _menuRepository.Entities.Select(x => new { x.SysNo, MenuName = x.MenuName, x.Sort, x.ParentNo, MenuLinkUrl = x.MenuLinkUrl, MenuIcon = x.MenuIcon, ModuleController = x.ModuleController, x.IsSelected, x.StatusDB })
                          on m2.SysNo equals m3.ParentNo.Value
                          where moduleControllers.Contains(m3.ModuleController) &&
                          m1.StatusDB == (int)CommonStatus.Valid &&
                          m2.StatusDB == (int)CommonStatus.Valid &&
                          m3.StatusDB == (int)CommonStatus.Valid
                          orderby m1.Sort ascending
                          select new { m1, m2, m3 }).ToList();

            List <MenuTier> menuList    = new List <MenuTier>();
            var             groupResult = result.GroupBy(x => x.m1);
            MenuTier        menu        = new MenuTier();
            MenuTier        child       = new MenuTier();

            foreach (var g in groupResult)
            {
                menu            = new MenuTier();
                menu.Sort       = g.Key.Sort;
                menu.MenuName   = g.Key.MenuName;
                menu.SysNo      = g.Key.SysNo;
                menu.IsSelected = g.Key.IsSelected;

                var childResult = g.GroupBy(x => x.m2);

                foreach (var c in childResult)
                {
                    child            = new MenuTier();
                    child.Sort       = c.Key.Sort;
                    child.MenuName   = c.Key.MenuName;
                    child.SysNo      = c.Key.SysNo;
                    child.IsSelected = c.Key.IsSelected;

                    child.ChildMenus = g.Select(x =>
                    {
                        return(new MenuTier()
                        {
                            SysNo = x.m3.SysNo,
                            MenuName = x.m3.MenuName,
                            Sort = x.m3.Sort,
                            MenuLinkUrl = x.m3.MenuLinkUrl,
                            MenuIcon = x.m3.MenuIcon,
                            IsSelected = x.m3.IsSelected
                        });
                    }).OrderBy(item => item.Sort).ToList();

                    menu.ChildMenus.Add(child);
                }

                menuList.Add(menu);
            }

            return(menuList);
        }
Esempio n. 3
0
        void PopulateServerConfigurationMenuTier()
        {
            var serverConfigurationMenuTier =
                new MenuTier(Resources.MenuTierLabel_ServerConfiguration);

            serverConfigurationMenuTier.MenuItems.Add(new SelectRemoteServerMenu(_state));
            serverConfigurationMenuTier.MenuItems.Add(new LocalServerSettingsMenu(_state));
            serverConfigurationMenuTier.MenuItems.Add(new LocalServerNetworkPropertiesMenu(_state));
            serverConfigurationMenuTier.MenuItems.Add(_shutdownServer);

            TieredMenu.AddTier(serverConfigurationMenuTier);
        }
Esempio n. 4
0
        void PopulateRemoteServerMenuTier()
        {
            var selectedServerMenuTier = new MenuTier(_state.RemoteServerInfo());

            if (_state.RemoteServerSelected)
            {
                selectedServerMenuTier.MenuItems.Add(new SendTextMessageMenuItem(_state));
                selectedServerMenuTier.MenuItems.Add(new SelectFileMenu(_state, true));
                selectedServerMenuTier.MenuItems.Add(new SelectFileMenu(_state, false));
                selectedServerMenuTier.MenuItems.Add(new EditServerInfoMenu(_state));
                selectedServerMenuTier.MenuItems.Add(new DeleteServerInfoMenuItem(_state));
            }

            TieredMenu.AddTier(selectedServerMenuTier);
        }
Esempio n. 5
0
        void PopulateViewLogsMenuTier()
        {
            var viewLogsMenuTier = new MenuTier(Resources.MenuTierLabel_ViewLogs);

            if (!_state.NoFileTransfers)
            {
                viewLogsMenuTier.MenuItems.Add(new FileTransferLogsMenu(_state));
            }

            if (!_state.NoTextSessions)
            {
                viewLogsMenuTier.MenuItems.Add(new TextMessageLogsMenu(_state));
            }

            if (!_state.NoRequests)
            {
                viewLogsMenuTier.MenuItems.Add(new ServerRequestLogsMenu(_state));
            }

            viewLogsMenuTier.MenuItems.Add(new ViewAllEventsMenuItem(_state));
            viewLogsMenuTier.MenuItems.Add(new SetLogLevelMenu(_state));

            TieredMenu.AddTier(viewLogsMenuTier);
        }