public void Save()
        {
            if (PhoneContact == null)
            {
                return;
            }
            if (PhoneContact.User == null)
            {
                return;
            }

            var phoneNumber = PhoneContact.User.Phone.ToString();

            if (!string.IsNullOrEmpty(phoneNumber))
            {
                if (!PhoneContact.User.Phone.ToString().StartsWith("+"))
                {
                    phoneNumber = "+" + phoneNumber;
                }

                var task = new SaveContactTask();
                task.FirstName   = PhoneContact.User.FirstName.ToString();
                task.LastName    = PhoneContact.User.LastName.ToString();
                task.MobilePhone = phoneNumber;
                task.Show();
            }
        }
Пример #2
0
        private void ContactSaveTaskCompleted(object sender, SaveContactResult e)
        {
            SaveContactTask task = sender as SaveContactTask;

            if (e.TaskResult == TaskResult.OK)
            {
                Deployment.Current.Dispatcher.BeginInvoke(() =>
                {
                    var deviceContacts              = new DeviceContacts();
                    deviceContacts.SearchCompleted +=
                        postAdd_SearchCompleted;

                    if (task != null)
                    {
                        string displayName = String.Format("{0}{2}{1}", task.FirstName, task.LastName,
                                                           String.IsNullOrEmpty(task.FirstName) ? "" : " ");

                        deviceContacts.SearchAsync(displayName, FilterKind.DisplayName, task);
                    }
                });
            }
            else if (e.TaskResult == TaskResult.Cancel)
            {
                DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, "Operation cancelled."));
            }
        }
        /// <summary>
        /// Shows the contacts application and enables the user to save a contact, using the specified <see cref="SaveContactServiceParams"/> instance.
        /// </summary>
        /// <param name="saveContactServiceParams">The <see cref="SaveContactServiceParams"/> instance.</param>
        public void Show(SaveContactServiceParams saveContactServiceParams)
        {
            var saveContactTask = new SaveContactTask()
            {
                Title = saveContactServiceParams.Title,
                Suffix = saveContactServiceParams.Suffix,
                FirstName = saveContactServiceParams.FirstName,
                MiddleName = saveContactServiceParams.MiddleName,
                LastName = saveContactServiceParams.LastName,
                HomeAddressCity = saveContactServiceParams.HomeAddressCity,
                HomeAddressCountry = saveContactServiceParams.HomeAddressCountry,
                HomeAddressState = saveContactServiceParams.HomeAddressState,
                HomeAddressStreet = saveContactServiceParams.HomeAddressState,
                HomeAddressZipCode = saveContactServiceParams.HomeAddressZipCode,
                HomePhone = saveContactServiceParams.HomePhone,
                WorkAddressCity = saveContactServiceParams.WorkAddressCity,
                WorkAddressCountry = saveContactServiceParams.WorkAddressCountry,
                WorkAddressState = saveContactServiceParams.WorkAddressState,
                WorkAddressStreet = saveContactServiceParams.WorkAddressStreet,
                WorkAddressZipCode = saveContactServiceParams.WorkAddressZipCode,
                WorkEmail = saveContactServiceParams.WorkEmail,
                WorkPhone = saveContactServiceParams.WorkPhone,
                Company = saveContactServiceParams.Company,
                JobTitle = saveContactServiceParams.JobTitle,
                MobilePhone = saveContactServiceParams.MobilePhone,
                Nickname = saveContactServiceParams.Nickname,
                Notes = saveContactServiceParams.Notes,
                PersonalEmail = saveContactServiceParams.PersonalEmail,
                OtherEmail = saveContactServiceParams.OtherEmail,
                Website = saveContactServiceParams.Website
            };

            saveContactTask.Show();
        }
Пример #4
0
        /// <summary>
        /// Shows the contacts application and enables the user to save a contact, using the specified <see cref="SaveContactServiceParams"/> instance.
        /// </summary>
        /// <param name="saveContactServiceParams">The <see cref="SaveContactServiceParams"/> instance.</param>
        public void Show(SaveContactServiceParams saveContactServiceParams)
        {
            var saveContactTask = new SaveContactTask()
            {
                Title              = saveContactServiceParams.Title,
                Suffix             = saveContactServiceParams.Suffix,
                FirstName          = saveContactServiceParams.FirstName,
                MiddleName         = saveContactServiceParams.MiddleName,
                LastName           = saveContactServiceParams.LastName,
                HomeAddressCity    = saveContactServiceParams.HomeAddressCity,
                HomeAddressCountry = saveContactServiceParams.HomeAddressCountry,
                HomeAddressState   = saveContactServiceParams.HomeAddressState,
                HomeAddressStreet  = saveContactServiceParams.HomeAddressState,
                HomeAddressZipCode = saveContactServiceParams.HomeAddressZipCode,
                HomePhone          = saveContactServiceParams.HomePhone,
                WorkAddressCity    = saveContactServiceParams.WorkAddressCity,
                WorkAddressCountry = saveContactServiceParams.WorkAddressCountry,
                WorkAddressState   = saveContactServiceParams.WorkAddressState,
                WorkAddressStreet  = saveContactServiceParams.WorkAddressStreet,
                WorkAddressZipCode = saveContactServiceParams.WorkAddressZipCode,
                WorkEmail          = saveContactServiceParams.WorkEmail,
                WorkPhone          = saveContactServiceParams.WorkPhone,
                Company            = saveContactServiceParams.Company,
                JobTitle           = saveContactServiceParams.JobTitle,
                MobilePhone        = saveContactServiceParams.MobilePhone,
                Nickname           = saveContactServiceParams.Nickname,
                Notes              = saveContactServiceParams.Notes,
                PersonalEmail      = saveContactServiceParams.PersonalEmail,
                OtherEmail         = saveContactServiceParams.OtherEmail,
                Website            = saveContactServiceParams.Website
            };

            saveContactTask.Show();
        }
