private static EContactModel ParseEContacts(string jsonString) { EContactModel model = new EContactModel(); try { JArray a = JArray.Parse(jsonString); foreach (JObject i in a) { foreach (var p in i) { EContactItem eContactItem = new EContactItem(); eContactItem.Name = p.Key; eContactItem.Contact = (string)p.Value; model.EContactItems.Add(eContactItem); } } } catch (Exception) { throw new HttpRequestException("Internet connection is required to download the contact list for the first time"); } return(model); }
private static EContactModel ParseEContacts(string jsonString) { EContactModel model = new EContactModel(); try { JArray a = JArray.Parse(jsonString); foreach (JObject i in a) { foreach (var p in i) { EContactItem eContactItem = new EContactItem(); eContactItem.Name = p.Key; eContactItem.Contact = (string)p.Value; model.EContactItems.Add(eContactItem); } } } catch (Exception) { throw new HttpRequestException("Internet connection is required to download the contact list for the first time"); } return model; }
private async void ProcessEContactClick(EContactItem selectedItem) { string content = string.Format("Call or message {0}?\nPress back to cancel.", selectedItem.Name); string title = "Information"; string[] cmdString = new string[] { "call", "message" }; MessageDialog md = new MessageDialog(content, title); md.Commands.Add(new UICommand(cmdString[0])); md.Commands.Add(new UICommand(cmdString[1])); IUICommand result = await md.ShowAsync(); if (result == null) return; string resultString = result.Label; if (resultString == cmdString[0]) { // Process call Windows.ApplicationModel.Calls.PhoneCallManager.ShowPhoneCallUI(selectedItem.Contact, selectedItem.Name); } else if (resultString == cmdString[1]) { // Process message Windows.ApplicationModel.Chat.ChatMessage chatMsg = new Windows.ApplicationModel.Chat.ChatMessage(); chatMsg.Recipients.Add(selectedItem.Contact); chatMsg.Body = ""; await ChatMessageManager.ShowComposeSmsMessageAsync(chatMsg); } }