Exemple #1
0
        private void _Execute(TimeSpan startTime, TimeSpan endTime)
        {
            _CommitChanges();

            Cursor = Cursors.WaitCursor;
            try {
                listBoxRuntimeErrors.Items.Clear();

                _context = VixenSystem.Contexts.CreateSequenceContext(new ContextFeatures(ContextCaching.NoCaching), Sequence);
                if (_context == null)
                {
                    MessageBox.Show(this, "Unable to play this sequence.  See error log for details.", "Script Editor",
                                    MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    return;
                }
                _context.SequenceEnded += _context_SequenceEnded;
                _context.Message       += _context_Message;
                _context.Error         += _context_Error;
                _context.Play(startTime, endTime);
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message);
            }
            finally {
                Cursor = Cursors.Default;
            }
        }
Exemple #2
0
        /// <summary>
        /// Play a sequence of a given file name.
        /// </summary>
        /// <param name="sequence"></param>
        /// <returns></returns>
        public static ContextStatus PlaySequence(Sequence sequence)
        {
            var status = new ContextStatus();

            if (sequence == null)
            {
                throw new ArgumentNullException("sequence");
            }

            IEnumerable <IContext> contexts = VixenSystem.Contexts.Where(x => x.Name.Equals(sequence.Name) && (x.IsRunning || x.IsPaused));

            if (contexts.Any(x => x.IsPaused))
            {
                foreach (var context in contexts)
                {
                    if (context.IsPaused)
                    {
                        context.Resume();
                    }
                }
                status.Message = string.Format("Resumed {0}", sequence.Name);
            }
            else
            {
                string fileName = HttpUtility.UrlDecode(sequence.FileName);

                ISequence seq = SequenceService.Instance.Load(fileName);
                if (seq != null)
                {
                    Logging.Info(string.Format("Web - Prerendering effects for sequence: {0}", sequence.Name));
                    Parallel.ForEach(seq.SequenceData.EffectData.Cast <IEffectNode>(), effectNode => effectNode.Effect.PreRender());

                    ISequenceContext context = VixenSystem.Contexts.CreateSequenceContext(
                        new ContextFeatures(ContextCaching.NoCaching), seq);
                    context.ContextEnded += context_ContextEnded;
                    context.Play(TimeSpan.Zero, seq.Length);
                    status.State    = ContextStatus.States.Playing;
                    status.Sequence = new Sequence()
                    {
                        Name     = context.Sequence.Name,
                        FileName = fileName
                    };

                    status.Message = string.Format("Playing sequence {0} of length {1}", sequence.Name, seq.Length);
                }
                else
                {
                    status.Message = string.Format("Sequence {0} not found.", fileName);
                }
            }


            return(status);
        }
        private void PlaySequence(HttpRequestHead request, IHttpResponseDelegate response)
        {
            HttpResponseHead headers;
            var status = new Status();
            NameValueCollection parms = GetParameters(request);

            if (!parms.HasKeys() && parms["name"] != null)
            {
                headers = GetHeaders(0, HttpStatusCode.BadRequest.ToString());
                response.OnResponse(headers, new BufferedProducer(""));
                return;
            }

            string fileName = HttpUtility.UrlDecode(parms["name"]);

            if (_context != null && (_context.IsRunning))
            {
                status.Message = string.Format("Already playing {0}", _context.Sequence.Name);
            }
            else
            {
                ISequence sequence = SequenceService.Instance.Load(fileName);
                if (sequence == null)
                {
                    headers        = GetOkHeaders(0);
                    headers.Status = HttpStatusCode.NotFound.ToString();
                    response.OnResponse(headers, new BufferedProducer(""));
                    return;
                }
                Logging.Info(string.Format("Web - Prerendering effects for sequence: {0}", sequence.Name));
                Parallel.ForEach(sequence.SequenceData.EffectData.Cast <IEffectNode>(), effectNode => effectNode.Effect.PreRender());

                _context = VixenSystem.Contexts.CreateSequenceContext(new ContextFeatures(ContextCaching.NoCaching), sequence);
                _context.ContextEnded += context_ContextEnded;
                _context.Play(TimeSpan.Zero, sequence.Length);
                status.Message = string.Format("Playing sequence {0} of length {1}", sequence.Name, sequence.Length);
            }

            SerializeResponse(status, response);
        }
Exemple #4
0
        private void _Execute(TimeSpan startTime, TimeSpan endTime)
        {
            _CommitChanges();

            Cursor = Cursors.WaitCursor;
            try {
                listBoxRuntimeErrors.Items.Clear();

                _context = VixenSystem.Contexts.CreateSequenceContext(new ContextFeatures(ContextCaching.NoCaching), Sequence);
                if (_context == null) {
                    MessageBox.Show(this, "Unable to play this sequence.  See error log for details.", "Script Editor",
                                    MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    return;
                }
                _context.SequenceEnded += _context_SequenceEnded;
                _context.Message += _context_Message;
                _context.Error += _context_Error;
                _context.Play(startTime, endTime);
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message);
            }
            finally {
                Cursor = Cursors.Default;
            }
        }
Exemple #5
0
        private void PlaySequence(HttpRequestHead request, IHttpResponseDelegate response)
        {
            HttpResponseHead headers;
            var status = new Status();
            NameValueCollection parms = GetParameters(request);

            if(!parms.HasKeys() && parms["name"] != null)
            {
                headers = GetHeaders(0, HttpStatusCode.BadRequest.ToString());
                response.OnResponse(headers,new BufferedProducer(""));
                return;
            }

            string fileName = HttpUtility.UrlDecode(parms["name"]);
            if (_context != null && (_context.IsRunning))
            {
                status.Message = string.Format("Already playing {0}", _context.Sequence.Name);
            }
            else
            {
                ISequence sequence = SequenceService.Instance.Load(fileName);
                if (sequence == null)
                {
                    headers = GetOkHeaders(0);
                    headers.Status = HttpStatusCode.NotFound.ToString();
                    response.OnResponse(headers, new BufferedProducer(""));
                    return;
                }
                Logging.Info(string.Format("Web - Prerendering effects for sequence: {0}", sequence.Name));
                Parallel.ForEach(sequence.SequenceData.EffectData.Cast<IEffectNode>(), effectNode  => effectNode.Effect.PreRender());

                _context = VixenSystem.Contexts.CreateSequenceContext(new ContextFeatures(ContextCaching.NoCaching), sequence);
                _context.ContextEnded += context_ContextEnded;
                _context.Play(TimeSpan.Zero, sequence.Length);
                status.Message = string.Format("Playing sequence {0} of length {1}", sequence.Name, sequence.Length);
            }

            SerializeResponse(status,response);
        }