Пример #5
0
        /// <summary>
        /// Add Contact (Launcher)
        /// </summary>
        /// <param name="parameters"></param>
        public void addContact(string parameters)
        {
            string[] args = WPCordovaClassLib.Cordova.JSON.JsonHelper.Deserialize <string[]>(parameters);

            string givenName  = (args.Length > 1) ? HttpUtility.UrlDecode(args[0]) : "";
            string familyName = (args.Length > 1) ? HttpUtility.UrlDecode(args[1]) : "";
            string street     = (args.Length > 1) ? HttpUtility.UrlDecode(args[2]) : "";
            string city       = (args.Length > 1) ? HttpUtility.UrlDecode(args[3]) : "";
            string state      = (args.Length > 1) ? HttpUtility.UrlDecode(args[4]) : "";
            string zip        = (args.Length > 1) ? HttpUtility.UrlDecode(args[5]) : "";
            string country    = (args.Length > 1) ? HttpUtility.UrlDecode(args[6]) : "";
            string phone      = (args.Length > 1) ? HttpUtility.UrlDecode(args[7]) : "";
            string email      = (args.Length > 1) ? HttpUtility.UrlDecode(args[8]) : "";

            SaveContactTask addContactTask = new SaveContactTask();

            addContactTask.Completed         += new EventHandler <SaveContactResult>(addContactTask_Completed);
            addContactTask.FirstName          = givenName;
            addContactTask.LastName           = familyName;
            addContactTask.HomePhone          = phone;
            addContactTask.PersonalEmail      = email;
            addContactTask.HomeAddressCity    = city;
            addContactTask.HomeAddressCountry = country;
            addContactTask.HomeAddressState   = state;
            addContactTask.HomeAddressZipCode = zip;
            addContactTask.HomeAddressStreet  = street;
            addContactTask.Show();
        }
Пример #6
0
        private void OnContactTap(object sender, GestureEventArgs e)
        {
            var          element = (FrameworkElement)sender;
            MessageModel message = (MessageModel)element.DataContext;

            if (!(message is MessageModelDelivered))
            {
                return;
            }

            MessageModelDelivered messageDelivered = (MessageModelDelivered)message;
            MessageMedia          media            = messageDelivered.MessageMedia;

            if (media.Constructor != Constructor.messageMediaContact)
            {
                return;
            }

            MessageMediaContactConstructor mediaContact = (MessageMediaContactConstructor)media;

            SaveContactTask saveContactTask = new SaveContactTask();

            saveContactTask.Completed += new EventHandler <SaveContactResult>(saveContactTask_Completed);

            saveContactTask.FirstName   = mediaContact.first_name;
            saveContactTask.LastName    = mediaContact.last_name;
            saveContactTask.MobilePhone = "+" + mediaContact.phone_number;

            saveContactTask.Show();
        }
Пример #7
0
        private void AddNewContactButton_Click(object sender, EventArgs e)
        {
            SaveContactTask sct = new SaveContactTask();

            sct.Completed += saveContactTask_Completed;
            sct.Show();
        }
Пример #8
0
        public Contacts()
        {
            saveContactTask = new SaveContactTask();
            saveContactTask.Completed += new EventHandler<SaveContactResult>(saveContactTask_Completed);

            contacts = new Microsoft.Phone.UserData.Contacts();
            contacts.SearchCompleted += new EventHandler<ContactsSearchEventArgs>(contacts_SearchCompleted);
        }
        // Constructor
        public MainPage()
        {
            InitializeComponent();

            // Sample code to localize the ApplicationBar
            //BuildLocalizedApplicationBar();

            saveContactTask            = new SaveContactTask();
            saveContactTask.Completed += new EventHandler <SaveContactResult>(saveContactTask_Completed);
        }
Пример #10
0
        // Constructor
        public MainPage()
        {
            InitializeComponent();

            // Sample code to localize the ApplicationBar
            //BuildLocalizedApplicationBar();

            saveContactTask = new SaveContactTask();
            saveContactTask.Completed += new EventHandler<SaveContactResult>(saveContactTask_Completed);
        }
Пример #11
0
        // Constructor
        public MainPage()
        {
            InitializeComponent();

            this.cameraCaptureTask = new CameraCaptureTask();
            this.cameraCaptureTask.Completed += new System.EventHandler<PhotoResult>(this.PhotoChooserCompleted);

            this.saveContactTask = new SaveContactTask();
            this.saveContactTask.Completed += new System.EventHandler<SaveContactResult>(this.ContactSaverCompleted);
        }
Пример #12
0
        private void addContact_Tap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            SaveContactTask saveContactTask;

            saveContactTask             = new SaveContactTask();
            saveContactTask.FirstName   = "";
            saveContactTask.LastName    = "";
            saveContactTask.MobilePhone = "";

            saveContactTask.Show();
        }
Пример #13
0
        public static void saveContact(string phone, contactSearch_Callback callback)
        {
            SaveContactTask saveContactTask = new SaveContactTask();

            saveContactTask.Completed  += new EventHandler <SaveContactResult>(callback);
            saveContactTask.MobilePhone = phone;
            try
            {
                saveContactTask.Show();
            }
            catch { }
        }
Пример #14
0
        private void saveContact_Click(object sender, EventArgs e)
        {
            var task = new SaveContactTask
            {
                FirstName = "Tim",
                LastName  = "Jones",
                Company   = "Magnatis",
                WorkEmail = "*****@*****.**"
            };

            task.Show();
        }
Пример #15
0
        public void AddContact()
        {
            var task = new SaveContactTask();

            task.Completed += (o, e) =>
            {
                if (e.TaskResult == TaskResult.OK)
                {
                    ImportContactsAsync();
                }
            };
            task.Show();
        }
