private void LvRooms_DoubleClick(object sender, EventArgs e) { foreach (ListViewItem listViewItem in lvRooms.SelectedItems) { MatrixRoom matrixRoom = findMatrixroom(listViewItem.ImageKey); openChatWindow(matrixRoom); } }
private void NotificationClickedCallback(object Tag) { MatrixRoom matrixRoom = null; if (Tag is MatrixRoom) { matrixRoom = (MatrixRoom)Tag; } if (Tag is string) { // assume this is a username, todo: pass as instance of e.g. MatrixUser (todo: create class) foreach (MatrixRoom m in matrixRooms) { string username = Tag.ToString(); // todo: maybe better to match instances instead of string comparison. need concept! if (m.roomNameHumanReadable == username) { // found matrixRoom = m; break; } } } if (matrixRoom != null) { Chat chat = findOpenChatForm(matrixRoom.roomID); if (chat == null) { // should not be necessary as we came here from notication that shouldn't have been raised as it should only be rased on closed chat windows chat = new Chat(matrixRoom); chat.Show(); } chat.BringToFront(); } }
/* * private void refreshlstRoomsUpdate() * { * //https://stackoverflow.com/questions/33175381/how-we-can-refresh-items-text-in-listbox-without-reinserting-it * for (int i = 0; i < lstRooms.Items.Count; i++) * { * lstRooms.Items[i] = lstRooms.Items[i]; * } * }*/ private void JoinedRoomsLoadedCallback(MatrixJoinedRoomsResult matrixJoinedRoomsResult) { matrixRooms.Clear(); foreach (string room in matrixJoinedRoomsResult.joined_rooms) { // todo: cache lookup needed? could be in cache, right? MatrixRoom matrixRoom = new MatrixRoom(); matrixRoom.roomID = room; matrixRooms.Add(matrixRoom); lvRooms.Items.Add(matrixRoom.roomID, matrixRoom.roomID); // display roomID, resolve later .. Console.WriteLine("resolving roomname: " + room); Businesslogic.Instance.resolveRoomname(room); Console.WriteLine("resolving avatar for room: " + room); Businesslogic.Instance.resolveRoomAvatar(room); //Businesslogic.Instance.downloadAvatar(matrixRoom.avatarUri); } }
public Chat(MatrixRoom matrixRoom) : this() { MatrixRoom = matrixRoom; tsStatusLabel.Text = ""; }