public void InitialiseFromElement(DOMElement e, StateStub[] controllerStateStore) { Guid = e.Attributes.GetNamedItem("roomGuid").Value; Name = e.Attributes.GetNamedItem("roomName").Value; Url = e.Attributes.GetNamedItem("roomUrl").Value; Pinable = bool.Parse(e.Attributes.GetNamedItem("roomPinable").Value); pinned = bool.Parse(e.Attributes.GetNamedItem("roomPinned").Value); starred = bool.Parse(e.Attributes.GetNamedItem("roomStarred").Value); Starrable = bool.Parse(e.Attributes.GetNamedItem("roomStarrable").Value); isStarredByDefault = bool.Parse(e.Attributes.GetNamedItem("roomIsStarredByDefault").Value); ReadOnly = bool.Parse(e.Attributes.GetNamedItem("roomReadOnly").Value); IsPhotoChatRoom = bool.Parse(e.Attributes.GetNamedItem("roomIsPhotoChatRoom").Value); IsPrivateChatRoom = bool.Parse(e.Attributes.GetNamedItem("roomIsPrivateChatRoom").Value); IsNewPhotoAlertsRoom = bool.Parse(e.Attributes.GetNamedItem("roomIsNewPhotoAlertsRoom").Value); Presence = (PresenceState)int.ParseInvariant(e.Attributes.GetNamedItem("roomPresence").Value); Icon = e.Attributes.GetNamedItem("roomIcon").Value; tokenDateTimeTicks = e.Attributes.GetNamedItem("roomTokenDateTimeTicks").Value; token = e.Attributes.GetNamedItem("roomToken").Value; hasArchive = bool.Parse(e.Attributes.GetNamedItem("roomHasArchive").Value); hiddenFromRoomList = bool.Parse(e.Attributes.GetNamedItem("roomHiddenFromRoomList").Value); isStreamRoom = bool.Parse(e.Attributes.GetNamedItem("roomisStreamRoom").Value); state = new StateStub(); state.Initialise( Guid, bool.Parse(e.Attributes.GetNamedItem("roomSelected").Value), bool.Parse(e.Attributes.GetNamedItem("roomGuest").Value), int.ParseInvariant(e.Attributes.GetNamedItem("roomNewMessages").Value), int.ParseInvariant(e.Attributes.GetNamedItem("roomTotalMessages").Value), e.Attributes.GetNamedItem("roomLatestItem").Value, e.Attributes.GetNamedItem("roomLatestItemSeen").Value, e.Attributes.GetNamedItem("roomLatestItemOld").Value, int.ParseInvariant(e.Attributes.GetNamedItem("roomListOrder").Value), tokenDateTimeTicks, token); addToStateStoreIfNotAlreadyThere(controllerStateStore, state); stub = new RoomStub( Parent.ClientID, Guid, Name, Url, Pinned, Starred, isStarredByDefault, Pinable, Starrable, Selected, Guest, NewMessages, TotalMessages, LatestItem, LatestItemSeen, LatestItemOld, ReadOnly, state.listOrder, IsPhotoChatRoom, IsPrivateChatRoom, IsNewPhotoAlertsRoom, Presence, Icon, tokenDateTimeTicks, token, hasArchive, hiddenFromRoomList, isStreamRoom); html = new RoomHtml(stub, LoggedIn); InitialiseElements(""); genericInitialise(); }
public void InitialiseFromStub(RoomStub roomStub, DOMElement roomList, StateStub[] controllerStateStore) { stub = roomStub; Guid = stub.guid; Name = stub.name; Url = stub.url; Pinable = stub.pinable; pinned = stub.pinned; starred = stub.starred; Starrable = stub.starrable; isStarredByDefault = stub.isStarredByDefault; ReadOnly = stub.readOnly; IsPhotoChatRoom = stub.isPhotoChatRoom; IsPrivateChatRoom = stub.isPrivateChatRoom; IsNewPhotoAlertsRoom = stub.isNewPhotoAlertsRoom; Presence = stub.presence; tokenDateTimeTicks = stub.tokenDateTimeTicks; token = stub.token; hasArchive = stub.hasArchive; state = new StateStub(); state.Initialise( stub.guid, stub.selected, stub.guest, stub.newMessages, stub.totalMessages, stub.latestItem, stub.latestItemSeen, stub.latestItemOld, stub.listOrder, stub.tokenDateTimeTicks, stub.token); addToStateStoreIfNotAlreadyThere(controllerStateStore, state); html = new RoomHtml(stub, LoggedIn); string outerClientID = roomStub.parentClientID + "_Room_" + Guid + "_Outer"; DOMElement newNode = Document.CreateElement("span"); newNode.ID = outerClientID; newNode.InnerHTML = html.ToHtml(); roomList.AppendChild(newNode.FirstChild); InitialiseElements(outerClientID); genericInitialise(); }
void addContorls(Dictionary<Guid, RoomStub> rooms, List<Guid> roomsOrder, ref bool hasGuestRooms, ref bool hasPrivateRooms) { foreach (Guid g in roomsOrder) { RoomHtml roomHtml = new RoomHtml(rooms[g], Usr.Current != null); if (rooms[g].guest) { hasGuestRooms = true; RoomGuestList.Controls.Add(new LiteralControl(roomHtml.ToHtml())); } else if (rooms[g].isPrivateChatRoom) { hasPrivateRooms = true; RoomPrivateList.Controls.Add(new LiteralControl(roomHtml.ToHtml())); } else { RoomList.Controls.Add(new LiteralControl(roomHtml.ToHtml())); } } }