source: other-projects/playing-in-the-street/summer-2013/trunk/Playing-in-the-Street-WPF/Microsoft.Samples.Kinect.Webserver/Sensor/SensorStreamHandlerFactory.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.6 KB
Line 
1// -----------------------------------------------------------------------
2// <copyright file="SensorStreamHandlerFactory.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 Microsoft.Samples.Kinect.Webserver.Properties;
11
12 /// <summary>
13 /// The supported sensor stream type.
14 /// </summary>
15 public enum StreamHandlerType
16 {
17 Skeleton,
18 Interaction,
19 BackgroundRemoval,
20 SensorStatus,
21 }
22
23 /// <summary>
24 /// Implementation of ISensorStreamHandlerFactory used to create instances of
25 /// sensor stream handler objects.
26 /// </summary>
27 public class SensorStreamHandlerFactory : ISensorStreamHandlerFactory
28 {
29 /// <summary>
30 /// The type of the created stream.
31 /// </summary>
32 private readonly StreamHandlerType streamType;
33
34 /// <summary>
35 /// Initializes a new instance of the <see cref="SensorStreamHandlerFactory"/> class.
36 /// </summary>
37 /// <param name="streamType">The stream type.</param>
38 public SensorStreamHandlerFactory(StreamHandlerType streamType)
39 {
40 this.streamType = streamType;
41 }
42
43 /// <summary>
44 /// Creates a sensor stream handler object and associates it with a context that
45 /// allows it to communicate with its owner.
46 /// </summary>
47 /// <param name="context">
48 /// An instance of <see cref="SensorStreamHandlerContext"/> class.
49 /// </param>
50 /// <returns>
51 /// A new <see cref="ISensorStreamHandler"/> instance.
52 /// </returns>
53 public ISensorStreamHandler CreateHandler(SensorStreamHandlerContext context)
54 {
55 switch (streamType)
56 {
57 case StreamHandlerType.Skeleton:
58 return new SkeletonStreamHandler(context);
59 case StreamHandlerType.Interaction:
60 return new InteractionStreamHandler(context);
61 case StreamHandlerType.BackgroundRemoval:
62 return new BackgroundRemovalStreamHandler(context);
63 case StreamHandlerType.SensorStatus:
64 return new SensorStatusStreamHandler(context);
65 default:
66 throw new NotSupportedException(Resources.UnsupportedStreamType);
67 }
68 }
69 }
70}
Note: See TracBrowser for help on using the repository browser.