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)"; } }
private void Hyperlink_Click(object sender, RoutedEventArgs e) { BusinessLayer.ConversationManager cm = new BusinessLayer.ConversationManager(); EntityLayer.Conversation c; if(AddNum.Text.Length > 0) { c = cm.getConversationsFromContact(AddNum.Text); if (c == null) { cm.AddConversation(new EntityLayer.Contact(AddNum.Text)); IList<EntityLayer.Conversation> convs = cm.getConversations(); ViewModel.Conversation.ConversationsModelView cmv = new ViewModel.Conversation.ConversationsModelView(convs); parent.ListConversations.DataContext = cmv; } if (!parent.findConvos(AddNum.Text)) { Conversation cw = new Conversation(parent, AddNum.Text); parent.addConv(cw); cw.Show(); } this.Close(); } }
private void ListContacts_MouseDoubleClick(object sender, MouseButtonEventArgs e) { BusinessLayer.ConversationManager cm = new BusinessLayer.ConversationManager(); if (ListContact.SelectedItem != null) { EntityLayer.Conversation c; c = cm.getConversationsFromContact(((ContactModelView)ListContact.SelectedItem).Contact.Num); if (c == null) { cm.AddConversation(((ContactModelView)ListContact.SelectedItem).Contact); IList<EntityLayer.Conversation> convs = cm.getConversations(); ViewModel.Conversation.ConversationsModelView cmv = new ViewModel.Conversation.ConversationsModelView(convs); parentWindow.ListConversations.DataContext = cmv; } if (!parentWindow.findConvos(((ContactModelView)ListContact.SelectedItem).Contact.Num)) { Conversation cw = new Conversation(parentWindow, ((ContactModelView)ListContact.SelectedItem).Contact.Num); parentWindow.addConv(cw); cw.Show(); } } }
public void ContactWindow_Loaded(object sender, RoutedEventArgs e) { BusinessLayer.ConversationManager cm = new BusinessLayer.ConversationManager(); IList<EntityLayer.Contact> contacts = cm.getContacts(); ViewModel.Contact.ContactsModelView cmv = new ViewModel.Contact.ContactsModelView(contacts); ListContact.DataContext = cmv; }
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"; }
public Conversation(MainWindow parent,String contact) { InitializeComponent(); this.contact = contact; this.parent = parent; BusinessLayer.ConversationManager cm = new BusinessLayer.ConversationManager(); EntityLayer.Conversation convs = cm.getConversationsFromContact(contact); ViewModel.SMS.SMSsModelView cmv = new ViewModel.SMS.SMSsModelView(convs.Messages); ConvTitle.Text = "Conversation avec " + convs.Receiver.Nom + " (" + convs.Receiver.Num + ")"; FilConv.DataContext = cmv; }
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 = ""; } }
private void MenuItem_Delete_Click(object sender, RoutedEventArgs e) { BusinessLayer.ConversationManager cm = new BusinessLayer.ConversationManager(); if (ListContact.SelectedItem != null) { cm.removeContact(((ContactModelView)ListContact.SelectedItem).Contact); IList<EntityLayer.Contact> contacts = cm.getContacts(); ViewModel.Contact.ContactsModelView cmv = new ViewModel.Contact.ContactsModelView(contacts); ListContact.DataContext = cmv; } }