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(); } } }
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 = ""; } }
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; }