Beispiel #1
0
        private void LoadMonitoringTheme()
        {
            string[] dlls = MefConfigParser.GetAssemblysByCatalog("监测分析专题");
            if (dlls == null || dlls.Length == 0)
            {
                return;
            }
            List <IMonitoringProduct> mps = new List <IMonitoringProduct>();

            using (IComponentLoader <IMonitoringProduct> loader = new ComponentLoader <IMonitoringProduct>())
            {
                for (int i = 0; i < dlls.Length; i++)
                {
                    if (File.Exists(dlls[i]))
                    {
                        IMonitoringProduct[] prds = null;
                        try
                        {
                            prds = loader.LoadComponents(dlls[i]);
                        }
                        catch (Exception ex)//这里通过去除产品定义文件的方式令加载失败,这里需要记录日志
                        {
                            Logger.Trace(ex);
                            prds = null;
                        }
                        if (prds != null && prds.Length != 0)
                        {
                            mps.AddRange(prds);
                        }
                    }
                }
            }
            _monitoringProducts = mps.ToArray();
        }
Beispiel #2
0
 private static IRgbProcessorArgEditor[] GetRegisteredEditors()
 {
     string[] dlls = MefConfigParser.GetAssemblysByCatalog("图像处理");
     using (IComponentLoader <IRgbProcessorArgEditor> loader = new ComponentLoader <IRgbProcessorArgEditor>())
     {
         return(loader.LoadComponents(dlls));
     }
 }
Beispiel #3
0
 private static IBandProvider[] TryLoadRegisteredBandProviders()
 {
     IsLoadedBandProviders = true;
     string[] files = MefConfigParser.GetAssemblysByCatalog("波段提供者");
     using (IComponentLoader <IBandProvider> loader = new ComponentLoader <IBandProvider>())
     {
         return(loader.LoadComponents(files));
     }
 }
Beispiel #4
0
        private static IGeoDataDriver[] GetRegisteredDrivers()
        {
            string[] files = MefConfigParser.GetAssemblysByCatalog("数据驱动");
            string   dir   = AppDomain.CurrentDomain.BaseDirectory;

            using (IComponentLoader <IGeoDataDriver> loader = new ComponentLoader <IGeoDataDriver>())
            {
                return(loader.LoadComponents(files));
            }
        }
Beispiel #5
0
        public static IRadiationProvider[] LoadAllRadiationProviders()
        {
            string fileCompon = AppDomain.CurrentDomain.BaseDirectory;

            if (_loadedRadiationProviders == null)
            {
                using (IComponentLoader <IRadiationProvider> loader = new ComponentLoader <IRadiationProvider>())
                    _loadedRadiationProviders = loader.LoadComponents(fileCompon);
            }
            return(_loadedRadiationProviders);
        }
Beispiel #6
0
        private void button1_Click(object sender, EventArgs e)
        {
            string[] dlls = MefConfigParser.GetAssemblysByCatalog("数据驱动");

            string fname = Path.Combine(Path.GetDirectoryName(this.GetType().Assembly.Location), "LoadOrder.xml");

            string[] fnames = (new LoadOrderParser()).Parse(fname);

            using (IComponentLoader <IGeoDataDriver> loader = new ComponentLoader <IGeoDataDriver>())
            {
                object[] obj = loader.LoadComponents(dlls);
            }
        }
        public void FindAllElements()
        {
            object[] objs;
            string[] dlls = MefConfigParser.GetAssemblysByCatalog("专题制图");
            using (IComponentLoader <IElement> loader = new ComponentLoader <IElement>())
            {
                objs = loader.LoadComponents(dlls);
            }
            Dictionary <string, List <IElement> > categorys = ClassifyElements(objs);

            CreatGroupsFromClassify(categorys);
            AddCustomElementsToTree();
        }
Beispiel #8
0
 public SmartToolWindowFactory(ISmartSession session)
 {
     string[] dlls = MefConfigParser.GetAssemblysByCatalog("系统窗口");
     _session = session;
     using (IComponentLoader <ISmartToolWindow> loader = new ComponentLoader <ISmartToolWindow>())
     {
         ISmartToolWindow[] wnds = loader.LoadComponents(dlls);
         if (wnds != null)
         {
             foreach (ISmartToolWindow w in wnds)
             {
                 _registeredToolWindows.Add(w.Id, w.GetType());
             }
         }
     }
 }
Beispiel #9
0
 public CommandEnvironment(ISmartSession session)
 {
     string[] dlls = MefConfigParser.GetAssemblysByCatalog("系统命令");
     using (IComponentLoader <ICommand> loader = new ComponentLoader <ICommand>())
     {
         ICommand[] cmds = loader.LoadComponents(dlls);
         if (cmds != null)
         {
             foreach (ICommand cmd in cmds)
             {
                 cmd.Apply(session);
                 _commands.Add(cmd.Id, cmd);
             }
         }
     }
 }
Beispiel #10
0
 public static void RegisterAll(ISmartSession session)
 {
     _session           = session;
     _fileOpenOperators = new List <IOpenFileProcessor>();
     string[] dlls = MefConfigParser.GetAssemblysByCatalog("文件支持");
     using (IComponentLoader <IOpenFileProcessor> loader = new ComponentLoader <IOpenFileProcessor>())
     {
         IOpenFileProcessor[] processors = loader.LoadComponents(dlls);
         if (processors != null)
         {
             foreach (IOpenFileProcessor pro in processors)
             {
                 pro.SetSession(session);
                 _fileOpenOperators.Add(pro);
             }
         }
     }
 }