Пример #16
0
        // Constructor
        public MainPage()
        {
            InitializeComponent();
            ocrEngine = new OcrEngine(OcrLanguage.English);
            saveContactTask = new SaveContactTask();
            saveContactTask.Completed += new EventHandler<SaveContactResult>(saveContactTask_Completed);
            saveContactTask.FirstName = "John";
            saveContactTask.LastName = "Doe";
            saveContactTask.MobilePhone = "2065550123";

            saveContactTask.Show();

        }
Пример #17
0
        public SaveContactTask GetSaveCotactTask()
        {
            SaveContactTask saveContactTask = new SaveContactTask();

            if (!string.IsNullOrEmpty(name))
            {
                saveContactTask.FirstName = name;
            }

            if (!string.IsNullOrEmpty(homeAddress))
            {
                saveContactTask.HomeAddressCity = homeAddress;
            }

            if (!string.IsNullOrEmpty(homePhone))
            {
                saveContactTask.HomePhone = homePhone;
            }

            if (!string.IsNullOrEmpty(mobileNumber))
            {
                saveContactTask.MobilePhone = mobileNumber;
            }

            if (!string.IsNullOrEmpty(personalEmail))
            {
                saveContactTask.PersonalEmail = personalEmail;
            }

            if (!string.IsNullOrEmpty(workAddress))
            {
                saveContactTask.WorkAddressCity = workAddress;
            }

            if (!string.IsNullOrEmpty(workEmail))
            {
                saveContactTask.WorkEmail = workEmail;
            }

            if (!string.IsNullOrEmpty(workPhone))
            {
                saveContactTask.WorkPhone = workPhone;
            }

            if (!string.IsNullOrEmpty(otherEmail))
            {
                saveContactTask.OtherEmail = otherEmail;
            }

            return(saveContactTask);
        }
Пример #18
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            PhoneCallTask lanzador = new PhoneCallTask();
            lanzador.DisplayName = "Sorey";
            lanzador.PhoneNumber = "555-0101";
            lanzador.Show();

            SaveContactTask selector = new SaveContactTask();
            selector.FirstName = "Sorey";
            selector.MobilePhone = "555-01-01";

            selector.Completed += selector_Completed;
            selector.Show();
        }
Пример #19
0
        void contactTask_Completed(object sender, SaveContactResult e)
        {
            SaveContactTask task = sender as SaveContactTask;

            if (e.TaskResult == TaskResult.OK)
            {
                DeviceContacts deviceContacts = new DeviceContacts();
                deviceContacts.SearchCompleted += new EventHandler <ContactsSearchEventArgs>(postAdd_SearchCompleted);
                deviceContacts.SearchAsync(task.FirstName + " " + task.LastName, FilterKind.DisplayName, task);
            }
            else if (e.TaskResult == TaskResult.Cancel)
            {
            }
        }
        private void ContextMenuItem_AddContact_Click(object sender, RoutedEventArgs e)
        {
            LocationViewModel context = (sender as MenuItem).DataContext as LocationViewModel;
            SaveContactTask   sct     = new SaveContactTask();

            sct.Company   = context.Name;
            sct.WorkPhone = context.PhoneNumber;
            sct.Notes     = "Category: " + context.SampleCategories;
            if (context.Rating != null && !context.Rating.Equals(""))
            {
                sct.Notes += "\nRating: " + context.Rating;
            }
            sct.Website = context.Website;
            sct.Show();
        }
 private void btnContact_Click(object sender, RoutedEventArgs e)
 {
     SaveContactTask ctask = new SaveContactTask();
     ctask.FirstName = "Abhishek";
     ctask.LastName = "Sur";
     ctask.Nickname = "Sunny";
     ctask.JobTitle = "Architect";
     ctask.PersonalEmail = "*****@*****.**";
     ctask.Completed += (s, evt) =>
     {
         if (evt.TaskResult == TaskResult.OK)
             MessageBox.Show("Contact saved");
     };
     ctask.Show();
 }
Пример #22
0
        private void SaveContact(object sender, EventArgs e)
        {
            var saveContactTask = new SaveContactTask();

            //saveContactTask.Completed += saveContactTask_Completed;

            saveContactTask.FirstName   = "Radio Taxi";
            saveContactTask.LastName    = _radioTaxi.Nombre;
            saveContactTask.MobilePhone = _radioTaxi.Telefono;
            if (!string.IsNullOrWhiteSpace(_radioTaxi.Url))
            {
                saveContactTask.Website = _radioTaxi.Url;
            }

            saveContactTask.Show();
        }
 void contacts_SearchCompleted(object sender, ContactsSearchEventArgs e)
 {
     if (e.Results.Count() > 0)
     {
         MessageBox.Show(" Контакт " + App.PlaceInfoViewModel.PlaceInfo.Name + " уже существует");
     }
     else
     {
         SaveContactTask saveContact = new SaveContactTask();
         saveContact.FirstName         = App.PlaceInfoViewModel.PlaceInfo.Name;
         saveContact.HomeAddressStreet = App.PlaceInfoViewModel.PlaceInfo.Formatted_address;
         saveContact.Website           = App.PlaceInfoViewModel.PlaceInfo.Website;
         saveContact.WorkPhone         = App.PlaceInfoViewModel.PlaceInfo.Formatted_phone_number;
         saveContact.Show();
     }
 }
Пример #24
0
        private void SaveContact_Click(object sender, EventArgs e)
        {
            saveContactTask = new SaveContactTask();
            try
            {
                saveContactTask.FirstName = selectedSalon.sname;
                saveContactTask.WorkEmail = selectedSalon.semail;
                saveContactTask.Notes = selectedSalon.sdescription;
                saveContactTask.MobilePhone = selectedSalon.sphone;

                saveContactTask.Show();
            }

            catch (System.InvalidOperationException ex)
            {
                MessageBox.Show("epic fail. -->"+ex.Message);
            }
        }
