예제 #1
0
        /// <summary>
        /// 加载程序集模块
        /// </summary>
        /// <returns></returns>
        public async Task LoadAssemblyModule()
        {
            try
            {
                Modules = new ObservableCollection <Module>();
                ModuleComponent mc = new ModuleComponent();
                var             ms = await mc.GetAssemblyModules();

                foreach (var i in ms)
                {
                    //如果当前程序集的模快在服务器上可以匹配到就添加模块列表
                    var m = Loginer.Current.Menus.FirstOrDefault(t => t.MenuName.Equals(i.Name));
                    if (m != null)
                    {
                        Modules.Add(new Module()
                        {
                            Name     = i.Name,
                            Code     = m.MenuCaption,
                            TypeName = m.MenuNameSpace,
                            Auth     = m.MenuAuth
                        });
                    }
                }
                GC.Collect();
            }
            catch (Exception ex)
            {
                Log.Error(ex.Message);
                throw ex;
            }
        }
        /// <summary>
        /// 加载程序集模块
        /// </summary>
        /// <returns></returns>
        public async Task LoadAssemblyModule()
        {
            try
            {
                ModuleGroups = new ObservableCollection <ModuleGroup>();
                ModuleComponent mc = new ModuleComponent();
                var             ms = await mc.GetAssemblyModules();

                foreach (var i in ms)
                {
                    var desc = EnumHelper.GetEnumDescription(i.ModuleType);
                    var mg   = ModuleGroups.FirstOrDefault(t => t.GroupName.Equals(desc));
                    if (mg == null)
                    {
                        ModuleGroups.Add(new ModuleGroup()
                        {
                            GroupName = desc,
                            Modules   = new ObservableCollection <Module>()
                            {
                                new Module()
                                {
                                    Name = i.Desc, Code = i.Icon, TypeName = i.TypeName,
                                }
                            }
                        });
                    }
                    else
                    {
                        mg.Modules.Add(new Module()
                        {
                            Name = i.Desc, Code = i.Icon, TypeName = i.TypeName
                        });
                    }
                }
                GC.Collect();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #3
0
        /// <summary>
        /// 加载程序集模块
        /// </summary>
        /// <returns></returns>
        public async Task LoadAssemblyModule()
        {
            try
            {
                Modules = new ObservableCollection <Module>();
                ModuleComponent mc = new ModuleComponent();
                var             ms = await mc.GetAssemblyModules();

                foreach (var i in ms)
                {
                    var desc = EnumHelper.GetEnumDescription(i.ModuleType);
                    Modules.Add(new Module()
                    {
                        Name = i.Desc, Code = i.Icon, TypeName = i.TypeName,
                    });
                }
                GC.Collect();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }