コード例 #1
0
		private void LoadTable(ChatBubbleCell _cell)
		{

			List<CustomCellGroup> cellGroups = new List<CustomCellGroup>();
			tableCellGroup = new CustomCellGroup();
			cellGroups.Add(tableCellGroup);

			ChatBubbleCell cell;
			for (int x = 0; x < messages.Count; x++) {
				cell = new ChatBubbleCell(isLeft[x], false, isdelivered[x]);
				cell.Update(messages[x], timeStamps[x]);
				cell.SetMessageID(message_ids[x]);
				if (!isdelivered[x])
					cell.SetAsUndelivered();
				tableCellGroup.Cells.Add(cell);
			}

			if (_cell != null) {
				tableCellGroup.Cells.Add(_cell);
			} 

			SetTableSize();


//			//Pending
//			cell = new ChatBubbleCell(false);
//			cell.Update ("This is a pending cell", "8:00 PM");
//			cell.SetAsPending ();
//			tableCellGroup.Cells.Add (cell);
//
//			//Undelivered
//			cell = new ChatBubbleCell(true);
//			cell.Update ("This is a undelivered cell", "8:05 PM");
//			cell.SetAsUndelivered ();
//			tableCellGroup.Cells.Add (cell);

			source = new CustomCellTableSource(cellGroups);
			source.RowSelectedAction = RowSelected;
			source.DeleteAction = DeleteSelected;
			source.DeleteTitle = "Delete";
			table.Source = source;
		}
コード例 #2
0
		private async void SendMessageThread(bool isattachment, string message)
		{
			DateTime now = DateTime.Now;
			const string format = "ddd HH:mm tt";
			bool delivered = false;
			try {
				MessageManager.SendMessage(MessageManager.PrepareOutgoingMessage(message, Number));
				delivered = true;
			} catch (StaleDevicesException e) {
				MessageManager.EndSession(Number);
			} catch (Exception e) {
				
				Console.WriteLine("Exception while sending message...." + e.Message);
			}

			using (var conn = new SQLite.SQLiteConnection(AppDelegate._dbPath)) {
				var pmessage = new PushMessage {
					Thread_id = ThreadID,
					Number = Number,
					TimeStamp = AppDelegate.CurrentTimeMillis(),
					TimeStamp_Sent = Convert.ToInt64(AppDelegate.CurrentTimeMillis()),
					Read = 0,
					Message = message,
					Status = delivered,
					Service = "PushLocal"
				};
				conn.Insert(pmessage);
				conn.Commit();
				conn.Close();
			}

			PointF pf = new PointF(0f, (messages.Count + 3) * 64 - table.Bounds.Size.Height);
			table.SetContentOffset(pf, true);

			ChatBubbleCell cell = new ChatBubbleCell(false, false, delivered);
			cell.Update(message, now.ToString(format));
			TableRowHeight = cell.getHeight();
			if (!delivered)
				cell.SetAsUndelivered();
			if (isattachment)
				cell.setImagePreview(thumbnail);
			LoadTable(cell);

			AddDataToConversation();
		}