public SMS() { InitializeComponent(); SMSView model = ObjectPool.Instance.Resolve <SMSView>(); if (this.DataContext == null && model != null) { this.DataContext = model; } }
public MainWindowViewModel(ServerConfiguration serverConfiguration, MessageCollaborator messageCollection, ApplicationSettings applicationSettings, GeneralView generalView, CallView callView, PortView portView, SMSView smsView) { this.serverConfiguration = serverConfiguration; this.messageCollection = messageCollection; this.applicationSettings = applicationSettings; this.generalView = generalView; this.callView = callView; this.portView = portView; this.smsView = smsView; }
/* The SubmitOrderButtonClick are what will * fire when the button on the UI is checked */ private void SubmitOrderButtonClick() { string message = "{ \"Header\": \"" + MessageHeader + "\" , \"Body\":\"" + MessageBody + "\"}"; Message hf = new Message(message); Dictionary <string, string> msg = hf.StartFilter(); if (msg["error"] == "1") { MessageBox.Show("Header Error!"); } else { try { if (msg["Type"] == "SMS") { Type = msg["Type"]; Sender = msg["Sender"]; Content = msg["Content"]; ContentControlBinding = new SMSView(); } else if (msg["Type"] == "Email") { if (msg["EmailType"] == "Standard") { Type = msg["Type"]; EmailType = msg["EmailType"]; Sender = msg["Sender"]; URL = msg["URL"]; Content = msg["Content"]; ContentControlBinding = new EmailView(); } else { Type = msg["Type"]; EmailType = msg["EmailType"]; Sender = msg["Sender"]; Subject = msg["Subject"]; Code = msg["Code"]; URL = msg["URL"]; Incident = msg["Incident"]; Content = msg["Content"]; ContentControlBinding = new SIRView(); } } else if (msg["Type"] == "Tweets") { Type = msg["Type"]; Sender = msg["Sender"]; Hashtags = msg["Hashtags"]; Mentions = msg["Mentions"]; Content = msg["Content"]; ContentControlBinding = new TweetsView(); } OnChnaged(nameof(ContentControlBinding)); SubmitOrderButtonContent = "Return"; OnChnaged(nameof(SubmitOrderButtonContent)); SubmitOrderButtonCommand = new RelayCommand(ReturnButtonClick); OnChnaged(nameof(SubmitOrderButtonCommand)); } catch (Exception e) { MessageBox.Show("Body error!"); } } }