Пример #25
0
 private void buttonSalvar_Click(object sender, RoutedEventArgs e)
 {
     if(textBoxNome.Text != null && !String.Empty.Equals(textBoxNome.Text.Trim()))
     {
         SaveContactTask contact = new SaveContactTask()
         {
             FirstName = textBoxNome.Text,
             MobilePhone = textBoxTelefone.Text
         };
         contact.Show();
     }
     else
     {
         SavePhoneNumberTask number = new SavePhoneNumberTask()
         {
             PhoneNumber = textBoxTelefone.Text
         };
         number.Show();
     }
 }
Пример #26
0
 public AddContact(string company, string workAddressStreet, string workAddressCity, string workAddressState, string workAddressZipCode, string workAddressCountry, string workPhone, string website, string workEmail, string notes)
 {
     try
     {
         _saveContactTask                    = new SaveContactTask();
         _saveContactTask.Company            = company;
         _saveContactTask.WorkAddressStreet  = workAddressStreet;
         _saveContactTask.WorkAddressCity    = workAddressCity;
         _saveContactTask.WorkAddressZipCode = workAddressZipCode;
         _saveContactTask.WorkAddressState   = workAddressState;
         _saveContactTask.WorkAddressCountry = workAddressCountry;
         _saveContactTask.WorkPhone          = workPhone;
         _saveContactTask.Website            = website;
         _saveContactTask.WorkEmail          = workEmail;
         _saveContactTask.Notes              = notes;
         _saveContactTask.Show();
     }
     catch (Exception x)
     {
         Debug.WriteLine("AddContact ERROR: " + x.ToString());
         MessageBox.Show("Error occurred adding contact.");
     }
 }
Пример #27
0
        //При нажатии на кнопку синхронизации контактов
        private void buttonSyncContacts_Click(object sender, RoutedEventArgs e)
        {
            SyncBegin.Visibility = Visibility.Collapsed;

            //Выполняем операции по обработке данных
            //Запускаем задачу котактов в телефоне(создаем реальный контакт)
            //SaveContactTask save_girl = new SaveContactTask();
            //save_girl.FirstName = "Liza";
            //save_girl.LastName = "Gaeva";
            //save_girl.MobilePhone = "89216573799";
            //save_girl.Show();

            //SaveContactTask save_boy = new SaveContactTask();
            //save_boy.FirstName = "Stepan";
            //save_boy.LastName = "Risin";
            //save_boy.MobilePhone = "+79025853217";
            //save_boy.Show();

            SaveContactTask save_boy = new SaveContactTask();

            save_boy.FirstName   = "Eugen";
            save_boy.LastName    = "Test";
            save_boy.MobilePhone = "+79227087963";
            save_boy.Show();

            //Получаем все наши телефоны из телефонной книги, в виде списка
            Contacts cons = new Contacts();

            //Подписываемся на событие завершения получения контактов
            //В самом событии - весь алгоритм
            cons.SearchCompleted += new EventHandler <ContactsSearchEventArgs>(Contacts_SearchCompleted);
            //Начинаем поиск(просто получаем все контакты)
            cons.SearchAsync(String.Empty, FilterKind.None, "Contacts Test #1");

            //Показываем данные
            contactShow.Visibility = Visibility.Visible;
        }
Пример #28
0
        private void MenuItem_Click(object sender, RoutedEventArgs e)
        {
            MenuItem menuItem = sender as MenuItem;
            DetailedStationListExt2 stationObj = (sender as MenuItem).DataContext as DetailedStationListExt2;

            if (menuItem.Name == "menuCall1")
            {
                PhoneCallTask phoneCallTask = new PhoneCallTask();

                phoneCallTask.PhoneNumber = stationObj.contactNo;
                phoneCallTask.DisplayName = string.Format(APPCONTEXT.stationListStationName, stationObj.stationName);

                phoneCallTask.Show();
            }
            else if (menuItem.Name == "menuCall2")
            {
                SaveContactTask saveContactTask = new SaveContactTask();

                saveContactTask.FirstName = stationObj.stationName + " Railway Station";
                saveContactTask.WorkPhone = stationObj.contactNo;

                saveContactTask.Show();
            }
            else if (menuItem.Name == "menuCall3")
            {
                callHereLauncher(stationObj.stationGeoCoordinate, 1);
            }
            else if (menuItem.Name == "menuCall4")
            {
                callHereLauncher(stationObj.stationGeoCoordinate, 2);
            }
            else
            {
                callHereLauncher(stationObj.stationGeoCoordinate, 3);
            }
        }
Пример #29
0
        private void miCreateContact_Click(object sender, EventArgs e)
        {
            var newContact = new SaveContactTask();

            newContact.FirstName          = App.ViewModel.ReturnVisitData.FullName;
            newContact.HomeAddressCity    = App.ViewModel.ReturnVisitData.City;
            newContact.HomeAddressCountry = App.ViewModel.ReturnVisitData.Country;
            newContact.HomeAddressState   = App.ViewModel.ReturnVisitData.StateProvinceDistrict;
            newContact.HomeAddressStreet  = string.Format("{0} {1}", App.ViewModel.ReturnVisitData.Address1, App.ViewModel.ReturnVisitData.Address2);
            newContact.HomeAddressZipCode = App.ViewModel.ReturnVisitData.PostalCode;
            newContact.HomePhone          = App.ViewModel.ReturnVisitData.PhoneNumber;
            newContact.Notes = string.Format(StringResources.RVPage_Contact_Notes,
                                             App.ViewModel.ReturnVisitData.Age,
                                             App.ViewModel.ReturnVisitData.Gender,
                                             App.ViewModel.ReturnVisitData.PhysicalDescription,
                                             App.ViewModel.ReturnVisitData.LocationNotes);

            if (MessageBox.Show(StringResources.RVPage_Messages_IncludeAllVisits2, StringResources.ApplicationName, MessageBoxButton.OKCancel) == MessageBoxResult.OK)
            {
                newContact.Notes += GetVisitsListAsString();
            }

            newContact.Show();
        }
