Exemple #1
0
        private void StartToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                Log.PrintLog("开始调度");
                Dispatch dispatch = new Dispatch();
                if (dispatch.ShowDialog() == DialogResult.OK)
                {
                    foreach (JobItem job in dispatch.Jobs)
                    {
                        ICollector ic = Function.GetCollectorPluginInterface(job.AssemblyPath);
                        ist = dispatch.iStorager;//保存存储接口

                        if (ic == null)
                        {
                            throw new Exception("Invalid PluginInterface.");
                        }

                        ic.NovelListHasGot      += new NovelListGotEventHandler(ip_NovelListHasGot);
                        ic.NovelInfoHasGot      += new NovelInfoGotEventHandler(ip_NovelInfoHasGot);
                        ic.VolumeListHasGot     += new VolumeListEventHandler(ip_VolumeListHasGot);
                        ic.ChapterListHasGot    += new ChapterListGotEventHandler(ip_ChapterListHasGot);
                        ic.ChapterHasGot        += new ChapterGotEventHandler(ip_ChapterHasGot);
                        ic.ProcedureHasFinished += new ProcedureFinishEventHandler(ip_ProcedureHasFinished);

                        ic.Run(job.TargetSite);
                        this.StartToolStripMenuItem.Enabled = false;
                    }
                }
                Log.PrintLog("结束调度");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }