Пример #1
0
 internal RobotHttpServer(int serverPort, HoloLensRobot bot)
 {
     this.bot = bot;
     sock = new StreamSocketListener();
     sock.Control.KeepAlive = true;
     defaultPort = serverPort;
     sock.ConnectionReceived += async (s, e) => await ProcessRequestAsync(e.Socket);
 }
Пример #2
0
 internal RobotHttpServer(int serverPort, HoloLensRobot bot)
 {
     this.bot = bot;
     sock     = new StreamSocketListener();
     sock.Control.KeepAlive   = true;
     defaultPort              = serverPort;
     sock.ConnectionReceived += async(s, e) => await ProcessRequestAsync(e.Socket);
 }
Пример #3
0
        public void Run(IBackgroundTaskInstance taskInstance)
        {
            // Ensure our background task remains running
            taskDeferral = taskInstance.GetDeferral();

            // Example: Create a timer-initiated ThreadPool task
            RobotStateTimer = ThreadPoolTimer.CreatePeriodicTimer(PopulateRobotStateData, TimeSpan.FromSeconds(TaskIntervalSeconds));

            Bot = new HoloLensRobot();

            // Start the server
            server = new RobotHttpServer(port, Bot);
            var asyncAction = ThreadPool.RunAsync((w) => { server.StartServer(); });

            // Task cancellation handler, release our deferral there 
            taskInstance.Canceled += OnCanceled;
        }
Пример #4
0
        public void Run(IBackgroundTaskInstance taskInstance)
        {
            // Ensure our background task remains running
            taskDeferral = taskInstance.GetDeferral();

            // Example: Create a timer-initiated ThreadPool task
            RobotStateTimer = ThreadPoolTimer.CreatePeriodicTimer(PopulateRobotStateData, TimeSpan.FromSeconds(TaskIntervalSeconds));

            Bot = new HoloLensRobot();

            // Start the server
            server = new RobotHttpServer(port, Bot);
            var asyncAction = ThreadPool.RunAsync((w) => { server.StartServer(); });

            // Task cancellation handler, release our deferral there
            taskInstance.Canceled += OnCanceled;
        }