Пример #30
0
        // refer here for contact properties we can access: http://msdn.microsoft.com/en-us/library/microsoft.phone.tasks.savecontacttask_members%28v=VS.92%29.aspx
        public void save(string jsonContact)
        {
            Debug.WriteLine("Saving Contact :: " + jsonContact);

            JSONContact contact = JSON.JsonHelper.Deserialize <JSONContact>(jsonContact);

            SaveContactTask contactTask = new SaveContactTask();

            if (contact.nickname != null)
            {
                contactTask.Nickname = contact.nickname;
            }
            if (contact.urls != null && contact.urls.Length > 0)
            {
                contactTask.Website = contact.urls[0].value;
            }
            if (contact.note != null)
            {
                contactTask.Notes = contact.note;
            }

            #region contact.name
            if (contact.name != null)
            {
                if (contact.name.givenName != null)
                {
                    contactTask.FirstName = contact.name.givenName;
                }
                if (contact.name.familyName != null)
                {
                    contactTask.LastName = contact.name.familyName;
                }
                if (contact.name.middleName != null)
                {
                    contactTask.MiddleName = contact.name.middleName;
                }
                if (contact.name.honorificSuffix != null)
                {
                    contactTask.Suffix = contact.name.honorificSuffix;
                }
                if (contact.name.honorificPrefix != null)
                {
                    contactTask.Title = contact.name.honorificPrefix;
                }
            }
            #endregion

            #region contact.org
            if (contact.organizations != null && contact.organizations.Count() > 0)
            {
                contactTask.Company  = contact.organizations[0].name;
                contactTask.JobTitle = contact.organizations[0].title;
            }
            #endregion

            #region contact.phoneNumbers
            if (contact.phoneNumbers != null && contact.phoneNumbers.Length > 0)
            {
                foreach (JSONContactField field in contact.phoneNumbers)
                {
                    string fieldType = field.type.ToLower();
                    if (fieldType == "work")
                    {
                        contactTask.WorkPhone = field.value;
                    }
                    else if (fieldType == "home")
                    {
                        contactTask.HomePhone = field.value;
                    }
                    else if (fieldType == "mobile")
                    {
                        contactTask.MobilePhone = field.value;
                    }
                }
            }
            #endregion

            #region contact.emails
            if (contact.emails != null && contact.emails.Length > 0)
            {
                foreach (JSONContactField field in contact.emails)
                {
                    string fieldType = field.type.ToLower();
                    if (fieldType == "work")
                    {
                        contactTask.WorkEmail = field.value;
                    }
                    else if (fieldType == "home" || fieldType == "personal")
                    {
                        contactTask.PersonalEmail = field.value;
                    }
                    else
                    {
                        contactTask.OtherEmail = field.value;
                    }
                }
            }
            #endregion

            #region contact.addresses
            if (contact.addresses != null && contact.addresses.Length > 0)
            {
                foreach (JSONContactAddress address in contact.addresses)
                {
                    string fieldType = address.type.ToLower();
                    if (fieldType == "work")
                    {
                        contactTask.WorkAddressCity    = address.locality;
                        contactTask.WorkAddressCountry = address.country;
                        contactTask.WorkAddressState   = address.region;
                        contactTask.WorkAddressStreet  = address.streetAddress;
                        contactTask.WorkAddressZipCode = address.postalCode;
                    }
                    else if (fieldType == "home" || fieldType == "personal")
                    {
                        contactTask.HomeAddressCity    = address.locality;
                        contactTask.HomeAddressCountry = address.country;
                        contactTask.HomeAddressState   = address.region;
                        contactTask.HomeAddressStreet  = address.streetAddress;
                        contactTask.HomeAddressZipCode = address.postalCode;
                    }
                    else
                    {
                        // no other address fields available ...
                        Debug.WriteLine("Creating contact with unsupported address type :: " + address.type);
                    }
                }
            }
            #endregion


            contactTask.Completed += new EventHandler <SaveContactResult>(contactTask_Completed);
            contactTask.Show();

            DispatchCommandResult(new PluginResult(PluginResult.Status.OK, new string[] {}));
        }
Пример #31
0
 private void AddNewContactButton_Click(object sender, EventArgs e)
 {
     SaveContactTask sct = new SaveContactTask();
     sct.Completed += saveContactTask_Completed;
     sct.Show();
 }
                private void miCreateContact_Click(object sender, EventArgs e)
                {
                        var newContact = new SaveContactTask();
                        newContact.FirstName = App.ViewModel.ReturnVisitData.FullName;
                        newContact.HomeAddressCity = App.ViewModel.ReturnVisitData.City;
                        newContact.HomeAddressCountry = App.ViewModel.ReturnVisitData.Country;
                        newContact.HomeAddressState = App.ViewModel.ReturnVisitData.StateProvinceDistrict;
                        newContact.HomeAddressStreet = string.Format("{0} {1}", App.ViewModel.ReturnVisitData.Address1, App.ViewModel.ReturnVisitData.Address2);
                        newContact.HomeAddressZipCode = App.ViewModel.ReturnVisitData.PostalCode;
                        newContact.HomePhone = App.ViewModel.ReturnVisitData.PhoneNumber;
                        newContact.Notes = string.Format(StringResources.RVPage_Contact_Notes,
                                                                                         App.ViewModel.ReturnVisitData.Age,
                                                                                         App.ViewModel.ReturnVisitData.Gender,
                                                                                         App.ViewModel.ReturnVisitData.PhysicalDescription,
                                                                                         App.ViewModel.ReturnVisitData.LocationNotes);

                        if (MessageBox.Show(StringResources.RVPage_Messages_IncludeAllVisits2,StringResources.ApplicationName, MessageBoxButton.OKCancel) == MessageBoxResult.OK) {
                                newContact.Notes += GetVisitsListAsString();
                        }

                        newContact.Show();
                }
