Esempio n. 1
0
        private void btnStartBatch_Click(object sender, EventArgs e)
        {
            if (_currentUIStatus == UIStatus.StandBy)
            {
                bool shouldDisableInput = true;

                foreach (DataGridViewRow row in dgvFileList.Rows)
                {
                    if ((bool)row.Cells["CheckBoxColumn"].Value == true)
                    {
                        if (shouldDisableInput == true)
                        {
                            //disable input if there is at least one checked column.
                            //DisableInput();
                            ChangeUIStatus(UIStatus.Downloading);
                            ClearDownloadStatus();
                            shouldDisableInput = false;
                        }
                        string filePath = (string)row.Cells["FullPathColumn"].Value;

                        ShooterDownloadJob dlJob = new ShooterDownloadJob();
                        dlJob.VideoFilePath   = filePath;
                        dlJob.JobId           = row.Index;
                        dlJob.ProgressUpdate += new ProgressHandler(OnDownloadStatusUpdate);
                        _jobQueue.AddJob(dlJob);
                    }
                }
            }
            else if (_currentUIStatus == UIStatus.Downloading)
            {
                //Cancel Download
                ChangeUIStatus(UIStatus.Canceling);
                _jobQueue.Reset();
                ChangeUIStatus(UIStatus.StandBy);
                LogMan.Instance.Log(Properties.Resources.InfoDownloadCanceled);
            }
        }
Esempio n. 2
0
        private void btnStartBatch_Click(object sender, EventArgs e)
        {
            if(_currentUIStatus == UIStatus.StandBy)
            {
                var shouldDisableInput = true;

                foreach(DataGridViewRow row in dgvFileList.Rows)
                {
                    if((bool)row.Cells["CheckBoxColumn"].Value)
                    {
                        if(shouldDisableInput)
                        {
                            //disable input if there is at least one checked column.
                            //DisableInput();
                            ChangeUIStatus(UIStatus.Downloading);
                            ClearDownloadStatus();
                            shouldDisableInput = false;
                        }
                        var filePath = (string)row.Cells["FullPathColumn"].Value;

                        var dlJob = new ShooterDownloadJob();
                        dlJob.VideoFilePath = filePath;
                        dlJob.JobId = row.Index;
                        dlJob.ProgressUpdate += OnDownloadStatusUpdate;
                        _jobQueue.AddJob(dlJob);
                    }
                }
            }
            else if(_currentUIStatus == UIStatus.Downloading)
            {
                //Cancel Download
                ChangeUIStatus(UIStatus.Canceling);
                _jobQueue.Reset();
                ChangeUIStatus(UIStatus.StandBy);
                LogMan.Instance.Log(Resources.InfoDownloadCanceled);
            }
        }