Esempio n. 1
0
        private static Contact ContactFromContactInfo(WasmContact contactInfo)
        {
            var contact = new Contact();

            contact.DisplayNameOverride = contactInfo.Name?.FirstOrDefault(n => n?.Length > 0) ?? "";
            foreach (var phoneNumber in contactInfo.Tel?.Where(t => t?.Length > 0) ?? Array.Empty <string>())
            {
                var contactPhone = new ContactPhone()
                {
                    Number = phoneNumber,
                    Kind   = ContactPhoneKind.Other
                };
                contact.Phones.Add(contactPhone);
            }

            foreach (var email in contactInfo.Email?.Where(t => t?.Length > 0) ?? Array.Empty <string>())
            {
                var contactEmail = new ContactEmail()
                {
                    Address = email,
                    Kind    = ContactEmailKind.Other
                };
                contact.Emails.Add(contactEmail);
            }

            foreach (var address in contactInfo.Address?.Where(a => a != null) ?? Array.Empty <WasmContactAddress>())
            {
                var contactAddress = new ContactAddress()
                {
                    StreetAddress = address.DependentLocality ?? "",
                    Country       = address.Country ?? "",
                    Locality      = address.City ?? "",
                    Region        = address.Region ?? "",
                    PostalCode    = address.PostalCode ?? "",
                    Kind          = ContactAddressKind.Other
                };
                contact.Addresses.Add(contactAddress);
            }

            return(contact);
        }
Esempio n. 2
0
        public void odobriAgencijuFun(object parametar)
        {
            ZahtjevAgencije a = ZahtjeviAgencija.FirstOrDefault(ag => ag.Naziv == trenutniZahtjevAgencije.Naziv);

            if (a != null)
            {
                Contact contact = new Contact();

                var personalEmail = new Windows.ApplicationModel.Contacts.ContactEmail();
                personalEmail.Address = TrenutniZahtjevAgencije.Email;
                contact.Emails.Add(personalEmail);

                string subject = "Travel Your Way Agency Service";

                string message = "Poštovani," + System.Environment.NewLine + System.Environment.NewLine + "Ovom prilikom Vas obavještavamo da je Vaš zahtjev za registraciju agencije \"" + TrenutniZahtjevAgencije.Naziv + "\" odobren. Ugodno korištenje aplikacije Vam želi naš Admin team." + System.Environment.NewLine + System.Environment.NewLine + "Lijep pozdrav," + System.Environment.NewLine + "Travel Your Way";

                var task = ComposeEmail(contact, subject, message);

                //task.RunSynchronously();

                Agencija        nova        = new Agencija(a);
                ZahtjevAgencije noviZahtjev = new ZahtjevAgencije(a);



                IMobileServiceTable <ZahtjevAgencije> userTableObjZahtjeviAgencija = App.MobileService.GetTable <ZahtjevAgencije>();
                IMobileServiceTable <Agencija>        userTableObjAgencija         = App.MobileService.GetTable <Agencija>();

                userTableObjAgencija.InsertAsync(nova);
                userTableObjZahtjeviAgencija.DeleteAsync(noviZahtjev);

                Agencije.Add(a);
                ZahtjeviAgencija.Remove(a);
                TravelYourWay.agencije         = agencije.ToList();
                TravelYourWay.zahtjeviAgencija = zahtjeviAgencija.ToList();

                //TrenutniZahtjevAgencije = null;
            }
        }
Esempio n. 3
0
        private async void CreateContact_Click(object sender, RoutedEventArgs e)
        {
            Windows.ApplicationModel.Contacts.Contact contact = new Windows.ApplicationModel.Contacts.Contact();
            contact.FirstName = "TestContactWhatsApp";

            Windows.ApplicationModel.Contacts.ContactEmail email = new Windows.ApplicationModel.Contacts.ContactEmail();
            email.Address = "*****@*****.**";
            email.Kind    = Windows.ApplicationModel.Contacts.ContactEmailKind.Other;
            contact.Emails.Add(email);

            Windows.ApplicationModel.Contacts.ContactPhone phone = new Windows.ApplicationModel.Contacts.ContactPhone();
            phone.Number = "4255550101";
            phone.Kind   = Windows.ApplicationModel.Contacts.ContactPhoneKind.Mobile;
            contact.Phones.Add(phone);

            Windows.ApplicationModel.Contacts.ContactStore store = await
                                                                   ContactManager.RequestStoreAsync(ContactStoreAccessType.AppContactsReadWrite);

            ContactList contactList;

            IReadOnlyList <ContactList> contactLists = await store.FindContactListsAsync();

            if (0 == contactLists.Count)
            {
                contactList = await store.CreateContactListAsync("WhatsAppContactList");
            }
            else
            {
                contactList = contactLists[0];
            }

            await contactList.SaveContactAsync(contact);

            //Add Annotation
            ContactAnnotationStore annotationStore = await ContactManager.RequestAnnotationStoreAsync(ContactAnnotationStoreAccessType.AppAnnotationsReadWrite);

            ContactAnnotationList annotationList;

            IReadOnlyList <ContactAnnotationList> annotationLists = await annotationStore.FindAnnotationListsAsync();

            if (0 == annotationLists.Count)
            {
                annotationList = await annotationStore.CreateAnnotationListAsync();
            }
            else
            {
                annotationList = annotationLists[0];
            }


            ContactAnnotation annotation = new ContactAnnotation();

            annotation.ContactId = contact.Id;
            annotation.RemoteId  = phone.Number; //associate the ID of a contact to an ID that your app uses internally to identify that user.

            annotation.SupportedOperations = ContactAnnotationOperations.Message |
                                             ContactAnnotationOperations.AudioCall |
                                             ContactAnnotationOperations.VideoCall |
                                             ContactAnnotationOperations.ContactProfile;


            await annotationList.TrySaveAnnotationAsync(annotation);
        }