init
This commit is contained in:
@@ -0,0 +1,152 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Threading;
|
||||
using DTS.Common.Events;
|
||||
using DTS.Common.Interactivity;
|
||||
using Prism.Commands;
|
||||
using Prism.Events;
|
||||
using Prism.Regions;
|
||||
using Unity;
|
||||
// ReSharper disable once CheckNamespace
|
||||
namespace DTS.Common.Base
|
||||
{
|
||||
public abstract class BaseViewModel<TModel> : BasePropertyChanged, IBaseViewModel
|
||||
where TModel : class
|
||||
{
|
||||
|
||||
protected IEventAggregator Aggregator { get; private set; }
|
||||
protected IUnityContainer Container { get; private set; }
|
||||
public TModel Model { get; set; }
|
||||
|
||||
protected BaseViewModel()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected BaseViewModel(IRegionManager regionManager, IEventAggregator eventAggregator, IUnityContainer unityContainer)
|
||||
{
|
||||
Aggregator = eventAggregator;
|
||||
Container = unityContainer;
|
||||
CreateCommands();
|
||||
}
|
||||
|
||||
|
||||
protected virtual void CreateCommands()
|
||||
{
|
||||
ConfirmationRequest = new InteractionRequest<Confirmation>();
|
||||
CloseCommand = new DelegateCommand<object>(CloseMethod);
|
||||
}
|
||||
|
||||
#region Commands
|
||||
|
||||
/// <summary>
|
||||
/// The interaction request to display the confirmation.
|
||||
/// </summary>
|
||||
public InteractionRequest<Confirmation> ConfirmationRequest { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// The delegate command to close object.
|
||||
/// </summary>
|
||||
public DelegateCommand<object> CloseCommand { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// This is an execute method for the <see cref="CloseCommand">CloseCommand</see>.
|
||||
/// </summary>
|
||||
/// <param name="parameter">The parameter to pass to the <see cref="CloseCommand">CloseCommand</see>.</param>
|
||||
protected virtual void CloseMethod(object parameter)
|
||||
{
|
||||
CleanupAtClose();
|
||||
}
|
||||
|
||||
private void CleanupAtClose()
|
||||
{
|
||||
Cleanup();
|
||||
}
|
||||
|
||||
#endregion Commands
|
||||
|
||||
#region Bases Methods
|
||||
|
||||
/// <summary>
|
||||
/// Executes after the viewmodel activated.
|
||||
/// </summary>
|
||||
public virtual void Activated()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Publishes the <see cref="ShowStatus">ShowStatus</see> during the viewmodel initialization.
|
||||
/// </summary>
|
||||
public virtual void Initialize()
|
||||
{
|
||||
Aggregator.GetEvent<ShowStatus>()
|
||||
.Publish(new StatusInfo(StatusInfo.StatusState.Busy, Strings.Strings.Loading));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Publishes the <see cref="ShowStatus">ShowStatus</see> during the viewmodel initialization.
|
||||
/// </summary>
|
||||
/// <param name="parameter">The parameter to be used initialize viewmodel.</param>
|
||||
public virtual void Initialize(object parameter)
|
||||
{
|
||||
Aggregator.GetEvent<ShowStatus>()
|
||||
.Publish(new StatusInfo(StatusInfo.StatusState.Busy, Strings.Strings.Loading));
|
||||
}
|
||||
|
||||
public virtual void Initialize(object parameter, object model)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Publishes the <see cref="ShowStatus">ShowStatus</see> during the viewmodel initialization.
|
||||
/// </summary>
|
||||
public virtual async Task InitializeAsync()
|
||||
{
|
||||
await Dispatcher.CurrentDispatcher.InvokeAsync(() =>
|
||||
{
|
||||
Aggregator.GetEvent<ShowStatus>()
|
||||
.Publish(new StatusInfo(StatusInfo.StatusState.Busy, Strings.Strings.Loading));
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Publishes the <see cref="ShowStatus">ShowStatus</see> during the viewmodel initialization.
|
||||
/// </summary>
|
||||
/// <param name="parameter">The parameter to be used initialize viewmodel.</param>
|
||||
public virtual async Task InitializeAsync(object parameter)
|
||||
{
|
||||
await Dispatcher.CurrentDispatcher.InvokeAsync(() =>
|
||||
{
|
||||
Aggregator.GetEvent<ShowStatus>()
|
||||
.Publish(new StatusInfo(StatusInfo.StatusState.Busy, Strings.Strings.Loading));
|
||||
});
|
||||
}
|
||||
|
||||
#endregion Bases Methods
|
||||
|
||||
public new event PropertyChangedEventHandler PropertyChanged;
|
||||
public bool IsMenuIncluded { get; set; }
|
||||
public bool IsNavigationIncluded { get; set; }
|
||||
public int Percentage { get; set; }
|
||||
public string IsBusyMessage { get; set; }
|
||||
public bool IsBusy { get; set; }
|
||||
|
||||
|
||||
public bool IsDirty { get; set; }
|
||||
/// <summary>
|
||||
/// Sets the Model to null.
|
||||
/// </summary>
|
||||
public virtual void Cleanup()
|
||||
{
|
||||
Model = default(TModel);
|
||||
}
|
||||
|
||||
public Task CleanupAsync()
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
|
||||
namespace DTS.Common.RibbonControl
|
||||
{
|
||||
public class ApplicationSplitMenuItemData : SplitMenuItemData
|
||||
{
|
||||
public ApplicationSplitMenuItemData()
|
||||
: this(false)
|
||||
{
|
||||
}
|
||||
|
||||
public ApplicationSplitMenuItemData(bool isApplicationMenu)
|
||||
: base(isApplicationMenu)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using DTS.Common.Interface;
|
||||
// ReSharper disable CheckNamespace
|
||||
|
||||
namespace DTS.Common.Classes.Viewer.TestMetadata
|
||||
{
|
||||
public class TestModule : ITestModule
|
||||
{
|
||||
public string SerialNumber { get; set; }
|
||||
public string BaseSerialNumber { get; set; }
|
||||
public int AaFilterRateHz { get; set; }
|
||||
public int Number { get; set; }
|
||||
public int NumberOfSamples { get; set; }
|
||||
public int UnsubsampledNumberOfSamples { get; set; }
|
||||
public double RequestedPostTriggerSeconds { get; set; }
|
||||
public double RequestedPreTriggerSeconds { get; set; }
|
||||
public double PostTriggerSeconds { get; set; }
|
||||
public double PreTriggerSeconds { get; set; }
|
||||
public string RecordingMode { get; set; }
|
||||
public int SampleRateHz { get; set; }
|
||||
public int StartRecordSampleNumber { get; set; }
|
||||
public int NumberOfChannels { get; set; }
|
||||
public bool InlineSerializedData { get; set; }
|
||||
public int StartRecordTimestampSec { get; set; }
|
||||
public int StartRecordTimestampNanoSec { get; set; }
|
||||
public int TriggerTimestampSec { get; set; }
|
||||
public int TriggerTimestampNanoSec { get; set; }
|
||||
public List<ulong> TriggerSampleNumbers { get; set; }
|
||||
public bool PTPMasterSync { get; set; }
|
||||
public int TiltSensorAxisXDegreesPre { get; set; }
|
||||
public int TiltSensorAxisYDegreesPre { get; set; }
|
||||
public int TiltSensorAxisZDegreesPre { get; set; }
|
||||
public int TiltSensorAxisXDegreesPost { get; set; }
|
||||
public int TiltSensorAxisYDegreesPost { get; set; }
|
||||
public int TiltSensorAxisZDegreesPost { get; set; }
|
||||
public int TemperatureLocation1Pre { get; set; }
|
||||
public int TemperatureLocation2Pre { get; set; }
|
||||
public int TemperatureLocation3Pre { get; set; }
|
||||
public int TemperatureLocation4Pre { get; set; }
|
||||
public int TemperatureLocation1Post { get; set; }
|
||||
public int TemperatureLocation2Post { get; set; }
|
||||
public int TemperatureLocation3Post { get; set; }
|
||||
public int TemperatureLocation4Post { get; set; }
|
||||
public List<ITestChannel> Channels { get; set; }
|
||||
public List<ITestChannel> CalculatedChannels { get; set; }
|
||||
public bool IsSelected { get; set; }
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using System.ComponentModel;
|
||||
using DTS.Common.Base.Classes;
|
||||
using DTS.Common.Converters;
|
||||
|
||||
namespace DTS.Common.Enums
|
||||
{
|
||||
[TypeConverter(typeof(EnumDescriptionTypeConverter))]
|
||||
public enum SquibMeasurementType
|
||||
{
|
||||
NONE = 0, //the squib's measurement mode has not been set
|
||||
CURRENT = 1 << 0, //the squib's current will be recorded
|
||||
INIT_SIGNAL = 1 << 1, //the squib's initiation indicator will be recorded
|
||||
VOLTAGE = 1 << 2, //the squib's voltage will be recorded
|
||||
}
|
||||
[TypeConverter(typeof(EnumDescriptionTypeConverter))]
|
||||
public enum SquibFireMode
|
||||
{
|
||||
NONE = 1 << 0, //squib's fire mode not set
|
||||
[DescriptionResource("SquibFireMode_Cap")]
|
||||
CAP = 1 << 1, //use capacitor discharge
|
||||
[DescriptionResource("SquibFireMode_CC")]
|
||||
CONSTANT = 1 << 2, //use constant current discharge
|
||||
AC = 1 << 3 //use AC discharge
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user