Exemplo n.º 1
0
 /// <summary>
 /// 采集影片资料
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void button_update_Click(object sender, EventArgs e)
 {
     if (IsRun)
     {
         ShowToast("有任务正在执行");
         return;
     }
     if (selectCard == null)
     {
         ShowToast("请先选择一部影片");
         return;
     }
     panelEx1.Enabled = false;
     ShowToast("正在采集影片信息...");
     FileProcess.Start(new List <VideoInfo>()
     {
         selectCard.VideoFile
     }, config, new FileProcess.OnCompleteHandle(() =>
     {
         Invoke(new EventHandler((o1, e1) =>
         {
             selectCard.Movie = NfoTools.Load(selectCard.VideoFile.filename);
             panelEx1.Enabled = true;
             ShowToast("影片信息采集成功");
         }));
     }),
                       new FileProcess.OnLogHandle((str, logLevel) =>
     {
         LogAdd(str, logLevel);
     }));
 }
Exemplo n.º 2
0
        /// <summary>
        /// 开始处理
        /// </summary>
        private void Start()
        {
            if (IsRun)
            {
                FileProcess.Stop();
                ShowToast("手动停止中...");
                button_start.Enabled = false;
                progressBar1.Visible = false;
                return;
            }
            IsRun                = true;
            config.MaxThread     = 1;
            progressBar1.Visible = true;
            //开始整理
            FileProcess.Start(VideoFileList, config, new FileProcess.OnCompleteHandle(() =>
            {
                //更新界面为停止运行
                UpdateUI(false);
                IsRun = false;
            }), new FileProcess.OnLogHandle((str, logLevel) =>
            {
                LogAdd(str, logLevel);
            }), new FileProcess.OnProgressHandle((value) => { UpdateProgress(value); }));
            progressBar1.ProgressType = eProgressItemType.Standard;

            //没找到文件的时候FileProcess会直接触发结束事件,优先执行,导致这里覆盖了UI状态
            if (IsRun)
            {
                //更新界面为开始运行
                UpdateUI(true);
            }
        }