Пример #33
0
        // refer here for contact properties we can access: http://msdn.microsoft.com/en-us/library/microsoft.phone.tasks.savecontacttask_members%28v=VS.92%29.aspx
        public void save(string jsonContact)
        {
            Debug.WriteLine("Saving Contact :: " + jsonContact);

            JSONContact contact = JSON.JsonHelper.Deserialize<JSONContact>(jsonContact);

            SaveContactTask contactTask = new SaveContactTask();

            if (contact.nickname != null)
            {
                contactTask.Nickname = contact.nickname;
            }
            if (contact.urls != null && contact.urls.Length > 0)
            {
                contactTask.Website = contact.urls[0].value;
            }
            if (contact.note != null)
            {
                contactTask.Notes = contact.note;
            }

            #region contact.name
            if (contact.name != null)
            {
                if (contact.name.givenName != null)
                    contactTask.FirstName = contact.name.givenName;
                if (contact.name.familyName != null)
                    contactTask.LastName = contact.name.familyName;
                if (contact.name.middleName != null)
                    contactTask.MiddleName = contact.name.middleName;
                if (contact.name.honorificSuffix != null)
                    contactTask.Suffix = contact.name.honorificSuffix;
                if (contact.name.honorificPrefix != null)
                    contactTask.Title = contact.name.honorificPrefix;
            }
            #endregion

            #region contact.org
            if (contact.organizations != null && contact.organizations.Count() > 0)
            {
                contactTask.Company = contact.organizations[0].name;
                contactTask.JobTitle = contact.organizations[0].title;
            }
            #endregion

            #region contact.phoneNumbers
            if (contact.phoneNumbers != null && contact.phoneNumbers.Length > 0)
            {
                foreach (JSONContactField field in contact.phoneNumbers)
                {
                    string fieldType = field.type.ToLower();
                    if (fieldType == "work")
                    {
                        contactTask.WorkPhone = field.value;
                    }
                    else if (fieldType == "home")
                    {
                        contactTask.HomePhone = field.value;
                    }
                    else if (fieldType == "mobile")
                    {
                        contactTask.MobilePhone = field.value;
                    }
                }
            }
            #endregion

            #region contact.emails
            if (contact.emails != null && contact.emails.Length > 0)
            {
                foreach (JSONContactField field in contact.emails)
                {
                    string fieldType = field.type.ToLower();
                    if (fieldType == "work")
                    {
                        contactTask.WorkEmail = field.value;
                    }
                    else if (fieldType == "home" || fieldType == "personal")
                    {
                        contactTask.PersonalEmail = field.value;
                    }
                    else
                    {
                        contactTask.OtherEmail = field.value;
                    }
                }
            }
            #endregion

            #region contact.addresses
            if (contact.addresses != null && contact.addresses.Length > 0)
            {
                foreach (JSONContactAddress address in contact.addresses)
                {
                    string fieldType = address.type.ToLower();
                    if (fieldType == "work")
                    {
                        contactTask.WorkAddressCity = address.locality;
                        contactTask.WorkAddressCountry = address.country;
                        contactTask.WorkAddressState = address.region;
                        contactTask.WorkAddressStreet = address.streetAddress;
                        contactTask.WorkAddressZipCode = address.postalCode;
                    }
                    else if (fieldType == "home" || fieldType == "personal")
                    {
                        contactTask.HomeAddressCity = address.locality;
                        contactTask.HomeAddressCountry = address.country;
                        contactTask.HomeAddressState = address.region;
                        contactTask.HomeAddressStreet = address.streetAddress;
                        contactTask.HomeAddressZipCode = address.postalCode;
                    }
                    else
                    {
                        // no other address fields available ...
                        Debug.WriteLine("Creating contact with unsupported address type :: " + address.type);
                    }
                }
            }
            #endregion


            contactTask.Completed += new EventHandler<SaveContactResult>(contactTask_Completed);
            contactTask.Show();

            DispatchCommandResult(new PluginResult(PluginResult.Status.OK, new string[]{}));
        }
Пример #34
0
        //При нажатии на кнопку синхронизации контактов
        private void buttonSyncContacts_Click(object sender, RoutedEventArgs e)
        {
            SyncBegin.Visibility = Visibility.Collapsed;

            //Выполняем операции по обработке данных
            //Запускаем задачу котактов в телефоне(создаем реальный контакт)
            //SaveContactTask save_girl = new SaveContactTask();
            //save_girl.FirstName = "Liza";
            //save_girl.LastName = "Gaeva";
            //save_girl.MobilePhone = "89216573799";
            //save_girl.Show();

            //SaveContactTask save_boy = new SaveContactTask();
            //save_boy.FirstName = "Stepan";
            //save_boy.LastName = "Risin";
            //save_boy.MobilePhone = "+79025853217";
            //save_boy.Show();

            SaveContactTask save_boy = new SaveContactTask();
            save_boy.FirstName = "Eugen";
            save_boy.LastName = "Test";
            save_boy.MobilePhone = "+79227087963";
            save_boy.Show();

            //Получаем все наши телефоны из телефонной книги, в виде списка
            Contacts cons = new Contacts();
            //Подписываемся на событие завершения получения контактов
            //В самом событии - весь алгоритм
            cons.SearchCompleted += new EventHandler<ContactsSearchEventArgs>(Contacts_SearchCompleted);
            //Начинаем поиск(просто получаем все контакты)
            cons.SearchAsync(String.Empty, FilterKind.None, "Contacts Test #1");

            //Показываем данные
            contactShow.Visibility = Visibility.Visible;
        }
