Ejemplo n.º 1
0
        private static void LoadResources(Application app)
        {
            //加载插件目录程序集
            AssemblyExtention.LoadAssemblies(FrameContext.PluginPath, "^*.(dll|exe)$");

            //加载资源文件
            List <FileInfo> resFiles = new List <FileInfo>();
            //框架资源文件
            var frameResFile = FileExtension.GetFiles(FrameContext.BasePath, FrameContext.ResConfFileName, SearchOption.TopDirectoryOnly);

            if (frameResFile.IsNotEmpty())
            {
                resFiles.AddRange(frameResFile);
            }
            //插件资源文件
            var pluginResFiles = FileExtension.GetFiles(FrameContext.PluginPath, FrameContext.ResConfFileName);

            if (pluginResFiles.IsNotEmpty())
            {
                resFiles.AddRange(pluginResFiles);
            }

            if (resFiles.IsNotEmpty())
            {
                var lstResConf = resFiles.Select(f => LoadResourseFromFile(f));
                if (lstResConf.IsNotEmpty())
                {
                    var lstResConfOrdered = lstResConf.Where(rc => rc != null).OrderBy(rc => rc.order).ToList();
                    for (var idx = 0; idx < lstResConfOrdered.Count; idx++)
                    {
                        app.Resources.MergedDictionaries.AddRange(lstResConfOrdered[idx].res.Select(s => new ResourceDictionary {
                            Source = new Uri(s, UriKind.Relative)
                        }));
                    }
                }
            }
        }
Ejemplo n.º 2
0
 public ExtendedAssembliesResolver()
 {
     AssemblyExtention.LoadAssemblies(AppDomain.CurrentDomain.BaseDirectory, "^*.dll$", SearchOption.TopDirectoryOnly);
     AssemblyExtention.LoadAssemblies(AppDomain.CurrentDomain.BaseDirectory.TrimEnd('/', '\\') + "/apis", "^*.dll$");
 }