init
This commit is contained in:
@@ -0,0 +1,215 @@
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Threading.Tasks;
|
||||
using DTS.Common.Base;
|
||||
using DTS.Common.Events;
|
||||
using DTS.Common.Interactivity;
|
||||
using DTS.Common.Interface;
|
||||
using Prism.Commands;
|
||||
using Prism.Events;
|
||||
using Prism.Regions;
|
||||
using Unity;
|
||||
|
||||
namespace QASettings
|
||||
{
|
||||
[Export(typeof(IQASettingsView))]
|
||||
[PartCreationPolicy(CreationPolicy.Shared)]
|
||||
public class QASettingsViewModel : IQASettingsViewModel
|
||||
{
|
||||
public IQASettingsView View { get; private set; }
|
||||
private IEventAggregator _eventAggregator { get; set; }
|
||||
private IRegionManager _regionManager;
|
||||
private IUnityContainer UnityContainer { get; set; }
|
||||
|
||||
public InteractionRequest<Notification> NotificationRequest { get; private set; }
|
||||
public InteractionRequest<Confirmation> ConfirmationRequest { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new instance of the TechnologyDomainEditViewModel.
|
||||
/// </summary>
|
||||
/// <param name="view">The ShellView View.</param>
|
||||
/// <param name="regionManager">The logical placeholder defined within the application's UI (in the shell or within views) into which views are displayed.</param>
|
||||
/// <param name="eventAggregator">The EventAggregator which allows different components to publish/subscribe to events without being coupled to each other.</param>
|
||||
/// <param name="unityContainer">The unityContainer.</param>
|
||||
public QASettingsViewModel(IQASettingsView 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);
|
||||
_eventAggregator.GetEvent<BusyIndicatorChangeNotification>().Subscribe(OnBusyIndicatorNotification, ThreadOption.PublisherThread, true);
|
||||
}
|
||||
#region Methods
|
||||
|
||||
public void Cleanup() { }
|
||||
|
||||
public Task CleanupAsync() { return Task.CompletedTask; }
|
||||
|
||||
public void Initialize() { }
|
||||
|
||||
public void Initialize(object parameter)
|
||||
{
|
||||
|
||||
}
|
||||
public void Initialize(object parameter, object model)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public Task InitializeAsync() { return Task.CompletedTask; }
|
||||
|
||||
public Task InitializeAsync(object parameter) { return Task.CompletedTask; }
|
||||
|
||||
public void Activated() { }
|
||||
|
||||
/// <summary>
|
||||
/// Private Event handler for RaiseNotification event.
|
||||
/// </summary>
|
||||
private void OnBusyIndicatorNotification(bool eventArg)
|
||||
{
|
||||
IsBusy = eventArg;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Private Event handler for RaiseNotification event.
|
||||
/// </summary>
|
||||
private void OnRaiseNotification(NotificationContentEventArgs eventArgsWithTitle)
|
||||
{
|
||||
// The NotificationRequest.Raise triggers the Invoke() method of the .Infrastructure.PopupWindowAction object
|
||||
// to show the .Infrastructure.NotificationWindow window
|
||||
|
||||
// Notification object expects a NotificationContentEventArgsWithoutTitle object and a Title string.
|
||||
var eventArgsWithoutTitle = new NotificationContentEventArgs(eventArgsWithTitle.Message, "", eventArgsWithTitle.Image, "");
|
||||
|
||||
NotificationRequest.Raise(new Notification { Content = eventArgsWithoutTitle, Title = eventArgsWithTitle.Title });
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Commands
|
||||
/// <summary>
|
||||
/// Reload list of the available networks
|
||||
/// </summary>
|
||||
private DelegateCommand _createCommand;
|
||||
public DelegateCommand CreateCommand { get { return _createCommand ?? (_createCommand = new DelegateCommand(CreateMethod)); } }
|
||||
private async void CreateMethod()
|
||||
{
|
||||
//do something useful
|
||||
}
|
||||
#endregion Commands
|
||||
|
||||
#region Properties
|
||||
|
||||
private int _numberOfSensorModels = 200;
|
||||
public string NumberOfSensorModelsText
|
||||
{
|
||||
get { return _numberOfSensorModels.ToString("N0"); }
|
||||
set
|
||||
{
|
||||
_numberOfSensorModels = int.Parse(value);
|
||||
OnPropertyChanged("NumberOfSensorModelsText");
|
||||
}
|
||||
}
|
||||
|
||||
private int _numberOfTestSetups = 150;
|
||||
public string NumberOfTestSetupsText
|
||||
{
|
||||
get { return _numberOfTestSetups.ToString("N0"); }
|
||||
set
|
||||
{
|
||||
_numberOfTestSetups = int.Parse(value);
|
||||
OnPropertyChanged("NumberOfTestSetupsText");
|
||||
}
|
||||
}
|
||||
|
||||
private int _numberOfGroups = 50;
|
||||
public string NumberOfGroupsText
|
||||
{
|
||||
get { return _numberOfGroups.ToString("N0"); }
|
||||
set
|
||||
{
|
||||
_numberOfGroups = int.Parse(value);
|
||||
OnPropertyChanged("NumberOfGroupsText");
|
||||
}
|
||||
}
|
||||
|
||||
private int _numberOfSensors = 500;
|
||||
public string NumberOfSensorsText
|
||||
{
|
||||
get { return _numberOfSensors.ToString("N0"); }
|
||||
set { _numberOfSensors = int.Parse(value); OnPropertyChanged("NumberOfSensorsText"); }
|
||||
}
|
||||
|
||||
private int _numberOfGroupTemplates = 50;
|
||||
public string NumberOfGroupTemplatesText
|
||||
{
|
||||
get { return _numberOfGroupTemplates.ToString("N0"); }
|
||||
set
|
||||
{
|
||||
_numberOfGroupTemplates = int.Parse(value);
|
||||
OnPropertyChanged("NumberOfGroupTemplatesText");
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsDirty { get; private set; }
|
||||
|
||||
private bool _isBusy = false;
|
||||
public bool IsBusy
|
||||
{
|
||||
get { return _isBusy; }
|
||||
set { _isBusy = value; OnPropertyChanged("IsBusy"); }
|
||||
}
|
||||
|
||||
private bool _isMenuIncluded = false;
|
||||
public bool IsMenuIncluded
|
||||
{
|
||||
get { return _isMenuIncluded; }
|
||||
set
|
||||
{
|
||||
_isMenuIncluded = value;
|
||||
OnPropertyChanged("IsMenuIncluded");
|
||||
}
|
||||
}
|
||||
private bool _isNavigationIncluded = false;
|
||||
public bool IsNavigationIncluded
|
||||
{
|
||||
get { return _isNavigationIncluded; }
|
||||
set
|
||||
{
|
||||
_isNavigationIncluded = value;
|
||||
OnPropertyChanged("IsNavigationIncluded");
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets the HeaderInfo.
|
||||
/// </summary>
|
||||
public string HeaderInfo { get { return "MainRegion"; } }
|
||||
#endregion Properties
|
||||
|
||||
///<summary>
|
||||
///Occurs when a property value changes.
|
||||
///</summary>
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
private void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
|
||||
public bool SetProperty<T>(ref T storage, T value, string propertyName = null)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
void IBasePropertyChanged.OnPropertyChanged(string propertyName)
|
||||
{
|
||||
OnPropertyChanged(propertyName);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user