AR Design
UBC EML collab with UBC SALA - visualizing IoT data in AR
RoomManagerAdapter.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<Room> RoomAddedEvent;
13  public event System.Action<Room> RoomClosedEvent;
14  public event System.Action<Room, int> UserJoinedRoomEvent;
15  public event System.Action<Room, int> UserLeftRoomEvent;
16  public event System.Action<Room> AnchorsChangedEvent;
18  public event System.Action<bool, XString> AnchorUploadedEvent;
19 
20  public RoomManagerAdapter() { }
21 
22  public override void OnRoomAdded(Room newRoom)
23  {
24  Profile.BeginRange("OnRoomAdded");
25  if (this.RoomAddedEvent != null)
26  {
27  this.RoomAddedEvent(newRoom);
28  }
29  Profile.EndRange();
30  }
31 
32  public override void OnRoomClosed(Room room)
33  {
34  Profile.BeginRange("OnRoomClosed");
35  if (this.RoomClosedEvent != null)
36  {
37  this.RoomClosedEvent(room);
38  }
39  Profile.EndRange();
40  }
41 
42  public override void OnUserJoinedRoom(Room room, int user)
43  {
44  Profile.BeginRange("OnUserJoinedRoom");
45  if (this.UserJoinedRoomEvent != null)
46  {
47  this.UserJoinedRoomEvent(room, user);
48  }
49  Profile.EndRange();
50  }
51 
52  public override void OnUserLeftRoom(Room room, int user)
53  {
54  Profile.BeginRange("OnUserLeftRoom");
55  if (this.UserLeftRoomEvent != null)
56  {
57  this.UserLeftRoomEvent(room, user);
58  }
59  Profile.EndRange();
60  }
61 
62  public override void OnAnchorsChanged(Room room)
63  {
64  Profile.BeginRange("OnAnchorsChanged");
65  if (this.AnchorsChangedEvent != null)
66  {
67  this.AnchorsChangedEvent(room);
68  }
69  Profile.EndRange();
70  }
71 
72  public override void OnAnchorsDownloaded(bool successful, AnchorDownloadRequest request, XString failureReason)
73  {
74  Profile.BeginRange("OnAnchorsDownloaded");
75  if (this.AnchorsDownloadedEvent != null)
76  {
77  this.AnchorsDownloadedEvent(successful, request, failureReason);
78  }
79  Profile.EndRange();
80  }
81 
82  public override void OnAnchorUploadComplete(bool successful, XString failureReason)
83  {
84  Profile.BeginRange("OnAnchorUploadComplete");
85  if (this.AnchorUploadedEvent != null)
86  {
87  this.AnchorUploadedEvent(successful, failureReason);
88  }
89  Profile.EndRange();
90  }
91  }
92 }
override void OnAnchorsChanged(Room room)
override void OnUserJoinedRoom(Room room, int user)
System.Action< bool, AnchorDownloadRequest, XString > AnchorsDownloadedEvent
override void OnAnchorsDownloaded(bool successful, AnchorDownloadRequest request, XString failureReason)
System.Action< bool, XString > AnchorUploadedEvent
override void OnAnchorUploadComplete(bool successful, XString failureReason)
override void OnRoomAdded(Room newRoom)
System.Action< Room, int > UserJoinedRoomEvent
override void OnUserLeftRoom(Room room, int user)
System.Action< Room, int > UserLeftRoomEvent
static void EndRange()
Definition: Profile.cs:48
Allows users of the RoomManager to register to receive event callbacks without having their classes i...
static void BeginRange(string name)
Definition: Profile.cs:43