public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { var type = StaticMethods.DeviceType(); if (type == "ipad") { if (StaticDataModel.CurrentLanguage == "en") { ///English var cell = (ipad_StudentList_tableviewcell)tableView.DequeueReusableCell(ipad_StudentList_tableviewcell.Key); if (cell == null) { cell = ipad_StudentList_tableviewcell.Create(); } //cell.SelectionStyle = UITableViewCellSelectionStyle.None;//Default; var item = tableItems[indexPath.Row]; var index = indexPath.Row; cell.UpdateCell(indexPath.Row, item.student_id, item.s_route_id, item.s_fname + " " + item.family_name, WebService.ImageUrl + item.s_image_path, item.blink_status, item.driver_name, item.driver_contact); cell.SelectionStyle = UITableViewCellSelectionStyle.None; if (index >= 0) { if (index % 2 == 0) { cell.BackgroundColor = new UIColor(red: 0.959f, green: 0.959f, blue: 0.959f, alpha: 1f); } else { cell.BackgroundColor = new UIColor(red: 0.999f, green: 1f, blue: 1f, alpha: 1f); } } cell.Frame = new RectangleF(0, 0, 139, 500); return(cell); } else { ///Arabic var cell = (ar_ipad_StudentList_tableviewcell)tableView.DequeueReusableCell(ar_ipad_StudentList_tableviewcell.Key); if (cell == null) { cell = ar_ipad_StudentList_tableviewcell.Create(); } //cell.SelectionStyle = UITableViewCellSelectionStyle.None;//Default; var item = tableItems[indexPath.Row]; var index = indexPath.Row; cell.UpdateCell(indexPath.Row, item.student_id, item.s_route_id, item.s_fname + " " + item.family_name, WebService.ImageUrl + item.s_image_path, item.blink_status, item.driver_name, item.driver_contact); cell.SelectionStyle = UITableViewCellSelectionStyle.None; if (index >= 0) { if (index % 2 == 0) { cell.BackgroundColor = new UIColor(red: 0.959f, green: 0.959f, blue: 0.959f, alpha: 1f); } else { cell.BackgroundColor = new UIColor(red: 0.999f, green: 1f, blue: 1f, alpha: 1f); } } cell.Frame = new RectangleF(0, 0, 139, 500); return(cell); } } else { if (StaticDataModel.CurrentLanguage == "en") { ///English var cell = (StudentList_tableviewcell)tableView.DequeueReusableCell(StudentList_tableviewcell.Key); if (cell == null) { cell = StudentList_tableviewcell.Create(); } //cell.SelectionStyle = UITableViewCellSelectionStyle.None;//Default; var item = tableItems[indexPath.Row]; var index = indexPath.Row; cell.UpdateCell(indexPath.Row, item.student_id, item.s_route_id, item.s_fname + " " + item.family_name, WebService.ImageUrl + item.s_image_path, item.blink_status, item.driver_name, item.driver_contact); cell.SelectionStyle = UITableViewCellSelectionStyle.None; if (index >= 0) { if (index % 2 == 0) { cell.BackgroundColor = new UIColor(red: 0.959f, green: 0.959f, blue: 0.959f, alpha: 1f); } else { cell.BackgroundColor = new UIColor(red: 0.999f, green: 1f, blue: 1f, alpha: 1f); } } return(cell); } else { ///Arabic var cell = (ar_StudentList_tableviewcell)tableView.DequeueReusableCell(ar_StudentList_tableviewcell.Key); if (cell == null) { cell = ar_StudentList_tableviewcell.Create(); } //cell.SelectionStyle = UITableViewCellSelectionStyle.None;//Default; var item = tableItems[indexPath.Row]; var index = indexPath.Row; cell.UpdateCell(indexPath.Row, item.student_id, item.s_route_id, item.s_fname + " " + item.family_name, WebService.ImageUrl + item.s_image_path, item.blink_status, item.driver_name, item.driver_contact); cell.SelectionStyle = UITableViewCellSelectionStyle.None; if (index >= 0) { if (index % 2 == 0) { cell.BackgroundColor = new UIColor(red: 0.959f, green: 0.959f, blue: 0.959f, alpha: 1f); } else { cell.BackgroundColor = new UIColor(red: 0.999f, green: 1f, blue: 1f, alpha: 1f); } } return(cell); } } }
public override void ViewDidLoad() { base.ViewDidLoad(); NSUrl url = new NSUrl(SocketUrl + StaticDataModel.UserId); webSocket = new WebSocket(url); webSocket.Open(); ap = new AppDelegate(); tableviewActualSize = tblConversation.Frame; textfield = new UITextField(new RectangleF((float)txtWritehere.Frame.X, 30, (float)txtWritehere.Frame.Width, (float)txtWritehere.Frame.Height)); textfield.BackgroundColor = UIColor.White; textfield.Layer.CornerRadius = 14; textfield.Layer.BorderWidth = 4; textfield.Layer.BorderColor = new UIColor(red: 1f, green: 0.79f, blue: 0f, alpha: 1.0f).CGColor; textfield.AttributedPlaceholder = new NSAttributedString("Write here", null, UIColor.DarkGray); textfield.Font = txtWritehere.Font; textfield.BorderStyle = UITextBorderStyle.RoundedRect; StaticMethods.SetPadding(textfield, 5); textfield.ShouldReturn += (textField) => { textField.ResignFirstResponder(); return(true); }; txtWritehere.ShouldReturn += (textField) => { textField.ResignFirstResponder(); return(true); }; UIKeyboard.Notifications.ObserveWillShow((sender, e) => { textfield.BecomeFirstResponder(); if (StaticMethods.DeviceType() == "ipad") { imgTyping.Frame = new CoreGraphics.CGRect(typingimage_frame.X, typingimage_frame.Y - 300, typingimage_frame.Width, typingimage_frame.Height); } else { imgTyping.Frame = new CoreGraphics.CGRect(typingimage_frame.X, typingimage_frame.Y - 200, typingimage_frame.Width, typingimage_frame.Height); } }); UIKeyboard.Notifications.ObserveWillHide((sender, e) => { textfield.BecomeFirstResponder(); tblConversation.Frame = tableviewActualSize; txtWritehere.Text = textfield.Text; imgTyping.Frame = typingimage_frame; }); txtWritehere.AttributedPlaceholder = new NSAttributedString("Write here", null, UIColor.DarkGray); this.txtWritehere.ShouldChangeCharacters = (textField, range, replacementString) => { SendSocketMessage("type"); return(true); }; GetStudentConversation(); // Create request for remote resource webSocket.WebSocketOpened += (sender, e) => { // the socket was opened, so we can start using it IsConnected = true; SendSocketMessage("read"); }; webSocket.ReceivedMessage += (sender, e) => { JObject jObj = JObject.Parse(e.Message.ToString()); Console.WriteLine(e.Message.ToString()); StaticDataModel.SocketSessionId = jObj["sessionId"].ToString(); StaticDataModel.SocketFlag = jObj["flag"].ToString(); if (StaticDataModel.SocketFlag == "message") { var id = jObj["user_id"].ToString(); var message = jObj["message"].ToString(); //if (message != "1" && message != "read_unread_check") //{ if (id == StaticDataModel.UserId.ToString()) { if (message == "1") { imgTyping.Hidden = false; Console.WriteLine("Typing...."); } else if (message == "read_unread_check") { Console.WriteLine("Seen...."); model.Select(c => { c.status = 1; return(c); }).ToList(); RefreshTableview(); imgTyping.Hidden = true; } else { addCurrentMessagesTotableview(0, 0, message); SendSocketMessage("read"); imgTyping.Hidden = true; } } //} } }; PrepareUI(); SetData(); imgBack.AddGestureRecognizer(new UITapGestureRecognizer(ro => { if (!StaticDataModel.isFromNotification) { this.DismissModalViewController(false); } else { if (StaticDataModel.CurrentLanguage == "en") { Home home = ap.MainStoryboard.InstantiateViewController("Home") as Home; UIApplication.SharedApplication.KeyWindow.RootViewController = home; //StaticMethods.ChangeLocalization("en") } else { Home home = ap.Main_ArabicStoryboard.InstantiateViewController("Home") as Home; UIApplication.SharedApplication.KeyWindow.RootViewController = home; //StaticMethods.ChangeLocalization("ar"); } } })); txtWritehere.EditingDidBegin += TxtWritehere_EditingDidBegin; }
public override void ViewDidLoad() { base.ViewDidLoad(); InvokeOnMainThread(() => { var type = StaticMethods.DeviceType(); if (type != "ipad") { tblStudentList.RowHeight = 94; } }); //if(!StaticDataModel.IsFromLanguageMenu) NavigationController.SetNavigationBarHidden(true, true); //GetStudentList(); SetData(); imgMenu.AddGestureRecognizer(new UITapGestureRecognizer(ro => { SidebarController.OpenMenu(); })); StudentList_tableviewcell.CarClicked += (object sender, EventArgs e) => { if (StaticDataModel.isEnableStudentTracking) { StudentTracking home = this.Storyboard.InstantiateViewController("StudentTracking") as StudentTracking; if (home != null) { this.PresentModalViewController(home, true); } else { } } else { string message = string.Empty; if (StaticDataModel.CurrentLanguage == "en") { message = "Your child is not in bus."; } else { message = ".طفلك ليس في الحافلة"; } BTProgressHUD.ShowToast(message, false, 10500); } }; StudentList_tableviewcell.ViewDetailsClicked += (object sender, EventArgs e) => { StudentReport sr = this.Storyboard.InstantiateViewController("StudentReport") as StudentReport; if (sr != null) { this.PresentModalViewController(sr, true); } }; ar_StudentList_tableviewcell.CarClicked += (object sender, EventArgs e) => { StudentTracking home = this.Storyboard.InstantiateViewController("StudentTracking") as StudentTracking; if (home != null) { this.PresentModalViewController(home, true); } }; ar_StudentList_tableviewcell.ViewDetailsClicked += (object sender, EventArgs e) => { StudentReport sr = this.Storyboard.InstantiateViewController("StudentReport") as StudentReport; if (sr != null) { this.PresentModalViewController(sr, true); } }; ipad_StudentList_tableviewcell.CarClicked += (object sender, EventArgs e) => { StudentTracking home = this.Storyboard.InstantiateViewController("StudentTracking") as StudentTracking; if (home != null) { this.PresentModalViewController(home, true); } }; ipad_StudentList_tableviewcell.ViewDetailsClicked += (object sender, EventArgs e) => { StudentReport sr = this.Storyboard.InstantiateViewController("StudentReport") as StudentReport; if (sr != null) { this.PresentModalViewController(sr, true); } }; ar_ipad_StudentList_tableviewcell.CarClicked += (object sender, EventArgs e) => { StudentTracking home = this.Storyboard.InstantiateViewController("StudentTracking") as StudentTracking; if (home != null) { this.PresentModalViewController(home, true); } }; ar_ipad_StudentList_tableviewcell.ViewDetailsClicked += (object sender, EventArgs e) => { StudentReport sr = this.Storyboard.InstantiateViewController("StudentReport") as StudentReport; if (sr != null) { this.PresentModalViewController(sr, true); } }; AppDelegate.NotificationReceived += (object sender, EventArgs e) => { GetStudentList(); }; Settings.SaveSettings += (object sender, EventArgs e) => { ChangeLaguageProcess(); }; }