NSString GetReuseId(ChatDetayDTO GelenDTO) { if (ME.id == GelenDTO.receiverId)//Incoming { var Boll = GelenDTO.text.Split('#'); if (Boll.Length > 1)//Resim { return(Incoming_Resim_CellId); } else { return(IncomingCellId); } } else //OutGoing { var Boll = GelenDTO.text.Split('#'); if (Boll.Length > 1)//Resim { return(Outgoing_Resim_CellId); } else { return(OutgoingCellId); } } }
nfloat CalculateHeightFor(ChatDetayDTO msg, UITableView tableView) { var Boll = msg.text.Split('#'); if (Boll.Length <= 1)//Resim { int index = -1; if (ME.id == msg.receiverId) //GelenMesaj { index = 0; } else { index = 1; } BubbleCell cell = sizingCells[index]; if (cell == null) { cell = sizingCells[index] = (BubbleCell)tableView.DequeueReusableCell(GetReuseId(msg)); } cell.Message = msg; cell.SetNeedsLayout(); cell.LayoutIfNeeded(); CGSize size = cell.ContentView.SystemLayoutSizeFittingSize(UIView.UILayoutFittingCompressedSize); return(NMath.Ceiling(size.Height) + 1); } else { return(NMath.Ceiling(200f) + 1); } }
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { BubbleCell cell = null; ChatDetayDTO msg = messages[indexPath.Row]; cell = (BubbleCell)tableView.DequeueReusableCell(GetReuseId(msg)); cell.Message = msg; cell.BackgroundColor = UIColor.Clear; return(cell); }
public override nfloat EstimatedHeight(UITableView tableView, NSIndexPath indexPath) { ChatDetayDTO msg = messages[indexPath.Row]; return(CalculateHeightFor(msg, tableView)); }
void MesajGonderGenericMetod(string Message) { if (!string.IsNullOrEmpty(Message.Trim())) { if (!KullaniciEngellemeDurumu) { if (!KisiBilgileriTammi()) { UIAlertView alert = new UIAlertView(); alert.Title = "Buptis"; alert.AddButton("Evet"); alert.AddButton("Hayır"); alert.Message = "Yaş ve Cinsiyet bilgilerinizi tamamlamadan mesaj gönderemezsiniz. Bilgilerini güncellemek ister misiniz?"; alert.AlertViewStyle = UIAlertViewStyle.Default; alert.Clicked += (object s, UIButtonEventArgs ev) => { if (ev.ButtonIndex == 0) { var AyarlarBaseVC1 = UIStoryboard.FromName("AyarlarBaseVC", NSBundle.MainBundle); TemelBilgilerVC controller = AyarlarBaseVC1.InstantiateViewController("TemelBilgilerVC") as TemelBilgilerVC; controller.ModalPresentationStyle = UIModalPresentationStyle.FullScreen; this.PresentViewController(controller, true, null); alert.Dispose(); } else { alert.Dispose(); } }; alert.Show(); } else { ChatDetayDTO chatRecyclerViewDataModel = new ChatDetayDTO() { userId = MeDTO.id, receiverId = MesajlarIcinSecilenKullanici.Kullanici.id, text = Message, key = MesajlarIcinSecilenKullanici.key }; WebService webService = new WebService(); string jsonString = JsonConvert.SerializeObject(chatRecyclerViewDataModel); var Donus = webService.ServisIslem("chats", jsonString); if (Donus != "Hata") { var Icerikk = Newtonsoft.Json.JsonConvert.DeserializeObject <KeyIslemleriIcinDTO>(Donus.ToString()); MesajText.Text = ""; SaveKeys(Icerikk); } else { KredisimiBitti(); return; } } } else { CustomAlert.GetCustomAlert(this, "Kullanıcı Engelli"); } } }