Ejemplo n.º 1
0
        /// <summary>
        /// 执行插件
        /// </summary>
        /// <param name="plugin">要执行的插件</param>
        /// <param name="asyn">异步通知</param>
        /// <param name="callback">插件执行完回调</param>
        public void ExecutePlugin(DataParsePluginInfo plugin, IAsyncTaskProgress asyn, Action <IDataSource> callback)
        {
            var pl = Plugins[plugin] as AbstractDataParsePlugin;

            if (null != pl)
            {
                pl.StartTime = DateTime.Now;
                IDataSource ds = null;

                try
                {
                    ds = pl.Execute(null, asyn) as IDataSource;
                }
                finally
                {
                    ds?.BuildParent();
                }

                if (ds != null)
                {
                    ds.PluginInfo = plugin;
                }
                pl.EndTime = DateTime.Now;
                callback?.Invoke(ds);
            }
        }