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); } }
private void listEContacts_SelectionChanged(object sender, SelectionChangedEventArgs e) { // Item clicked, provide user with the options to call / msg the selected number ListView cb = sender as ListView; if (cb.SelectedIndex == -1) { return; } EContactItem selectedItem = cb.SelectedItem as EContactItem; cb.SelectedIndex = -1; ProcessEContactClick(selectedItem); }