private void Hyperlink_Click(object sender, RoutedEventArgs e) { Regex rgx = new Regex(@"^[0-9]+$"); if (rgx.IsMatch(AddNum.Text)) { BusinessLayer.ConversationManager cm = new BusinessLayer.ConversationManager(); EntityLayer.Contact contacts = cm.getContactFromString(AddNum.Text); if (contacts == null) { EntityLayer.Contact c; if (AddNom.Text.Length == 0) { c = new EntityLayer.Contact(AddNum.Text); } else { c = new EntityLayer.Contact(AddNom.Text, AddNum.Text); } cm.addContact(c); IList<EntityLayer.Contact> icon = cm.getContacts(); parentWindow.ListContact.DataContext = new ViewModel.Contact.ContactsModelView(icon); } this.Close(); } else { AddTitle.Text = "Ajout d'un contact (Numéro Invalide)"; } }
public AddContact(Contact parentWindow,String contact) { InitializeComponent(); this.parentWindow = parentWindow; BusinessLayer.ConversationManager cm = new BusinessLayer.ConversationManager(); EntityLayer.Contact contacts = cm.getContactFromString(contact); ViewModel.Contact.ContactModelView cmv = new ViewModel.Contact.ContactModelView(contacts); this.DataContext = cmv; ButtonAdd.Text = "+ Modifier"; }
private void AppButton_Click(object sender, EventArgs e) { BusinessLayer.ConversationManager cm = new BusinessLayer.ConversationManager(); if(TextField.Text.Length > 0) { EntityLayer.SMS sms = new EntityLayer.SMS(TextField.Text, cm.getContactFromString(contact)); cm.AddMessageToConv(sms, cm.getConversationsFromContact(contact)); EntityLayer.Conversation convs = cm.getConversationsFromContact(contact); ViewModel.SMS.SMSsModelView cmv = new ViewModel.SMS.SMSsModelView(convs.Messages); FilConv.DataContext = cmv; UsbManager manager = UsbManager.getInstance(null); manager.send(sms); IList<EntityLayer.Conversation> convs2 = cm.getConversations(); ViewModel.Conversation.ConversationsModelView cmv2 = new ViewModel.Conversation.ConversationsModelView(convs2); parent.ListConversations.DataContext = cmv2; TextField.Text = ""; } }