private void NotificationMessageReceived(NotificationMessage msg) { if (msg.Target != null && msg.Target != this) { //Message not itended for here return; } if (msg.Notification == "OpenFocusTree") { FociGridContainer container = msg.Sender as FociGridContainer; if (TabsModelList.Where((t) => t is FocusGridModel && ((FocusGridModel)t).UniqueID == container.IdentifierID).Any()) { return; } FocusGridModel newModel = new FocusGridModel(container.IdentifierID); TabsModelList.Add(newModel); RaisePropertyChanged("TabsModelList"); } if (msg.Notification == "OpenLocalisation") { LocalisationContainer container = msg.Sender as LocalisationContainer; if (TabsModelList.Where((t) => t is LocalisationModel && ((LocalisationModel)t).UniqueID == container.IdentifierID).Any()) { return; } LocalisationModel newModel = new LocalisationModel(container.IdentifierID); TabsModelList.Add(newModel); RaisePropertyChanged("TabsModelList"); } if (msg.Notification == "SaveProject") { saveProject(); } if (msg.Notification == "RefreshProjectViewer") { TabsModelList.Clear(); RaisePropertyChanged("TabsModelList"); } if (msg.Notification == "SendDeleteItemSignal") { ObservableObject Model = null; if (msg.Sender is FociGridContainer) { Model = TabsModelList.FirstOrDefault((m) => m is FocusGridModel && ((FocusGridModel)m).UniqueID == ((FociGridContainer)msg.Sender).IdentifierID); } else if (msg.Sender is LocalisationContainer) { Model = TabsModelList.FirstOrDefault((m) => m is LocalisationModel && ((LocalisationModel)m).UniqueID == ((LocalisationContainer)msg.Sender).IdentifierID); } TabsModelList.Remove(Model); RaisePropertyChanged("TabsModelList"); } }
private void NotificationMessageReceived(NotificationMessage msg) { //If this is not the intended target if (msg.Target != null && msg.Target != this) { return; } if (msg.Notification == "OpenFocusTree") { FocusGridModel container = msg.Sender as FocusGridModel; if (TabsModelList.Contains(container)) { return; } CheckForChanges(container); TabsModelList.Add(container); RaisePropertyChanged("TabsModelList"); } if (msg.Notification == "OpenLocalisation") { LocalisationModel container = msg.Sender as LocalisationModel; if (TabsModelList.Contains(container)) { return; } CheckForChanges(container); TabsModelList.Add(container); RaisePropertyChanged("TabsModelList"); } if (msg.Notification == "OpenEventList") { EventTabModel container = msg.Sender as EventTabModel; if (TabsModelList.Contains(container)) { return; } CheckForChanges(container); TabsModelList.Add(container); RaisePropertyChanged("TabsModelList"); } if (msg.Notification == "OpenScriptList") { ScriptModel container = msg.Sender as ScriptModel; if (TabsModelList.Contains(container)) { return; } CheckForChanges(container); TabsModelList.Add(container); RaisePropertyChanged("TabsModelList"); } if (msg.Notification == "SaveProject") { saveProject(); } if (msg.Notification == "RefreshProjectViewer") { TabsModelList.Clear(); RaisePropertyChanged("TabsModelList"); } if (msg.Notification == "SendDeleteItemSignal") { ObservableObject Model = null; if (msg.Sender is FocusGridModel) { Model = TabsModelList.FirstOrDefault((m) => m is FocusGridModel && ((FocusGridModel)m).UniqueID == ((FocusGridModel)msg.Sender).UniqueID); } else if (msg.Sender is LocalisationModel) { Model = TabsModelList.FirstOrDefault((m) => m is LocalisationModel && ((LocalisationModel)m).UniqueID == ((LocalisationModel)msg.Sender).UniqueID); } else if (msg.Sender is EventTabModel) { Model = TabsModelList.FirstOrDefault((m) => m is EventTabModel && ((EventTabModel)m).UniqueID == ((EventTabModel)msg.Sender).UniqueID); } else if (msg.Sender is ScriptModel) { Model = TabsModelList.FirstOrDefault((m) => m is ScriptModel && ((ScriptModel)m).UniqueID == ((ScriptModel)msg.Sender).UniqueID); } TabsModelList.Remove(Model); RaisePropertyChanged("TabsModelList"); } if (msg.Target == this) { //Resend to the tutorial View model if this was the target Messenger.Default.Send(new NotificationMessage(msg.Sender, new ViewModelLocator().Tutorial, msg.Notification)); } }