Example #1
0
        public static void Start()
        {
            if (restServer != null && restServer.IsListening)
            {
                return;
            }

            try
            {
                restServer = RestServerBuilder.From <Startup>().Build();
                //restServer = RestServerBuilder.UseDefaults().Build();

                //Urls = restServer.Prefixes.ToList();

                restServer.AfterStarting += (s) =>
                {
                    Process.Start("explorer", s.Prefixes.First());
                };

                restServer.AfterStopping += (s) =>
                {
                    Console.WriteLine("Web-Server beendet.");
                };

                //Urls = restServer.Prefixes.ToList();
                restServer.Start();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public void Start()
        {
            _restServer.Start();

            // start streaming server
            _streamingServer.Start();

            _playbackService.FrameAvailable += _streamingServer.Send;
            _recordService.FrameAvailable   += _streamingServer.Send;

            foreach (var restRouter in _restRouters)
            {
                restRouter.OnGetSessionCalled    += HandleOnGetSessionCalled;
                restRouter.OnPlayCalled          += HandleOnPlayCalled;
                restRouter.OnPausePlaybackCalled += HandleOnPausePlaybackCalled;
                restRouter.OnStopPlaybackCalled  += HandleOnStopPlaybackCalled;
                restRouter.OnJumpPlaybackCalled  += HandleOnJumpPlaybackCalled;
                restRouter.OnRecordSessionCalled += HandleOnRecordSessionCalled;
                restRouter.OnStopRecordCalled    += HandleOnStopRecordCalled;
            }

            switch (_startMode)
            {
            case "record":
                StartRecord();
                break;

            case "playback":
                // nothing to to without session to play
                break;
            }
        }
Example #3
0
 /// <summary>
 /// Starts the server and blocks the calling thread until the server stops listening
 /// </summary>
 public static void Run(this IRestServer server)
 {
     server.Start();
     while (server.IsListening)
     {
     }
 }
Example #4
0
 /// <summary>
 /// Adds a server to the cluster
 /// </summary>
 public void Add(string label, IRestServer server)
 {
     if (_started)
     {
         server.Start();
     }
     _servers.Add(label, server);
 }
Example #5
0
 /// <summary>
 /// Adds a server to the cluster
 /// </summary>
 public void Add(string label, IRestServer server)
 {
     Servers.Add(label, server);
     if (Started)
     {
         OnBeforeStartEach?.Invoke(server);
         server.Start();
         OnAfterStartEach?.Invoke(server);
     }
 }
        protected override void OnStartup(object sender, StartupEventArgs e)
        {
            MainKernel.Load<MainModule>();
            MainKernel.Load<QueueItemModule>();
            MainKernel.Load<ClientModule>();

            _restServer = MainKernel.Get<IRestServer>();
            _restServer.Start();

            DisplayRootViewFor<IMainViewModel>();
        }