Пример #1
0
        public void pickContact(string arguments)
        {
            string[] args = JSON.JsonHelper.Deserialize<string[]>(arguments);

            // Use custom contact picker because WP8 api doesn't provide its' own
            // contact picker, only PhoneNumberChooser or EmailAddressChooserTask
            var task = new ContactPickerTask();
            var desiredFields = JSON.JsonHelper.Deserialize<string[]>(args[0]);

            task.Completed += delegate(Object sender, ContactPickerTask.PickResult e)
                {
                    if (e.TaskResult == TaskResult.OK)
                    {
                        string strResult = e.Contact.ToJson(desiredFields);
                        var result = new PluginResult(PluginResult.Status.OK)
                            {
                                Message = strResult
                            };
                        DispatchCommandResult(result);
                    }
                    if (e.TaskResult == TaskResult.Cancel)
                    {
                        DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, "Operation cancelled."));
                    }
                };

            task.Show();
        }
Пример #2
0
        public void pickContact(string arguments)
        {
            string[] args = JSON.JsonHelper.Deserialize <string[]>(arguments);

            // Use custom contact picker because WP8 api doesn't provide its' own
            // contact picker, only PhoneNumberChooser or EmailAddressChooserTask
            var task          = new ContactPickerTask();
            var desiredFields = JSON.JsonHelper.Deserialize <string[]>(args[0]);

            task.Completed += delegate(Object sender, ContactPickerTask.PickResult e)
            {
                if (e.TaskResult == TaskResult.OK)
                {
                    string strResult = e.Contact.ToJson(desiredFields);
                    var    result    = new PluginResult(PluginResult.Status.OK)
                    {
                        Message = strResult
                    };
                    DispatchCommandResult(result);
                }
                if (e.TaskResult == TaskResult.Cancel)
                {
                    DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, "Operation cancelled."));
                }
            };

            task.Show();
        }