This commit is contained in:
2026-04-17 14:55:32 -04:00
commit bc3ac1d4c9
18017 changed files with 4371742 additions and 0 deletions

View File

@@ -0,0 +1,112 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{4733690A-CB08-4C2E-853A-9339BE13AC28}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DTS.Viewer.ViewerSettings</RootNamespace>
<AssemblyName>DTS.Viewer.ViewerSettings</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<PlatformTarget>x64</PlatformTarget>
<OutputPath>bin\x64\Debug\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<PlatformTarget>x64</PlatformTarget>
<OutputPath>bin\x64\Release\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<PlatformTarget>x86</PlatformTarget>
<OutputPath>bin\x86\Debug\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<PlatformTarget>x86</PlatformTarget>
<OutputPath>bin\x86\Release\</OutputPath>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.Xaml.Behaviors">
<HintPath>..\..\..\Common\DTS.Common\lib\PrismLibrary\Microsoft.Xaml.Behaviors.dll</HintPath>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="Prism">
<HintPath>..\..\..\Common\DTS.Common\lib\PrismLibrary\Prism.dll</HintPath>
</Reference>
<Reference Include="Prism.Unity.Wpf">
<HintPath>..\..\..\Common\DTS.Common\lib\PrismLibrary\Prism.Unity.Wpf.dll</HintPath>
</Reference>
<Reference Include="Prism.Wpf">
<HintPath>..\..\..\Common\DTS.Common\lib\PrismLibrary\Prism.Wpf.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Core" />
<Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\Common\DTS.Common\lib\System.Windows.Interactivity.dll</HintPath>
</Reference>
<Reference Include="System.Xaml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="Unity.Abstractions">
<HintPath>..\..\..\Common\DTS.Common\lib\PrismLibrary\Unity.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Unity.Container">
<HintPath>..\..\..\Common\DTS.Common\lib\PrismLibrary\Unity.Container.dll</HintPath>
</Reference>
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="Resources\StringResources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>StringResources.resx</DependentUpon>
</Compile>
<Compile Include="Resources\TranslateExtension.cs" />
<Compile Include="ViewerSettingsModule.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ViewModel\ViewerSettingsViewModel.cs" />
<Compile Include="View\ViewerSettingsView.xaml.cs">
<DependentUpon>ViewerSettingsView.xaml</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resources\StringResources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>StringResources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Common\DTS.Common.Core\DTS.Common.Core.csproj">
<Project>{fab1f470-1574-4301-b56e-d3364aa93679}</Project>
<Name>DTS.Common.Core</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\Common\DTS.Common\DTS.Common.csproj">
<Project>{f7a0804f-61a4-40ae-83d0-f1137622b592}</Project>
<Name>DTS.Common</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Page Include="View\ViewerSettingsView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("DTS.Viewer.ViewerSettings")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DTS.Viewer.ViewerSettings")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("4733690a-cb08-4c2e-853a-9339be13ac28")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,99 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace DTS.Viewer.ViewerSettings.Resources {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class StringResources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal StringResources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DTS.Viewer.ViewerSettings.Resources.StringResources", typeof(StringResources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized string similar to Use the linear sensitivity, if available.
/// </summary>
internal static string CalibrationBehavior_LinearIfAvailable {
get {
return ResourceManager.GetString("CalibrationBehavior_LinearIfAvailable", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Use the non-linear sensitivity, if available.
/// </summary>
internal static string CalibrationBehavior_NonLinearIfAvailable {
get {
return ResourceManager.GetString("CalibrationBehavior_NonLinearIfAvailable", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Use both sensitivities, if available, as separate channels.
/// </summary>
internal static string CalibrationBehavior_UseBothIfAvailable {
get {
return ResourceManager.GetString("CalibrationBehavior_UseBothIfAvailable", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Calibration Behavior.
/// </summary>
internal static string CalibrationBehaviorText {
get {
return ResourceManager.GetString("CalibrationBehaviorText", resourceCulture);
}
}
}
}

View File

@@ -0,0 +1,132 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="CalibrationBehaviorText" xml:space="preserve">
<value>Calibration Behavior</value>
</data>
<data name="CalibrationBehavior_LinearIfAvailable" xml:space="preserve">
<value>Use the linear sensitivity, if available</value>
</data>
<data name="CalibrationBehavior_NonLinearIfAvailable" xml:space="preserve">
<value>Use the non-linear sensitivity, if available</value>
</data>
<data name="CalibrationBehavior_UseBothIfAvailable" xml:space="preserve">
<value>Use both sensitivities, if available, as separate channels</value>
</data>
</root>

View File

@@ -0,0 +1,21 @@
using System;
using System.Windows.Markup;
using DTS.Viewer.ViewerSettings.Resources;
namespace DTS.Viewer.ViewerSettings
{
[MarkupExtensionReturnType(typeof(string))]
public class TranslateExtension : MarkupExtension
{
private readonly string _key;
public TranslateExtension(string key) { _key = key; }
private const string NotFound = "#stringnotfound#";
public override object ProvideValue(IServiceProvider serviceProvider)
{
if (string.IsNullOrEmpty(_key)) { return NotFound; }
return StringResources.ResourceManager.GetString(_key) ?? NotFound + " " + _key;
}
}
}

View File

@@ -0,0 +1,44 @@
<base:BaseView x:Class="DTS.Viewer.ViewerSettings.ViewerSettingsView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:base="clr-namespace:DTS.Common.Base;assembly=DTS.Common"
xmlns:prism="http://prismlibrary.com/"
xmlns:classes="clr-namespace:DTS.Common.Classes;assembly=DTS.Common"
xmlns:strings="clr-namespace:DTS.Viewer.ViewerSettings"
HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<base:BaseView.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/DTS.Common;component/Themes/CommonStyles.xaml" />
</ResourceDictionary.MergedDictionaries>
<Style TargetType="Button" BasedOn="{StaticResource PageContentButton}">
<Setter Property="FontSize" Value="10" />
<Setter Property="Margin" Value="3,3" />
</Style>
<Style TargetType="TextBox" BasedOn="{StaticResource PageContentTextBoxStyle}">
<Setter Property="HorizontalAlignment" Value="Stretch" />
</Style>
<Style TargetType="TextBlock" BasedOn="{StaticResource PageContentTextStyle}">
<Setter Property="HorizontalAlignment" Value="Stretch" />
</Style>
</ResourceDictionary>
</base:BaseView.Resources>
<Grid x:Name="SettingsRegion" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0" Text="{strings:TranslateExtension CalibrationBehaviorText}" Visibility="{Binding CalibrationBehaviorSettingVisibility}"/>
<ComboBox Grid.Row="0" Grid.Column="1" Visibility="{Binding CalibrationBehaviorSettingVisibility}"
ItemsSource="{Binding AvailableCalibrationBehaviors}"
SelectedItem="{Binding CalibrationBehaviorSetting, Mode=TwoWay}" />
</Grid>
</base:BaseView>

View File

@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using DTS.Common.Interface;
namespace DTS.Viewer.ViewerSettings
{
/// <summary>
/// Interaction logic for ViewerSettingsView.xaml
/// </summary>
public partial class ViewerSettingsView : IViewerSettingsView
{
public ViewerSettingsView()
{
InitializeComponent();
}
}
}

View File

@@ -0,0 +1,184 @@
using System;
using System.ComponentModel;
using System.Threading.Tasks;
using System.Windows;
using DTS.Common.Base;
using DTS.Common.Classes.Sensors;
using DTS.Common.Enums.Sensors;
using DTS.Common.Events;
using DTS.Common.Interactivity;
using DTS.Common.Interface;
using Prism.Events;
using Prism.Regions;
using Unity;
namespace DTS.Viewer.ViewerSettings
{
public class ViewerSettingsViewModel : BaseViewModel<IViewerSettingsViewModel>, IViewerSettingsViewModel
{
public IViewerSettingsView View { get; set; }
public IBaseViewModel Parent { get; set; }
private IEventAggregator _eventAggregator { get; set; }
private IUnityContainer _unityContainer { get; set; }
public InteractionRequest<Notification> NotificationRequest { get; private set; }
public new InteractionRequest<Confirmation> ConfirmationRequest { get; private set; }
/// <summary>
/// Creates a new instance of the TestSummaryViewListModel.
/// </summary>
/// <param name="view">The TestSummaryList View interface.</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 ViewerSettingsViewModel(IViewerSettingsView 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;
}
#region Methods
public override void Initialize() { }
public override void Initialize(object parameter)
{
Parent = (IBaseViewModel)parameter;
Subscribe();
}
private void Subscribe()
{
//event aggregator subscriptions
_eventAggregator.GetEvent<CalibrationBehaviorSettingChangedEvent>().Subscribe(OnCalibrationBehaviorSettingChanged);
_eventAggregator.GetEvent<CalibrationBehaviorSettableInViewerChangedEvent>().Subscribe(OnCalibrationBehaviorSettableInViewerChanged);
}
private void OnCalibrationBehaviorSettableInViewerChanged(bool settable)
{
CalibrationBehaviorSettingVisibility = settable ? Visibility.Visible : Visibility.Collapsed;
}
private void OnCalibrationBehaviorSettingChanged(CalibrationBehaviors cb)
{
_calibrationBehaviorSetting = cb;
OnPropertyChanged("CalibrationBehaviorSetting");
}
public void PublishChanges()
{
}
#endregion
#region Properties
///<summary>
///Occurs when a property value changes.
///</summary>
public new event PropertyChangedEventHandler PropertyChanged;
private new void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
if (propertyName.EndsWith("Visibility") && propertyName != "OverallSettingsVisibility")
{
OnPropertyChanged("OverallSettingsVisibility");
}
}
/// <summary>
/// Gets the HeaderInfo.
/// </summary>
public string HeaderInfo => "SettingsRegion";
private bool _isBusy = false;
public new bool IsBusy
{
get => _isBusy;
set { _isBusy = value; OnPropertyChanged("IsBusy"); }
}
private bool _isDirty;
public new bool IsDirty
{
get => _isDirty;
set => _isDirty = value;
}
private bool _isNavigationIncluded;
public new bool IsNavigationIncluded
{
get => _isNavigationIncluded;
set => _isNavigationIncluded = value;
}
private Visibility _calibrationBehaviorSettingVisibility = Visibility.Visible;
public Visibility CalibrationBehaviorSettingVisibility
{
get => _calibrationBehaviorSettingVisibility;
set
{
_calibrationBehaviorSettingVisibility = value;
OnPropertyChanged("CalibrationBehaviorSettingVisibility");
_eventAggregator.GetEvent<ViewerSettingsVisibilityChangedEvent>().Publish(OverallSettingsVisibility);
}
}
public Visibility OverallSettingsVisibility => (CalibrationBehaviorSettingVisibility == Visibility.Visible) ? Visibility.Visible : Visibility.Collapsed;
#endregion
private DisplayedCalibrationBehavior[] _availableCalibrationBehaviors = null;
private readonly DisplayedCalibrationBehavior _linearIfAvail = new DisplayedCalibrationBehavior { CalibrationBehavior = CalibrationBehaviors.LinearIfAvailable, DisplayString = Resources.StringResources.CalibrationBehavior_LinearIfAvailable };
private readonly DisplayedCalibrationBehavior _nonLinearIfAvail = new DisplayedCalibrationBehavior { CalibrationBehavior = CalibrationBehaviors.NonLinearIfAvailable, DisplayString = Resources.StringResources.CalibrationBehavior_NonLinearIfAvailable };
private readonly DisplayedCalibrationBehavior _useBothIfAvail = new DisplayedCalibrationBehavior { CalibrationBehavior = CalibrationBehaviors.UseBothIfAvailable, DisplayString = Resources.StringResources.CalibrationBehavior_UseBothIfAvailable };
private readonly object MyLock = new object();
public DisplayedCalibrationBehavior[] AvailableCalibrationBehaviors
{
get
{
lock (MyLock)
{
if (null == _availableCalibrationBehaviors)
{
_availableCalibrationBehaviors = new[] { _linearIfAvail, _nonLinearIfAvail, _useBothIfAvail };
}
return _availableCalibrationBehaviors;
}
}
}
private CalibrationBehaviors _calibrationBehaviorSetting = CalibrationBehaviors.NonLinearIfAvailable;
public DisplayedCalibrationBehavior CalibrationBehaviorSetting
{
get
{
foreach (DisplayedCalibrationBehavior dcb in AvailableCalibrationBehaviors)
{
if (dcb.CalibrationBehavior == _calibrationBehaviorSetting)
{
return dcb;
}
}
return null;
}
set
{
if (value.CalibrationBehavior != _calibrationBehaviorSetting)
{
_calibrationBehaviorSetting = value.CalibrationBehavior;
_eventAggregator.GetEvent<CalibrationBehaviorSettingChangedEvent>().Publish(value.CalibrationBehavior);
}
OnPropertyChanged("CalibrationBehaviorSetting");
}
}
}
}

View File

@@ -0,0 +1,140 @@
using System;
using System.Windows.Media.Imaging;
using DTS.Common;
using DTS.Common.Interface;
using DTS.Viewer.ViewerSettings;
using Prism.Ioc;
using Prism.Modularity;
using Unity;
// ReSharper disable RedundantAttributeUsageProperty
// ReSharper disable UnusedParameter.Local
[assembly: ViewerSettingsModuleName()]
[assembly: ViewerSettingsModuleImageAttribute()]
namespace DTS.Viewer.ViewerSettings
{
public class ViewerSettingsModule : IModule
{
/// <summary>
/// Injected unity container
/// </summary>
private readonly IUnityContainer _unityContainer;
/// <summary>
/// Initializes a new instance of the <see cref="ViewerSettingsModule"/> class.
/// </summary>
/// <param name="unityContainer">Obtained reference of the unity container by using dependency injection.</param>
public ViewerSettingsModule(IUnityContainer unityContainer)
{
_unityContainer = unityContainer;
}
public void Initialize()
{
// Register View & View-Model with Unity dependency injection container as a singleton.
_unityContainer.RegisterType<IViewerSettingsView, ViewerSettingsView>();
_unityContainer.RegisterType<IViewerSettingsViewModel, ViewerSettingsViewModel>();
//_unityContainer.RegisterType<IViewerSettingsModel, ViewerSettingsModel>();
}
public void OnInitialized(IContainerProvider containerProvider)
{
}
public void RegisterTypes(IContainerRegistry containerRegistry)
{
Initialize();
}
}
/// <summary>
/// Attribute class contains assembly name
/// </summary>
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)]
public class ViewerSettingsModuleNameAttribute : TextAttribute
{
public ViewerSettingsModuleNameAttribute() : this(null) { }
public ViewerSettingsModuleNameAttribute(string s)
{
AssemblyName = AssemblyNames.ViewerSettings.ToString();
}
public override string AssemblyName { get; }
public override Type GetAttributeType()
{
return typeof(TextAttribute);
}
public override string GetAssemblyName()
{
return AssemblyName;
}
}
/// <summary>
/// Attribute class contains assembly image and name - used on the Main screen to ViewerSettings available components
/// </summary>
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)]
public class ViewerSettingsModuleImageAttribute : ImageAttribute
{
private BitmapImage _img;
public ViewerSettingsModuleImageAttribute() : this(null) { }
public override BitmapImage AssemblyImage
{
get { _img = AssemblyInfo.GetImage(AssemblyNames.ViewerSettings.ToString()); return _img; }
}
public ViewerSettingsModuleImageAttribute(string s)
{
_img = AssemblyInfo.GetImage(AssemblyNames.ViewerSettings.ToString());
}
public override Type GetAttributeType()
{
return typeof(ImageAttribute);
}
public override BitmapImage GetAssemblyImage()
{
return AssemblyImage;
}
private string _name;
public override string AssemblyName
{
get { _name = AssemblyNames.ViewerSettings.ToString(); return _name; }
}
public override string GetAssemblyName()
{
return AssemblyName;
}
private string _group;
public override string AssemblyGroup
{
get { _group = eAssemblyGroups.Viewer.ToString(); return _group; }
}
public override string GetAssemblyGroup()
{
return AssemblyGroup;
}
private eAssemblyRegion _region;
public override eAssemblyRegion AssemblyRegion
{
get { _region = eAssemblyRegion.ViewerSettingsRegion; return _region; }
}
public override eAssemblyRegion GetAssemblyRegion()
{
return AssemblyRegion;
}
}
}

View File

@@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.8", FrameworkDisplayName = "")]

View File

@@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]