public ContactsSource(UITableView tableView, List <GetUsersInDivisionModel> contacts, ContactsType showContactType, bool filterByName) { _contacts = contacts; tableView.RegisterNibForCellReuse(ContactsCell.Nib, ContactsCell.Key); if (filterByName) { _grouping = (from c in contacts orderby c.FirstName[0] ascending group c by c.FirstName[0].ToString() into g select g).ToArray(); _indices = (from c in contacts orderby c.FirstName ascending group c by c.FirstName[0] into i select i.Key.ToString()).ToList(); } else { _grouping = (from c in contacts orderby c.Position[0] ascending group c by c.Position into g select g).ToArray(); _indices = (from c in contacts orderby c.Position ascending group c by c.Position[0] into i select i.Key.ToString()).ToList(); } _indices.Insert(0, UITableView.IndexSearch); _showContactType = showContactType; }
public ContactPageViewController(int index, List <GetUsersInDivisionModel> contactPage, EventHandler <Tuple <ContactListViewModel.ContactEventType, int> > contactEvent, ContactsType contactType, bool filterByName) : base(index, "ContactPageViewController", null) { _index = index; _contactPage = contactPage; _contactEvent = contactEvent; _showContactType = contactType; _filterByName = filterByName; }
public void Configure(GetUsersInDivisionModel user, EventHandler <Tuple <ContactEventType, int> > contactEventHandler, ContactsType showContactType) { _imageView.Image?.Dispose(); _chatImage.Image?.Dispose(); _callImage.Image?.Dispose(); _showContactType = showContactType; _userId = user.UserId; _contactEventHandler = contactEventHandler; UILabelExtensions.SetupLabelAppearance(_nameLabel, $"{user.FirstName} {user.LastName}", Colors.ProfileGray, 14f, UIFontWeight.Semibold); UILabelExtensions.SetupLabelAppearance(_roleLabel, user.Position, Colors.Black, 13f); if (!string.IsNullOrEmpty(user?.Picture)) { _picture = string.Copy(user.Picture); ImageService.Instance.LoadStream((token) => { return(ImageHelper.GetStreamFromImageByte(token, _picture)); }).ErrorPlaceholder("profile_noimage", ImageSource.CompiledResource).Retry(3, 200).Finish(CleanString).Transform(new CircleTransformation()).Into(_imageView); } else { _imageView.Image = UIImage.FromBundle("profile_noimage"); CustomUIExtensions.RoundView(_imageView); } _callImage.Image = UIImage.FromBundle("tabbar_call_selected"); _callButton.TouchUpInside -= OnCallButton_TouchUpInside; _callButton.TouchUpInside += OnCallButton_TouchUpInside; _chatImage.Image = UIImage.FromBundle("user_chat"); _chatButton.TouchUpInside -= OnChatButton_TouchUpInside; _chatButton.TouchUpInside += OnChatButton_TouchUpInside; switch (showContactType) { case ContactsType.All: _chatButton.Hidden = false; _chatImage.Hidden = false; _callImage.Hidden = false; _callButton.Hidden = false; break; case ContactsType.Call: _chatButton.Hidden = true; _chatImage.Hidden = true; break; case ContactsType.Chat: _chatButton.Hidden = true; _chatImage.Hidden = true; _callImage.Image = UIImage.FromBundle("user_chat"); break; default: break; } }