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