147 lines
4.5 KiB
Plaintext
147 lines
4.5 KiB
Plaintext
|
|
using System;
|
||
|
|
using System.ComponentModel;
|
||
|
|
using System.Threading.Tasks;
|
||
|
|
using DTS.Common.Base;
|
||
|
|
using DTS.Common.Events;
|
||
|
|
using DTS.Common.Interface;
|
||
|
|
using Microsoft.Practices.Prism.Events;
|
||
|
|
using Microsoft.Practices.Prism.Interactivity.InteractionRequest;
|
||
|
|
using Microsoft.Practices.Prism.Regions;
|
||
|
|
using Microsoft.Practices.Unity;
|
||
|
|
|
||
|
|
namespace DTS.Common.Property
|
||
|
|
{
|
||
|
|
public class PropertyViewModel : BaseViewModel<IGraphPropertyViewModel>, IPropertyViewModel
|
||
|
|
{
|
||
|
|
public IPropertyView View { get; private set; }
|
||
|
|
private IBaseWindowModel Parent { get; set; }
|
||
|
|
private IEventAggregator EventAggregator { get; set; }
|
||
|
|
private new IRegionManager _regionManager;
|
||
|
|
private IUnityContainer UnityContainer { get; set; }
|
||
|
|
|
||
|
|
public InteractionRequest<Notification> NotificationRequest { get; private set; }
|
||
|
|
public new InteractionRequest<Confirmation> ConfirmationRequest { get; private set; }
|
||
|
|
|
||
|
|
public PropertyViewModel(IPropertyView view, IRegionManager regionManager, IEventAggregator eventAggregator, IUnityContainer unityContainer)
|
||
|
|
: base(regionManager, eventAggregator, unityContainer)
|
||
|
|
{
|
||
|
|
View = view;
|
||
|
|
View.DataContext = this;
|
||
|
|
NotificationRequest = new InteractionRequest<Notification>();
|
||
|
|
ConfirmationRequest = new InteractionRequest<Confirmation>();
|
||
|
|
|
||
|
|
EventAggregator = eventAggregator;
|
||
|
|
UnityContainer = unityContainer;
|
||
|
|
_regionManager = regionManager;
|
||
|
|
EventAggregator.GetEvent<RaiseNotification>().Subscribe(OnRaiseNotification);
|
||
|
|
}
|
||
|
|
|
||
|
|
#region Methods
|
||
|
|
/// <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 override void Initialize()
|
||
|
|
{
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
public override void Initialize(object parameter)
|
||
|
|
{
|
||
|
|
Parent = (IBaseWindowModel)parameter;
|
||
|
|
}
|
||
|
|
public void Initialize(object parameter, object properties)
|
||
|
|
{
|
||
|
|
Parent = (IBaseWindowModel)parameter;
|
||
|
|
_properties = properties;
|
||
|
|
|
||
|
|
}
|
||
|
|
public override void Activated()
|
||
|
|
{
|
||
|
|
throw new NotImplementedException();
|
||
|
|
}
|
||
|
|
|
||
|
|
public override void Cleanup()
|
||
|
|
{
|
||
|
|
throw new NotImplementedException();
|
||
|
|
}
|
||
|
|
|
||
|
|
public new Task CleanupAsync()
|
||
|
|
{
|
||
|
|
throw new NotImplementedException();
|
||
|
|
}
|
||
|
|
|
||
|
|
public override Task InitializeAsync()
|
||
|
|
{
|
||
|
|
throw new NotImplementedException();
|
||
|
|
}
|
||
|
|
|
||
|
|
public override Task InitializeAsync(object parameter)
|
||
|
|
{
|
||
|
|
throw new NotImplementedException();
|
||
|
|
}
|
||
|
|
#endregion
|
||
|
|
|
||
|
|
#region ContextRegion
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
#endregion
|
||
|
|
|
||
|
|
|
||
|
|
#region Properties
|
||
|
|
|
||
|
|
private object _properties;
|
||
|
|
public object Properties {
|
||
|
|
get { return _properties; }
|
||
|
|
set { _properties = value; OnPropertyChanged("Properties"); }
|
||
|
|
}
|
||
|
|
|
||
|
|
///<summary>
|
||
|
|
///Occurs when a property value changes.
|
||
|
|
///</summary>
|
||
|
|
public new event PropertyChangedEventHandler PropertyChanged;
|
||
|
|
|
||
|
|
private new void OnPropertyChanged(string propertyName)
|
||
|
|
{
|
||
|
|
var eventHandler = PropertyChanged;
|
||
|
|
if (eventHandler != null)
|
||
|
|
{
|
||
|
|
eventHandler(this, new PropertyChangedEventArgs(propertyName));
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// Gets the HeaderInfo.
|
||
|
|
/// </summary>
|
||
|
|
public string HeaderInfo
|
||
|
|
{
|
||
|
|
get { return "Graph Property"; }
|
||
|
|
}
|
||
|
|
|
||
|
|
public new bool IsBusy
|
||
|
|
{
|
||
|
|
get { throw new NotImplementedException(); }
|
||
|
|
set { throw new NotImplementedException(); }
|
||
|
|
}
|
||
|
|
|
||
|
|
public new bool IsDirty
|
||
|
|
{
|
||
|
|
get { throw new NotImplementedException(); }
|
||
|
|
}
|
||
|
|
|
||
|
|
#endregion
|
||
|
|
}
|
||
|
|
}
|