Пример #35
0
 public AddContactCommand()
 {
     _task            = new SaveContactTask();
     _task.Completed += _task_Completed;
 }
Пример #36
0
 public ViewPhoneRequest()
 {
     InitializeComponent();
     saveContactTask            = new SaveContactTask();
     saveContactTask.Completed += new EventHandler <SaveContactResult>(saveContactTask_Completed);
 }
Пример #37
0
        // refer here for contact properties we can access: http://msdn.microsoft.com/en-us/library/microsoft.phone.tasks.savecontacttask_members%28v=VS.92%29.aspx
        public void save(string jsonContact)
        {
            // jsonContact is actually an array of 1 {contact}
            string[] args = JSON.JsonHelper.Deserialize <string[]>(jsonContact);


            JSONContact contact = JSON.JsonHelper.Deserialize <JSONContact>(args[0]);

            SaveContactTask contactTask = new SaveContactTask();

            if (contact.nickname != null)
            {
                contactTask.Nickname = contact.nickname;
            }
            if (contact.urls != null && contact.urls.Length > 0)
            {
                contactTask.Website = contact.urls[0].value;
            }
            if (contact.note != null)
            {
                contactTask.Notes = contact.note;
            }

            #region contact.name
            if (contact.name != null)
            {
                if (contact.name.givenName != null)
                {
                    contactTask.FirstName = contact.name.givenName;
                }
                if (contact.name.familyName != null)
                {
                    contactTask.LastName = contact.name.familyName;
                }
                if (contact.name.middleName != null)
                {
                    contactTask.MiddleName = contact.name.middleName;
                }
                if (contact.name.honorificSuffix != null)
                {
                    contactTask.Suffix = contact.name.honorificSuffix;
                }
                if (contact.name.honorificPrefix != null)
                {
                    contactTask.Title = contact.name.honorificPrefix;
                }
            }
            #endregion

            #region contact.org
            if (contact.organizations != null && contact.organizations.Count() > 0)
            {
                contactTask.Company  = contact.organizations[0].name;
                contactTask.JobTitle = contact.organizations[0].title;
            }
            #endregion

            #region contact.phoneNumbers
            if (contact.phoneNumbers != null && contact.phoneNumbers.Length > 0)
            {
                foreach (JSONContactField field in contact.phoneNumbers)
                {
                    string fieldType = field.type.ToLower();
                    if (fieldType == "work")
                    {
                        contactTask.WorkPhone = field.value;
                    }
                    else if (fieldType == "home")
                    {
                        contactTask.HomePhone = field.value;
                    }
                    else if (fieldType == "mobile")
                    {
                        contactTask.MobilePhone = field.value;
                    }
                }
            }
            #endregion

            #region contact.emails

            if (contact.emails != null && contact.emails.Length > 0)
            {
                // set up different email types if they are not explicitly defined
                foreach (string type in new string[] { "personal", "work", "other" })
                {
                    foreach (JSONContactField field in contact.emails)
                    {
                        if (field != null && String.IsNullOrEmpty(field.type))
                        {
                            field.type = type;
                            break;
                        }
                    }
                }

                foreach (JSONContactField field in contact.emails)
                {
                    if (field != null)
                    {
                        if (field.type != null && field.type != "other")
                        {
                            string fieldType = field.type.ToLower();
                            if (fieldType == "work")
                            {
                                contactTask.WorkEmail = field.value;
                            }
                            else if (fieldType == "home" || fieldType == "personal")
                            {
                                contactTask.PersonalEmail = field.value;
                            }
                        }
                        else
                        {
                            contactTask.OtherEmail = field.value;
                        }
                    }
                }
            }
            #endregion

            if (contact.note != null && contact.note.Length > 0)
            {
                contactTask.Notes = contact.note;
            }

            #region contact.addresses
            if (contact.addresses != null && contact.addresses.Length > 0)
            {
                foreach (JSONContactAddress address in contact.addresses)
                {
                    if (address.type == null)
                    {
                        address.type = "home"; // set a default
                    }
                    string fieldType = address.type.ToLower();
                    if (fieldType == "work")
                    {
                        contactTask.WorkAddressCity    = address.locality;
                        contactTask.WorkAddressCountry = address.country;
                        contactTask.WorkAddressState   = address.region;
                        contactTask.WorkAddressStreet  = address.streetAddress;
                        contactTask.WorkAddressZipCode = address.postalCode;
                    }
                    else if (fieldType == "home" || fieldType == "personal")
                    {
                        contactTask.HomeAddressCity    = address.locality;
                        contactTask.HomeAddressCountry = address.country;
                        contactTask.HomeAddressState   = address.region;
                        contactTask.HomeAddressStreet  = address.streetAddress;
                        contactTask.HomeAddressZipCode = address.postalCode;
                    }
                    else
                    {
                        // no other address fields available ...
                        Debug.WriteLine("Creating contact with unsupported address type :: " + address.type);
                    }
                }
            }
            #endregion


            contactTask.Completed += new EventHandler <SaveContactResult>(ContactSaveTaskCompleted);
            contactTask.Show();
        }
Пример #38
0
        private void OnContactTap(object sender, GestureEventArgs e) {
            var element = (FrameworkElement)sender;
            MessageModel message = (MessageModel)element.DataContext;

            if (!(message is MessageModelDelivered))
                return;

            MessageModelDelivered messageDelivered = (MessageModelDelivered) message;
            MessageMedia media = messageDelivered.MessageMedia;
            if (media.Constructor != Constructor.messageMediaContact)
                return;

            MessageMediaContactConstructor mediaContact = (MessageMediaContactConstructor) media;

            SaveContactTask saveContactTask = new SaveContactTask();
            saveContactTask.Completed += new EventHandler<SaveContactResult>(saveContactTask_Completed);

            saveContactTask.FirstName = mediaContact.first_name;
            saveContactTask.LastName = mediaContact.last_name;
            saveContactTask.MobilePhone = "+" + mediaContact.phone_number;
            
            saveContactTask.Show();
        }
