/// ----------------------------------------------------------------------------- /// <summary> /// LoadSettings loads the settings from the Database and displays them /// </summary> /// ----------------------------------------------------------------------------- public override void LoadSettings() { try { if (Page.IsPostBack == false) { //Check for existing settings and use those on this page //Settings["SettingName"] txtStartMessage.Text = Settings.Contains("StartMessage") ? Settings["StartMessage"].ToString() : Localization.GetString("DefaultStartMessage", "/DesktopModules/DnnChat/App_LocalResources/SharedResources.resx"); txtDefaultAvatarUrl.Text = Settings.Contains("DefaultAvatarUrl") ? Settings["DefaultAvatarUrl"].ToString() : Localization.GetString("DefaultAvatarUrl", "/DesktopModules/DnnChat/App_LocalResources/SharedResources.resx"); var rc = new RoomController(); ddlDefaultRoom.DataSource = rc.GetRooms(ModuleId); ddlDefaultRoom.DataBind(); if (Settings.Contains("DefaultRoomId")) { ddlDefaultRoom.Items.FindByValue(Settings["DefaultRoomId"].ToString()).Selected = true; } } } catch (Exception exc) //Module failed to load { Exceptions.ProcessModuleLoadException(this, exc); } }
public void GetRoomList() { int moduleId = Convert.ToInt32(Clients.Caller.moduleid); var rc = new RoomController(); var allRooms = rc.GetRooms(moduleId); Clients.Caller.FillLobby(allRooms); }
//TODO: on connection, reload rooms for user? public Task Join() { int moduleId = Convert.ToInt32(Clients.Caller.moduleid); var settingsDefault = new Guid(Clients.Caller.defaultRoomId); if (DefaultRoomId != settingsDefault) { DefaultRoomId = settingsDefault; } //get list of previously connected (not departed) rooms var crrc = new ConnectionRecordRoomController(); var rc = new RoomController(); IEnumerable <Room> myRooms = null; //don't do this if we've got a private room loaded. if (Convert.ToInt32(Clients.Caller.userid) > 0) { myRooms = crrc.GetConnectionRecordRoomsByUserId((int)Clients.Caller.userid); } //TODO: the default room doesn't have a moduleid associated with it //if myRooms is empty, what to do (pass default room) if (myRooms == null) { //load the default room var r = rc.GetRoom(DefaultRoomId, moduleId); myRooms = new List <Room>(); myRooms = myRooms.Concat(new[] { r }); } else { //load the current default room to see if it is in the queue var r = rc.GetRoom(DefaultRoomId, moduleId); if (!myRooms.Contains(r)) { myRooms = myRooms.Concat(new[] { r }); } } //get all the active rooms and send it back for the Lobby var allRooms = rc.GetRooms(moduleId); //we are passing in a list of All rooms, and the current user's rooms Clients.Caller.PopulateUser(allRooms, myRooms); return(base.OnConnected()); }