init
This commit is contained in:
7
Common/DTS.Common.CPU/Classes/BREngine.cs
Normal file
7
Common/DTS.Common.CPU/Classes/BREngine.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace DTS.Common.CPU
|
||||
{
|
||||
public class BREngine
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
72
Common/DTS.Common.CPU/Classes/CPUEngine.cs
Normal file
72
Common/DTS.Common.CPU/Classes/CPUEngine.cs
Normal file
@@ -0,0 +1,72 @@
|
||||
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<Notification> NotificationRequest { get; private set; }
|
||||
public new InteractionRequest<Confirmation> ConfirmationRequest { get; private set; }
|
||||
|
||||
public CPUEngine()
|
||||
{
|
||||
_unityContainer= ServiceLocator.Current.GetInstance<IUnityContainer>();
|
||||
_eventAggregator = _unityContainer.Resolve<IEventAggregator>();
|
||||
_serviceLocator = _unityContainer.Resolve<IServiceLocator>();
|
||||
|
||||
NotificationRequest = new InteractionRequest<Notification>();
|
||||
ConfirmationRequest = new InteractionRequest<Confirmation>();
|
||||
|
||||
_eventAggregator.GetEvent<RaiseNotification>().Subscribe(OnRaiseNotification);
|
||||
_eventAggregator.GetEvent<ShowStatus>().Subscribe(OnStatusChange);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Private Event handler for Status change event.
|
||||
/// </summary>
|
||||
private void OnStatusChange(StatusInfo content)
|
||||
{
|
||||
//IsBusy = content.IsBusy;
|
||||
//IsBusyMessage = content.Text;
|
||||
//NotificationRequest.Raise(new Notification { Content = content, Title = "DataPRO" });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Private Event handler for RaiseNotification event.
|
||||
/// </summary>
|
||||
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)); }
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user