protected override void OnEntitiesChanged(object key, Type changedType, EntityMessageType messageType, object sender) { if (sender == MainViewModel) { return; } if (loadPROJECT != null && changedType == typeof(BluePrints.Data.PROJECT) && loadPROJECT.GUID.ToString() == key.ToString()) { if (messageType == EntityMessageType.Added) { MessageBoxService.ShowMessage(string.Format(CommonResources.Notify_View_Restored, StringFormatUtils.GetEntityNameByType(changedType))); } else if (messageType == EntityMessageType.Deleted) { MessageBoxService.ShowMessage(string.Format(CommonResources.Notify_View_Removed, StringFormatUtils.GetEntityNameByType(changedType))); } } if (loadPROJECT != null) { if (MainViewModel != null) { mainThreadDispatcher.BeginInvoke(new Action(() => MainViewModel.Refresh())); } else if (loadPROJECT != null) { mainThreadDispatcher.BeginInvoke(new Action(() => InitializeAndLoadEntitiesLoaderDescription())); } } }
protected override void OnEntitiesChanged(object key, Type changedType, EntityMessageType messageType, object sender) { //Map the changes from PROGRESS_ITEM to BASELINE_ITEM so undo/redo operation is valid if (changedType == typeof(PROGRESS_ITEM)) { PROGRESS_ITEMProjection mappedEntity = MainViewModel.Entities.FirstOrDefault(x => x.PROGRESS_ITEMCurrent != null && x.PROGRESS_ITEMCurrent.GUID.ToString() == key.ToString()); mainThreadDispatcher.BeginInvoke(new Action(() => Messenger.Default.Send(new EntityMessage <BASELINE_ITEM, Guid>(mappedEntity.GUID, EntityMessageType.Changed, this)))); return; } if (sender == this) { return; } if (loadPROGRESS != null && changedType == typeof(PROGRESS) && loadPROGRESS.GUID.ToString() == key.ToString() || loadBASELINE != null && changedType == typeof(BASELINE) && loadBASELINE.GUID.ToString() == key.ToString() || loadPROJECT != null && changedType == typeof(BluePrints.Data.PROJECT) && loadPROJECT.GUID.ToString() == key.ToString()) { if (messageType == EntityMessageType.Added) { MessageBoxService.ShowMessage(string.Format(CommonResources.Notify_View_Restored, StringFormatUtils.GetEntityNameByType(changedType))); } else if (messageType == EntityMessageType.Deleted) { MessageBoxService.ShowMessage(string.Format(CommonResources.Notify_View_Removed, StringFormatUtils.GetEntityNameByType(changedType))); } } if (loadPROJECT != null || loadBASELINE != null || loadPROGRESS != null) { if (MainViewModel != null) { mainThreadDispatcher.BeginInvoke(new Action(() => MainViewModel.Refresh())); } else if (loadPROJECT != null || loadBASELINE != null) { mainThreadDispatcher.BeginInvoke(new Action(() => InitializeAndLoadEntitiesLoaderDescription())); } } }