private void AddContact()
        {
            var user = Item as TLUser;

            if (user != null)
            {
                // Create the contact-card
                Contact userContact = new Contact();

                // Check if the user has a normal name
                if (user.FullName != "" || user.FullName != null)
                {
                    if (user.FirstName != null)
                    {
                        userContact.FirstName = user.FirstName;
                    }
                    if (user.LastName != null)
                    {
                        userContact.LastName = user.LastName;
                    }
                }
                // if not, use username
                else if (user.HasUsername != false)
                {
                    if (user.Username != null)
                    {
                        userContact.LastName = user.Username;
                    }
                }
                // if all else fails, use phone number (where possible)
                else if (user.HasPhone != false)
                {
                    if (user.Username != null)
                    {
                        userContact.LastName = user.Phone;
                    }
                }
                // TODO Check why phone numbers are not being shown when the contact is not yet in the users People Hub
                if (user.Phone != null)
                {
                    ContactPhone userPhone = new ContactPhone();
                    userPhone.Number = user.Phone;
                    userContact.Phones.Add(userPhone);
                }

                // Set options for the Dialog-window
                FullContactCardOptions options = new FullContactCardOptions();
                options.DesiredRemainingView = Windows.UI.ViewManagement.ViewSizePreference.Default;

                // Show the card
                ContactManager.ShowFullContactCard(userContact, options);
            }
        }
        private void ShowContactCard_Click(object sender, RoutedEventArgs e)
        {
            Contact contact = rootPage.CreateContactFromUserInput(EmailAddress, PhoneNumber);
            if (contact != null)
            {
                // Try to share the screen half/half with the full contact card.
                FullContactCardOptions options = new FullContactCardOptions();
                options.DesiredRemainingView = ViewSizePreference.UseHalf;

                // Show the full contact card.
                ContactManager.ShowFullContactCard(contact, options);
            }
        }
示例#3
0
        private void ShowContactCard_Click(object sender, RoutedEventArgs e)
        {
            Contact contact = rootPage.CreateContactFromUserInput(EmailAddress, PhoneNumber);

            if (contact != null)
            {
                // Try to share the screen half/half with the full contact card.
                FullContactCardOptions options = new FullContactCardOptions();
                options.DesiredRemainingView = ViewSizePreference.UseHalf;

                // Show the full contact card.
                ContactManager.ShowFullContactCard(contact, options);
            }
        }
示例#4
0
        public void ShowContactCardFull(Contact contact)
        {
            if (contact != null)
            {
                // Try to share the screen half/half with the full contact card.
                FullContactCardOptions options = new FullContactCardOptions
                {
                    DesiredRemainingView = ViewSizePreference.UseHalf
                };

                // Show the full contact card.
                ContactManager.ShowFullContactCard(contact, options);
            }
        }
示例#5
0
        public void ShowContactCardFull(Contact contact)
        {
            if (contact != null)
            {
                // Try to share the screen half/half with the full contact card.
                FullContactCardOptions options = new FullContactCardOptions
                {
                    DesiredRemainingView = ViewSizePreference.UseHalf
                };

                // Show the full contact card.
                ContactManager.ShowFullContactCard(contact, options);
            }
        }
示例#6
0
        private async void OpenContact_Click(object sender, RoutedEventArgs e)
        {
            // Get the selection rect of the button pressed to show contact card.
            FrameworkElement element = (FrameworkElement)sender;

            Windows.UI.Xaml.Media.GeneralTransform buttonTransform = element.TransformToVisual(null);
            Windows.Foundation.Point point = buttonTransform.TransformPoint(new Windows.Foundation.Point());
            Windows.Foundation.Rect  rect  =
                new Windows.Foundation.Rect(point, new Windows.Foundation.Size(element.ActualWidth, element.ActualHeight));

            // helper method to find a contact just for illustrative purposes.
            Windows.ApplicationModel.Contacts.Contact contact = await findContact("*****@*****.**");


            //Show Contact in contact Application
            FullContactCardOptions options = new FullContactCardOptions();

            options.DesiredRemainingView = ViewSizePreference.UseHalf;

            // Show the full contact card.
            ContactManager.ShowFullContactCard(contact, options);
        }
示例#7
0
        private void HandleContactClicked(AttendeeViewModel attendee)
        {
            var contact = new Windows.ApplicationModel.Contacts.Contact();

            contact.YomiGivenName = attendee.User.Name;
            contact.Name = attendee.User.Name;

            ContactEmail workEmail = new ContactEmail();
            workEmail.Address = attendee.User.Email;
            workEmail.Kind = ContactEmailKind.Work;
            contact.Emails.Add(workEmail);

            // Try to share the screen half/half with the full contact card.
            FullContactCardOptions options = new FullContactCardOptions();
            options.DesiredRemainingView = ViewSizePreference.UseHalf;

            // Show the full contact card.
            ContactManager.ShowFullContactCard(contact, options);
        }