using System.ComponentModel; using Microsoft.Practices.Prism.Events; using Microsoft.Practices.Prism.Interactivity.InteractionRequest; using Microsoft.Practices.Prism.Regions; using Microsoft.Practices.Unity; using Microsoft.Practices.ServiceLocation; using DTS.Common.Events; using DTS.Common.Interface; using DTS.Common.Base; using System; namespace DTS.Common.CPU { public class CPUEngine : ICPUEngine { private IEventAggregator _eventAggregator { get; set; } private new IRegionManager _regionManager; private IUnityContainer _unityContainer { get; set; } public IServiceLocator _serviceLocator { get; private set; } public InteractionRequest NotificationRequest { get; private set; } public new InteractionRequest ConfirmationRequest { get; private set; } public CPUEngine() { _unityContainer= ServiceLocator.Current.GetInstance(); _eventAggregator = _unityContainer.Resolve(); _serviceLocator = _unityContainer.Resolve(); NotificationRequest = new InteractionRequest(); ConfirmationRequest = new InteractionRequest(); _eventAggregator.GetEvent().Subscribe(OnRaiseNotification); _eventAggregator.GetEvent().Subscribe(OnStatusChange); } /// /// Private Event handler for Status change event. /// private void OnStatusChange(StatusInfo content) { //IsBusy = content.IsBusy; //IsBusyMessage = content.Text; //NotificationRequest.Raise(new Notification { Content = content, Title = "DataPRO" }); } /// /// Private Event handler for RaiseNotification event. /// private void OnRaiseNotification(NotificationContentEventArgs eventArgsWithTitle) { // Notification object expects a NotificationContentEventArgsWithoutTitle object and a Title string. var eventArgsWithoutTitle = new NotificationContentEventArgs(eventArgsWithTitle.Message, eventArgsWithTitle.MessageDetails, eventArgsWithTitle.Image); NotificationRequest.Raise(new Notification { Content = eventArgsWithoutTitle, Title = eventArgsWithTitle.Title }); } public new event PropertyChangedEventHandler PropertyChanged; public void OnPropertyChanged(string propertyName) { var eventHandler = PropertyChanged; if (eventHandler != null) { eventHandler(this, new PropertyChangedEventArgs(propertyName)); } } } }