Esempio n. 1
0
 public override void Unloading()
 {
     StopServer();
     //We are the only current consumer of LiveContext, so shut it off when we are done.
     if (LiveContext != null)
     {
         VixenSystem.Contexts.ReleaseContext(LiveContext);
         LiveContext = null;
     }
 }
Esempio n. 2
0
		private void PreviewPlay()
		{
			if (_previewContext == null)
			{
				_previewContext = VixenSystem.Contexts.CreateLiveContext("Effect Preview");
				_previewContext.Start();

			}
			IEnumerable<EffectNode> orderedNodes = Elements.Select(x => x.EffectNode).OrderBy(x => x.StartTime).ToList();
			if (orderedNodes.Any())
			{
				TimeSpan startOffset = orderedNodes.First().StartTime;
				TimeSpan duration = orderedNodes.Last().EndTime - startOffset;
				List<EffectNode> nodesToPlay =
					orderedNodes.Select(effectNode => new EffectNode(effectNode.Effect, effectNode.StartTime - startOffset)).ToList();
				_previewContext.Execute(nodesToPlay);
				_previewLoopTimer.Interval = duration.TotalMilliseconds;
				_previewLoopTimer.Start();
			}
		}
Esempio n. 3
0
        private void _SetServerEnableState(bool value, int port)
        {
            if (value) {
                if (server != null) _SetServerEnableState(false, port);

                server = KayakServer.Factory.CreateHttp(new RequestDelegate(), scheduler);
                server.Listen(new IPEndPoint(IPAddress.Any, port));
                LiveSystemContext = VixenSystem.Contexts.GetSystemLiveContext();

                Thread T = new Thread(new ThreadStart(scheduler.Start));
                T.Start();
            } else {
                scheduler.Stop();
                if (server != null) {
                    server.Dispose();
                    server = null;
                }
                LiveSystemContext = null;
            }
        }
Esempio n. 4
0
        private void _SetServerEnableState(bool value, int port)
        {
            if (value)
            {
                StopServer();
                var options = new StartOptions {ServerFactory = "Nowin", Port = port}; //use the Nowin _server to listen for connections
                try
                {
                    _server = WebApp.Start<Startup>(options);
                }
                catch (Exception ex)
                {
                    Logging.Error("Unable to start web _server.", ex);
                    return;
                }
                if (LiveContext == null)
                {
                    LiveContext = VixenSystem.Contexts.CreateLiveContext("Web Server");
                    LiveContext.Start();
                }

            }
            else
            {
                StopServer();
                if (LiveContext != null)
                {
                    //We are the only current consumer of LiveContext, so shut it off when we are done.
                    VixenSystem.Contexts.ReleaseContext(LiveContext);
                    LiveContext = null;
                }
            }
        }
Esempio n. 5
0
        private void _SetServerEnableState(bool value, int port)
        {
            if (value) {
                if (server != null) _SetServerEnableState(false, port);

                server = KayakServer.Factory.CreateHttp(new RequestDelegate(), scheduler);
                server.Listen(new IPEndPoint(IPAddress.Any, port));
                LiveContext = VixenSystem.Contexts.CreateLiveContext("Web Server");
                LiveContext.Start();
                Thread T = new Thread(new ThreadStart(scheduler.Start));
                T.Start();
            } else {
                scheduler.Stop();
                if (server != null) {
                    server.Dispose();
                    server = null;
                }
                if (LiveContext != null)
                {
                    //We are the only current consumer of LiveContext, so shut it off when we are done.
                    VixenSystem.Contexts.ReleaseContext(LiveContext);
                    LiveContext = null;
                }
            }
        }