Ejemplo n.º 1
0
        public void StartJob(VlcJob job)
        {
            logger.Debug("Call to start job. Input file: {0} Output file: {1}", job.InputFile.FullName, job.OutputFile.FullName);
            job.QuitAfer = true; //fairly important if we're tracking it
            var vlcArguments = job.GetVlcArguments();

            job.State = VlcJob.JobState.Started;
            var instance = Starter.Start(vlcArguments, VlcExePath);

            job.Instance       = instance;
            instance.OnExited += OnVlcInstanceExited;
            JobBag.Add(job);
        }
Ejemplo n.º 2
0
        private void OnVlcInstanceExited(object source, EventArgs e)
        {
            var instance = source as IVlcInstance;

            if (instance == null)
            {
                var sourceMustBeAVlcInstance = "Source must be a VLC instance";
                logger.Error(sourceMustBeAVlcInstance);
                throw new InvalidOperationException(sourceMustBeAVlcInstance);
            }
            instance.OnExited -= OnVlcInstanceExited;

            var associatedJob = JobBag.First(x => x.Instance == instance);

            associatedJob.SetJobComplete();
            if (OnJobStateChange != null)
            {
                OnJobStateChange(this, new JobStatusChangedEventArgs {
                    Job = associatedJob
                });
            }
        }