示例#1
0
 public void SetPluginManager(PluginManager pluginManager)
 {
     _mgr = pluginManager;
      lsv.SuspendLayout();
      lsv.Items.Clear();
      if (_mgr != null)
      {
     foreach (var item in _mgr.Plugins)
     {
        object[] types = item.GetType().GetCustomAttributes(typeof(AcDownPluginInformationAttribute), true);
        if (types.Length > 0)
        {
           var attrib = (AcDownPluginInformationAttribute)types[0];
           lsv.Items.Add(new ListViewItem(new string[]
           {
              attrib.FriendlyName,
              attrib.Version.ToString(),
              attrib.Author,
              attrib.Describe,
              attrib.SupportUrl,
              attrib.Name
           }));
        }
     }
      }
      lsv.ResumeLayout();
 }
示例#2
0
		/// <summary>
		/// 初始化AcDown核心
		/// </summary>
		/// <param name="startupFolderPath">起始路径</param>
		/// <param name="uiDelegates">UI委托</param>
		/// <param name="externalPlugins">额外加载的内部插件</param>
		public static void Initialize(string startupFolderPath, UIDelegateContainer uiDelegates,
			Collection<IPlugin> internalPlugins)
		{
			StartupPath = startupFolderPath;
			//如果目录不存在则创建
			if (!Directory.Exists(startupFolderPath))
			{
				Directory.CreateDirectory(startupFolderPath);
			}

			//全局设置
			ConfigManager = new ConfigManager();
			ConfigManager.LoadSettings();
			//记录
			Logging.Initialize();
			//插件管理器
			PluginManager = new PluginManager();
			PluginManager.LoadPlugins();
			foreach (IPlugin plugin in internalPlugins)
			{
				PluginManager.LoadPlugin(plugin);
			}
			//委托
			UIDelegates = uiDelegates;
			//任务管理器
			TaskManager = new TaskManager();
			TaskManager.LoadAllTasks();

		}
示例#3
0
 public FormConfig(PluginManager pluginManager)
     : this()
 {
     pMgr = pluginManager;
 }
示例#4
0
 private void Initialize()
 {
     //全局设置
     Config.LoadSettings();
     //记录
     Logging.Initialize();
     //插件管理器
     pluginMgr = new PluginManager(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), @"Kaedei\AcDown\Plugin"));
     pluginMgr.LoadPlugins();
     //委托
     deles = new UIDelegateContainer(
         new AcTaskDelegate(Start),
         new AcTaskDelegate(NewPart),
         new AcTaskDelegate(RefreshTask),
         new AcTaskDelegate(TipText),
         new AcTaskDelegate(Finish),
         new AcTaskDelegate(Error),
         new AcTaskDelegate(NewTask));
     //任务管理器
     taskMgr = new TaskManager(deles, pluginMgr);
     taskMgr.LoadAllTasks();
     //"新建任务"窗体初始化
     FormNew.Initialize(pluginMgr, taskMgr);
 }
示例#5
0
 /// <summary>
 /// 新建TaskManager类的实例
 /// </summary>
 /// <param name="delegatesCon"></param>
 public TaskManager(UIDelegateContainer delegatesCon, PluginManager pluginManager)
 {
     delegates = delegatesCon;
     _pluginMgr = pluginManager;
 }
示例#6
0
 public static void Initialize(PluginManager pluginMgr, TaskManager taskMgr)
 {
     _pluginMgr = pluginMgr;
     _taskMgr = taskMgr;
     instance = new FormNew();
 }