// Events private void TileOnClick(object sender, EventArgs eventArgs) { var metroTileItem = sender as MetroTileItem; if (metroTileItem != null) { var contact = metroTileItem.GetOwner() as Contact; if(contact == null) return; pSuggestions.Items.Clear(); SetStatusText(contact.ContactEntry.Name.FullName); var suggestions = _cm.GetFacebookContactSuggestion(contact.ContactEntry.Name); foreach (var suggestion in suggestions) { var tile = new MetroTileItem { Text = suggestion.name, Name = "tile" + suggestion.name }; tile.SetOwner(suggestion); //tile.Click += TileOnClick; SetDefaultTile(tile); tile.TileStyle.TextLineAlignment = eStyleTextAlignment.Center; tile.TileStyle.Font = new Font("Segoe UI", 16, FontStyle.Bold); pSuggestions.Items.Add(tile); } pSuggestions.Refresh(); } }
private bool HasUnlinkedContacts() { pUnlinkedContacts.Items.Clear(); var contacts = _cm.GetGoogleUnlinkedContacts(); foreach (var contact in contacts) { var entry = contact.ContactEntry; var tile = new MetroTileItem { Text = ((entry.Phonenumbers.Count > 0) ? entry.Phonenumbers[0].Value : "") + "\n" + entry.Birthday + "\n" + ((entry.Emails.Count > 0) ? entry.Emails[0].Address : ""), TitleText = entry.Name.FullName, Name = "tile" + entry.Name.FamilyName }; tile.SetOwner(contact); tile.Click += TileOnClick; SetDefaultTile(tile); pUnlinkedContacts.Items.Add(tile); } return (contacts.Count > 0); }