AR Design
UBC EML collab with UBC SALA - visualizing IoT data in AR
SessionManagerAdapter.cs
Go to the documentation of this file.
1 // Copyright (c) Microsoft Corporation. All rights reserved.
2 // Licensed under the MIT License. See LICENSE in the project root for license information.
3 
4 namespace HoloToolkit.Sharing
5 {
11  {
12  public event System.Action<Session> CreateSucceededEvent;
13  public event System.Action<XString> CreateFailedEvent;
14  public event System.Action<Session> SessionAddedEvent;
15  public event System.Action<Session> SessionClosedEvent;
16  public event System.Action<Session, User> UserJoinedSessionEvent;
17  public event System.Action<Session, User> UserLeftSessionEvent;
18  public event System.Action<Session, User> UserChangedEvent;
19  public event System.Action ServerConnectedEvent;
20  public event System.Action ServerDisconnectedEvent;
21 
22  public SessionManagerAdapter() { }
23 
24  public override void OnCreateSucceeded(Session newSession)
25  {
26  Profile.BeginRange("OnCreateSucceeded");
27  if (this.CreateSucceededEvent != null)
28  {
29  this.CreateSucceededEvent(newSession);
30  }
31  Profile.EndRange();
32  }
33 
34  public override void OnCreateFailed(XString reason)
35  {
36  Profile.BeginRange("OnCreateFailed");
37  if (this.CreateFailedEvent != null)
38  {
39  this.CreateFailedEvent(reason);
40  }
41  Profile.EndRange();
42  }
43 
44  public override void OnSessionAdded(Session newSession)
45  {
46  Profile.BeginRange("OnSessionAdded");
47  if (this.SessionAddedEvent != null)
48  {
49  this.SessionAddedEvent(newSession);
50  }
51  Profile.EndRange();
52  }
53 
54  public override void OnSessionClosed(Session session)
55  {
56  Profile.BeginRange("OnSessionClosed");
57  if (this.SessionClosedEvent != null)
58  {
59  this.SessionClosedEvent(session);
60  }
61  Profile.EndRange();
62  }
63 
64  public override void OnUserJoinedSession(Session session, User newUser)
65  {
66  Profile.BeginRange("OnUserJoinedSession");
67  if (this.UserJoinedSessionEvent != null)
68  {
69  this.UserJoinedSessionEvent(session, newUser);
70  }
71  Profile.EndRange();
72  }
73 
74  public override void OnUserLeftSession(Session session, User user)
75  {
76  Profile.BeginRange("OnUserLeftSession");
77  if (this.UserLeftSessionEvent != null)
78  {
79  this.UserLeftSessionEvent(session, user);
80  }
81  Profile.EndRange();
82  }
83 
84  public override void OnUserChanged(Session session, User user)
85  {
86  Profile.BeginRange("OnUserChanged");
87  if (this.UserChangedEvent != null)
88  {
89  this.UserChangedEvent(session, user);
90  }
91  Profile.EndRange();
92  }
93 
94  public override void OnServerConnected()
95  {
96  Profile.BeginRange("OnServerConnected");
97  if (this.ServerConnectedEvent != null)
98  {
99  this.ServerConnectedEvent();
100  }
101  Profile.EndRange();
102  }
103 
104  public override void OnServerDisconnected()
105  {
106  Profile.BeginRange("OnServerDisconnected");
107  if (this.ServerDisconnectedEvent != null)
108  {
109  this.ServerDisconnectedEvent();
110  }
111  Profile.EndRange();
112  }
113  }
114 }
override void OnSessionAdded(Session newSession)
override void OnSessionClosed(Session session)
System.Action< Session, User > UserChangedEvent
System.Action< Session, User > UserLeftSessionEvent
override void OnCreateFailed(XString reason)
override void OnUserJoinedSession(Session session, User newUser)
override void OnUserChanged(Session session, User user)
override void OnCreateSucceeded(Session newSession)
static void EndRange()
Definition: Profile.cs:48
override void OnUserLeftSession(Session session, User user)
System.Action< Session, User > UserJoinedSessionEvent
Allows users of the SessionManager to register to receive event callbacks without having their classe...
static void BeginRange(string name)
Definition: Profile.cs:43