private void messageList_SelectedIndexChanged(object sender, EventArgs e) { if (messageList.SelectedItems.Count > 0) { SmsDeliverMessage message = messageList.SelectedItems[0].Tag as SmsDeliverMessage; newMessageTo.Text = message.SenderAddress.PhoneNumber; newMessageText.Text = message.Text; } }
private void existingMessageDelete_Click(object sender, EventArgs e) { if (messageList.SelectedItems.Count > 0) { SmsDeliverMessage message = messageList.SelectedItems[0].Tag as SmsDeliverMessage; try { ProgressShow("Opening Phone..."); using (PhoneClient phoneClient = new PhoneClient(serialPortList.Text)) { phoneClient.Delete(message); messageList.Items.Remove(messageList.SelectedItems[0]); } } catch (Exception ex) { ProgressShow("Failed to open phone: " + ex.Message); } // reindex messages serialPortList_SelectedIndexChanged(null, null); } }