public async Task SetUserLogin() { foreach (var server in _localConfiguration.LoginServerInfoList) { _databaseComponent.InitDatabase(server.IP); List <Task> lttask = new List <Task>(); lttask.Add(_databaseComponent.LoadUserData(server.IP)); lttask.Add(_databaseComponent.LoadRoleData(server.IP)); lttask.Add(_databaseComponent.LoadMenuData(server.IP)); lttask.Add(_databaseComponent.LoadDeviceData(server.IP)); lttask.Add(_databaseComponent.LoadOrganizationData(server.IP)); lttask.Add(_databaseComponent.LoadItemData(server.IP)); lttask.Add(_databaseComponent.LoadOrganizationPrivilegeData(server.IP)); //lttask.Add(_databaseComponent.LoadHardwave(item.IP));//改为延时加载 await Task.WhenAll(lttask.ToArray()); } string mainserverip = LoginInfo.ServerInfo.IP; _databaseComponent.SetMainServerIp(mainserverip); _organizationService.SetDivFres(); LoginInfo.LoginStatus = true; if (LoginInfo.UserName == "superadmin" && LoginInfo.Password == "superadmin") { MenuManageList.Dictionary.Values.ToList().ForEach(p => p.Visibility = Visibility.Visible); _organizationService.InitOrganizations(true); } else if (LoginInfo.ServerInfo.Permission == "超级管理员" || LoginInfo.ServerInfo.Permission == "superadmin") { MenuManageList.Dictionary.Values.ToList().ForEach(p => p.Visibility = Visibility.Visible); _organizationService.InitOrganizations(true); } else//菜单权限=主服务器权限 { var user = (from p in _databaseComponent.GetUserData(mainserverip) where p.Name == LoginInfo.UserName select p).FirstOrDefault(); if (user != null) { LoginInfo.UserCode = user.Code; var menu = (from p in _databaseComponent.GetMenuData(mainserverip) where p.Guid == user.T_Menu_Guid select p).ToList(); foreach (var submenu in menu) { if (MenuManageList.Dictionary.Keys.Contains(submenu.InternalNumber)) { MenuManageList.Dictionary[submenu.InternalNumber].Visibility = Visibility.Visible; } } _organizationService.SetUserOrganizationPrivilege(user.T_OrganizationPrivilege_Guid); _organizationService.InitOrganizations(false); } } //_hardwareService.InitServers();//改为延时加载 _signalProcess.InitSignals(); //AddOperateRecord(UserOperateType.Login); //登录记录取消 }