source: other-projects/playing-in-the-street/summer-2013/trunk/Playing-in-the-Street-WPF/Microsoft.Samples.Kinect.Webserver/Sensor/SensorStreamHandlerContext.cs@ 28897

Last change on this file since 28897 was 28897, checked in by davidb, 10 years ago

GUI front-end to server base plus web page content

File size: 2.7 KB
Line 
1//------------------------------------------------------------------------------
2// <copyright file="SensorStreamHandlerContext.cs" company="Microsoft">
3// Copyright (c) Microsoft Corporation. All rights reserved.
4// </copyright>
5//------------------------------------------------------------------------------
6
7namespace Microsoft.Samples.Kinect.Webserver.Sensor
8{
9 using System;
10 using System.Threading.Tasks;
11
12 using Microsoft.Samples.Kinect.Webserver.Sensor.Serialization;
13
14 /// <summary>
15 /// Provides context through which an instance of <see cref="ISensorStreamHandler"/> can
16 /// communicate back with its owner.
17 /// </summary>
18 public sealed class SensorStreamHandlerContext
19 {
20 /// <summary>
21 /// Initializes a new instance of the <see cref="SensorStreamHandlerContext"/> class.
22 /// </summary>
23 /// <param name="sendTwoPartStreamMessageAsync">
24 /// Function used to asynchronously send two-part (textual header plus binary payload) stream
25 /// message to client(s) of stream handler. If binary (second) part of message is null, only
26 /// textual header (first) part will be sent.
27 /// </param>
28 /// <param name="sendEventMessageAsync">
29 /// Function used to asynchronously send event message to client(s) of stream handler.
30 /// </param>
31 public SensorStreamHandlerContext(
32 Func<StreamMessage, byte[], Task> sendTwoPartStreamMessageAsync,
33 Func<EventMessage, Task> sendEventMessageAsync)
34 {
35 this.SendTwoPartStreamMessageAsync = sendTwoPartStreamMessageAsync;
36 this.SendStreamMessageAsync = message => sendTwoPartStreamMessageAsync(message, null);
37 this.SendEventMessageAsync = sendEventMessageAsync;
38 }
39
40 /// <summary>
41 /// Function used to asynchronously send stream message to client(s) of stream handler.
42 /// </summary>
43 public Func<StreamMessage, Task> SendStreamMessageAsync { get; private set; }
44
45 /// <summary>
46 /// Function used to asynchronously send two-part (textual header plus binary payload) stream
47 /// message to client(s) of stream handler. If binary (second) part of message is null, only
48 /// textual header (first) part will be sent.
49 /// </summary>
50 public Func<StreamMessage, byte[], Task> SendTwoPartStreamMessageAsync { get; private set; }
51
52 /// <summary>
53 /// Function used to asynchronously send event message to client(s) of stream handler.
54 /// </summary>
55 public Func<EventMessage, Task> SendEventMessageAsync { get; private set; }
56 }
57}
Note: See TracBrowser for help on using the repository browser.