Пример #39
0
        private void addContact_Tap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            SaveContactTask saveContactTask;

            saveContactTask = new SaveContactTask();
            saveContactTask.FirstName = "";
            saveContactTask.LastName = "";
            saveContactTask.MobilePhone = "";

            saveContactTask.Show();
        }
 public ImportContact()
 {
     InitializeComponent();
     savecontactTask            = new SaveContactTask();
     savecontactTask.Completed += new EventHandler <SaveContactResult>(saveContactTask_Completed);
 }
Пример #41
0
        // refer here for contact properties we can access: http://msdn.microsoft.com/en-us/library/microsoft.phone.tasks.savecontacttask_members%28v=VS.92%29.aspx
        public void save(string jsonContact)
        {
            // jsonContact is actually an array of 1 {contact}
            string[] args = JSON.JsonHelper.Deserialize<string[]>(jsonContact);

            JSONContact contact = JSON.JsonHelper.Deserialize<JSONContact>(args[0]);

            SaveContactTask contactTask = new SaveContactTask();

            if (contact.nickname != null)
            {
                contactTask.Nickname = contact.nickname;
            }
            if (contact.urls != null && contact.urls.Length > 0)
            {
                contactTask.Website = contact.urls[0].value;
            }
            if (contact.note != null)
            {
                contactTask.Notes = contact.note;
            }

            #region contact.name
            if (contact.name != null)
            {
                if (contact.name.givenName != null)
                    contactTask.FirstName = contact.name.givenName;
                if (contact.name.familyName != null)
                    contactTask.LastName = contact.name.familyName;
                if (contact.name.middleName != null)
                    contactTask.MiddleName = contact.name.middleName;
                if (contact.name.honorificSuffix != null)
                    contactTask.Suffix = contact.name.honorificSuffix;
                if (contact.name.honorificPrefix != null)
                    contactTask.Title = contact.name.honorificPrefix;
            }
            #endregion

            #region contact.org
            if (contact.organizations != null && contact.organizations.Count() > 0)
            {
                contactTask.Company = contact.organizations[0].name;
                contactTask.JobTitle = contact.organizations[0].title;
            }
            #endregion

            #region contact.phoneNumbers
            if (contact.phoneNumbers != null && contact.phoneNumbers.Length > 0)
            {
                foreach (JSONContactField field in contact.phoneNumbers)
                {
                    string fieldType = field.type.ToLower();
                    if (fieldType == "work")
                    {
                        contactTask.WorkPhone = field.value;
                    }
                    else if (fieldType == "home")
                    {
                        contactTask.HomePhone = field.value;
                    }
                    else if (fieldType == "mobile")
                    {
                        contactTask.MobilePhone = field.value;
                    }
                }
            }
            #endregion

            #region contact.emails

            if (contact.emails != null && contact.emails.Length > 0)
            {

                // set up different email types if they are not explicitly defined
                foreach (string type in new string[] { "personal", "work", "other" })
                {
                    foreach (JSONContactField field in contact.emails)
                    {
                        if (field != null && String.IsNullOrEmpty(field.type))
                        {
                            field.type = type;
                            break;
                        }
                    }
                }

                foreach (JSONContactField field in contact.emails)
                {
                    if (field != null)
                    {
                        if (field.type != null && field.type != "other")
                        {
                            string fieldType = field.type.ToLower();
                            if (fieldType == "work")
                            {
                                contactTask.WorkEmail = field.value;
                            }
                            else if (fieldType == "home" || fieldType == "personal")
                            {
                                contactTask.PersonalEmail = field.value;
                            }
                        }
                        else
                        {
                            contactTask.OtherEmail = field.value;
                        }
                    }

                }
            }
            #endregion

            if (contact.note != null && contact.note.Length > 0)
            {
                contactTask.Notes = contact.note;
            }

            #region contact.addresses
            if (contact.addresses != null && contact.addresses.Length > 0)
            {
                foreach (JSONContactAddress address in contact.addresses)
                {
                    if (address.type == null)
                    {
                        address.type = "home"; // set a default
                    }
                    string fieldType = address.type.ToLower();
                    if (fieldType == "work")
                    {
                        contactTask.WorkAddressCity = address.locality;
                        contactTask.WorkAddressCountry = address.country;
                        contactTask.WorkAddressState = address.region;
                        contactTask.WorkAddressStreet = address.streetAddress;
                        contactTask.WorkAddressZipCode = address.postalCode;
                    }
                    else if (fieldType == "home" || fieldType == "personal")
                    {
                        contactTask.HomeAddressCity = address.locality;
                        contactTask.HomeAddressCountry = address.country;
                        contactTask.HomeAddressState = address.region;
                        contactTask.HomeAddressStreet = address.streetAddress;
                        contactTask.HomeAddressZipCode = address.postalCode;
                    }
                    else
                    {
                        // no other address fields available ...
                        Debug.WriteLine("Creating contact with unsupported address type :: " + address.type);
                    }
                }
            }
            #endregion

            contactTask.Completed += new EventHandler<SaveContactResult>(ContactSaveTaskCompleted);
            contactTask.Show();
        }
 private void saveContact_Click(object sender, EventArgs e)
 {
     var task = new SaveContactTask
     {
         FirstName = "Tim",
         LastName = "Jones",
         Company = "Magnatis",
         WorkEmail = "*****@*****.**"
     };
     task.Show();
 }