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,21 @@
using DTS.Common.Base;
// ReSharper disable CheckNamespace
namespace DTS.Common.Interface
{
public interface ITestModificationViewModel : IBaseViewModel
{
ITestModificationView View { get; set; }
IBaseViewModel Parent { get; set; }
void PublishChanges();
// controls whether isocode should be modified when software filter is modified
bool UseISOCodeFilterMapping { get; set; }
// controls whether 0 or P is used when isocode is modified because a software filter was modified
bool UseZeroForUnfiltered { get; set; }
/// <summary>
/// Update the sensor calibration in the database
/// http://manuscript.dts.local/f/cases/43615/SW-Feature-Request-UART-Channel-Diagnostics-GPS-NMEA-1PPS
/// </summary>
void UpdateDatabaseMethod();
}
}

View File

@@ -0,0 +1,54 @@
using System.Collections.Specialized;
using System.Windows;
using System.Windows.Controls;
using Prism.Regions;
namespace DTS.Common
{
public class StackPanelRegionAdapter : RegionAdapterBase<StackPanel>
{
public StackPanelRegionAdapter(IRegionBehaviorFactory regionBehaviorFactory)
: base(regionBehaviorFactory)
{
}
protected override void Adapt(IRegion region, StackPanel regionTarget)
{
if (region == null) return;
region.Views.CollectionChanged += (sender, e) =>
{
switch (e.Action)
{
case NotifyCollectionChangedAction.Add:
foreach (UIElement element in e.NewItems)
{
regionTarget.Children.Add(element);
}
break;
case NotifyCollectionChangedAction.Remove:
foreach (UIElement elementLoopVariable in e.OldItems)
{
var element = elementLoopVariable;
if (regionTarget.Children.Contains(element))
{
regionTarget.Children.Remove(element);
}
}
break;
}
};
}
protected override IRegion CreateRegion()
{
return new AllActiveRegion();
}
}
}

View File

@@ -0,0 +1,82 @@
using DTS.Common.Enums;
using DTS.Common.Enums.Sensors;
using DTS.Common.Interface.DASFactory.Diagnostics;
namespace DTS.Common.Interface.DataRecorders
{
public interface IHardwareChannel
{
/// <summary>
/// diagnostic results for this channel if available (null otherwise)
/// </summary>
IDiagnosticResult Diagnostics { get; }
/// <summary>
/// returns whether the channel supports the given bridge type
/// </summary>
/// <param name="bridgeType"></param>
/// <returns></returns>
bool IsSupportedBridgeType(SensorConstants.BridgeType bridgeType);
int ChannelNumber { get; }
string GetId();
/// <summary>
/// returns true if the channel supports analog sensors
/// </summary>
bool IsAnalog { get; }
/// <summary>
/// returns true if chanel supports squibs
/// </summary>
bool IsSquib { get; }
/// <summary>
/// returns true if the channel supports digital outputs
/// </summary>
bool IsDigitalOut { get; }
/// <summary>
/// returns true if the channel supports digital inputs
/// </summary>
bool IsDigitalIn { get; }
/// <summary>
/// returns true if the channel supports uart i/o
/// </summary>
bool IsUart { get; }
/// <summary>
/// returns true if the channel supports stream input
/// </summary>
bool IsStreamIn { get; }
/// <summary>
/// returns true if the channel supports stream output
/// </summary>
bool IsStreamOut { get; }
/// <summary>
/// Returns true if the channel supports thermocoupler
/// </summary>
bool IsThermocoupler { get; }
bool IsCan { get; }
/// <summary>
/// returns true if the channel supports clocks
/// </summary>
bool IsClock { get; }
bool IsTSRAIR { get; }
bool IsSLICETC { get; }
bool IsTSRAIRModule { get; }
/// <summary>
/// returns the DAS this channel belongs to
/// </summary>
/// <returns></returns>
IDASHardware GetParentDAS();
/// <summary>
/// returns the module serial number this channel belongs to
/// </summary>
string ModuleSerialNumber { get; set; }
/// <summary>
/// returns whether or not a given excitation is supported by the hardware channel
/// </summary>
bool IsSupportedExcitation(ExcitationVoltageOptions.ExcitationVoltageOption excitation);
/// <summary>
/// returns true if the serial number starts with "5M"
/// </summary>
/// <returns></returns>
bool IsG5();
string ToString(IDASHardware[] hardwares);
}
}

View File

@@ -0,0 +1,445 @@
using System;
using System.Linq;
using System.Windows.Media;
using DTS.Common.Base;
using DTS.Common.Enums.Sensors;
using DTS.Common.Interface;
// ReSharper disable CheckNamespace
// ReSharper disable RedundantDefaultMemberInitializer
// ReSharper disable RedundantCast
namespace DTS.Common.Classes.Viewer.TestMetadata
{
[Serializable]
public class TestChannel : BasePropertyChanged, ITestChannel
{
public string Group { get; set; }
public string SubGroup { get; set; }
private bool _isGraphChannel = false;
public bool IsGraphChannel { get => _isGraphChannel; set { _isGraphChannel = value; OnPropertyChanged("IsGraphChannel"); } }
public string GraphName { get; set; }
public string TestId { get; set; }
public string TestSetupName { get; set; }
public string ModuleSerialNumber { get; set; }
public string SerialNumber { get; set; }
public string ChannelId { get; set; }
private string _channelDisplayName = string.Empty;
public string ChannelDisplayName
{
get => _channelDisplayName;
set => SetProperty(ref _channelDisplayName, value, "ChannelDisplayName");
}
public string Description { get; set; }
public string IsoCode { get; set; }
public string IsoChannelName { get; set; }
public string UserCode { get; set; }
public string UserChannelName { get; set; }
public string ChannelGroupName { get; set; }
public string ChannelType { get; set; }
private bool _isCalculatedChannel = false;
public bool IsCalculatedChannel
{
get => _isCalculatedChannel;
set => SetProperty(ref _isCalculatedChannel, value, "IsCalculatedChannel");
}
public int Number { get; set; }
public string DigitalMultiplier { get; set; }
public string DigitalMode { get; set; }
public DateTime Start { get; set; }
public string Bridge { get; set; }
public double BridgeResistanceOhms { get; set; }
public double ZeroPoint { get; set; }
private string _channelDescriptionString;
public ulong T1Sample { get; set; } = 0;
public ulong T2Sample { get; set; } = 0;
public double HIC { get; set; } = 0D;
public bool UseEUScaler { get; set; }
public double ScaleFactorEU { get; set; } = 0D;
public string ChannelDescriptionString
{
get => _channelDescriptionString;
set => SetProperty(ref _channelDescriptionString, value, "ChannelDescriptionString");
}
public void SetChannelDescriptionAndDisplayName(string channelDescription)
{
ChannelDescriptionString = channelDescription;
ChannelDisplayName = $"{ChannelName2} {ChannelDescriptionString}";
}
public string ChannelName2 { get; set; }
public string HardwareChannelName { get; set; }
public double DesiredRange { get; set; }
public double ActualMaxRangeEu { get; set; }
public double ActualMinRangeEu { get; set; }
public double ActualMaxRangeAdc => short.MaxValue;
public double ActualMinRangeAdc => short.MinValue;
public double ActualMaxRangeMv { get; set; }
public double ActualMinRangeMv { get; set; }
public double Sensitivity { get; set; }
public string SoftwareFilter { get; set; }
public bool ProportionalToExcitation { get; set; }
public bool IsInverted { get; set; }
public string LinearizationFormula { get; set; }
public bool IsSubsampled { get; set; }
public int AbsoluteDisplayOrder { get; set; }
public DateTime LastCalibrationDate { get; set; }
public string SensorId { get; set; }
public int OffsetToleranceLowMv { get; set; }
public int OffsetToleranceHighMv { get; set; }
public int DataFlag { get; set; }
public string ExcitationVoltage { get; set; }
public string Eu { get; set; }
public bool CalSignalEnabled { get; set; }
public bool ShuntEnabled { get; set; }
public bool VoltageInsertionCheckEnabled { get; set; }
public bool RemoveOffset { get; set; }
public string ZeroMethod { get; set; }
public double ZeroAverageWindowBegin { get; set; }
public double ZeroAverageWindowEnd { get; set; }
public int InitialEu { get; set; }
public string InitialOffset { get; set; }
public int UnsubsampledSampleRateHz { get; set; }
public double MeasuredShuntDeflectionMv { get; set; }
public double TargetShuntDeflectionMv { get; set; }
public double MeasuredExcitationVoltage { get; set; }
public double FactoryExcitationVoltage { get; set; }
public double TimeOfFirstSample { get; set; }
public double Multiplier { get; set; }
public double UserOffsetEu { get; set; }
public int UnitConversion { get; set; }
public bool AtCapacity { get; set; }
public int CapacityOutputIsBasedOn { get; set; }
public string SourceChannelNumber { get; set; }
public string SourceModuleNumber { get; set; }
public string SourceModuleSerialNumber { get; set; }
public string Calculation { get; set; }
public int SampleRateHz { get; set; }
public string SensitivityUnits { get; set; }
public int SensorCapacity { get; set; }
public string SensorPolarity { get; set; }
public int ChannelNumber { get; set; }
public string BinaryFileName { get; set; }
public string BinaryFilePath { get; set; }
public double Xmax { get; set; }
public double Xmin { get; set; }
public int SequentialNumbers { get; set; }
public ITestSetupMetadata ParentTestSetup { get; set; }
public ITestModule ParentModule { get; set; }
public IBaseViewModel Parent { get; set; }
private Color _channelColor = Colors.Transparent;
public Color ChannelColor
{
get => _channelColor;
set => SetProperty(ref _channelColor, value, "ChannelColor");
}
private string _errorMessage = string.Empty;
public string ErrorMessage
{
get => _errorMessage;
set
{
_errorMessage = value;
_isError = !string.IsNullOrEmpty(_errorMessage);
OnPropertyChanged("ErrorMessage");
}
}
private bool _isError = false;
public bool IsError
{
get => _isError;
set => SetProperty(ref _isError, value, "IsError");
}
private Color? _errorColor = Colors.Black;
public Color? ErrorColor
{
get { _errorColor = _isError ? Colors.Red : Colors.Black; return _errorColor; }
set => SetProperty(ref _errorColor, value, "ErrorColor");
}
private bool _isLocked = false;
public bool IsLocked
{
get => _isLocked;
set
{
_isLocked = value;
if (!_isLocked && !_isSelected && !_isGraphChannel) { ChannelColor = Colors.Transparent; }
if (CanSelectChannel)
{
var parent = Parent;
if (parent.GetType().GetInterfaces().Contains(typeof(IGraphMainViewModel))) { ((IGraphMainViewModel)parent).AddLockedChannel(this, _isLocked); }
}
OnPropertyChanged("IsLocked");
}
}
private bool _bCanLock = true;
public bool CanLock
{
get => _bCanLock;
set => SetProperty(ref _bCanLock, !IsError && value, "CanLock");
}
private bool _canSelectChannel = true;
public bool CanSelectChannel
{
get => _canSelectChannel;
set => SetProperty(ref _canSelectChannel, !IsError && value, "CanSelectChannel");
}
private bool _isExpanded = true;
public bool IsExpanded
{
get => _isExpanded;
set => SetProperty(ref _isExpanded, value, "IsExpanded");
}
private bool _isSelected = false;
public bool IsSelected
{
get => _isSelected;
set
{
var parent = Parent;
_isSelected = value;
if (!_isLocked && !_isSelected && !_isGraphChannel) { ChannelColor = Colors.Transparent; }
if (_isSelected && CanSelectChannel)
{
if (parent.GetType().GetInterfaces().Contains(typeof(IGraphMainViewModel))) { ((IGraphMainViewModel)parent).AddSelectedChannel(this); }
OnPropertyChanged("IsSelected");
}
}
}
public ITestChannel Copy() { return (TestChannel)MemberwiseClone(); }
public override string ToString()
{
if (SensorConstants.IsTestSpecificEmbedded(ChannelDescriptionString) && !string.IsNullOrWhiteSpace(ChannelName2)) { return ChannelName2; }
return ChannelDescriptionString;
}
private double _minADC = double.NaN;
/// <summary>
/// Min value of ADC for entire dataset
/// </summary>
public double MinADC
{
get => _minADC;
set => SetProperty(ref _minADC, value, "MinADC");
}
private double _maxADC = double.NaN;
/// <summary>
/// Max value in ADC for entire dataset
/// </summary>
public double MaxADC
{
get => _maxADC;
set => SetProperty(ref _maxADC, value, "MaxADC");
}
private double _aveADC = double.NaN;
/// <summary>
/// Average value in ADC for entire dataset
/// </summary>
public double AveADC
{
get => _aveADC;
set => SetProperty(ref _aveADC, value, "AveADC");
}
private double _stdDevADC = double.NaN;
/// <summary>
/// STD DEV in ADC for entire dataset
/// </summary>
public double StdDevADC
{
get => _stdDevADC;
set => SetProperty(ref _stdDevADC, value, "StdDevADC");
}
private double _t0ADC = double.NaN;
/// <summary>
/// Value @ T0 in ADC
/// </summary>
public double T0ADC
{
get => _t0ADC;
set => SetProperty(ref _t0ADC, value, "T0ADC");
}
private double _minMV = double.NaN;
/// <summary>
/// Minimum value in mV for entire dataset
/// </summary>
public double MinMV
{
get => _minMV;
set => SetProperty(ref _minMV, value, "MinMV");
}
private double _maxMV = double.NaN;
/// <summary>
/// Maximum value in mV for entire dataset
/// </summary>
public double MaxMV
{
get => _maxMV;
set => SetProperty(ref _maxMV, value, "MaxMV");
}
private double _aveMV = double.NaN;
/// <summary>
/// average value in mV for entire dataset
/// </summary>
public double AveMV
{
get => _aveMV;
set => SetProperty(ref _aveMV, value, "AveMV");
}
private double _stdDevMV = double.NaN;
/// <summary>
/// std dev in mV for entire dataset
/// </summary>
public double StdDevMV
{
get => _stdDevMV;
set => SetProperty(ref _stdDevMV, value, "StdDevMV");
}
private double _t0MV = double.NaN;
/// <summary>
/// value in mV at T0
/// </summary>
public double T0MV
{
get => _t0MV;
set => SetProperty(ref _t0MV, value, "T0MV");
}
private double _minEU = double.NaN;
/// <summary>
/// minimum value in EU for entire dataset
/// </summary>
public double MinEU
{
get => _minEU;
set => SetProperty(ref _minEU, value, "MinEU");
}
private double _maxEU = double.NaN;
/// <summary>
/// maximum value in EU for entire dataset
/// </summary>
public double MaxEU
{
get => _maxEU;
set => SetProperty(ref _maxEU, value, "MaxEU");
}
private double _aveEU = double.NaN;
/// <summary>
/// average value in EU for entire dataset
/// </summary>
public double AveEU
{
get => _aveEU;
set => SetProperty(ref _aveEU, value, "AveEU");
}
private double _stdDevEU = double.NaN;
/// <summary>
/// std dev in EU
/// </summary>
public double StdDevEU
{
get => _stdDevEU;
set => SetProperty(ref _stdDevEU, value, "StdDevEU");
}
private double _t0EU = double.NaN;
/// <summary>
/// value at T0 in EU
/// </summary>
public double T0EU
{
get => _t0EU;
set => SetProperty(ref _t0EU, value, "T0EU");
}
private double _minY = double.NaN;
/// <summary>
/// minimum value for whatever current units are for entire dataset
/// </summary>
public double MinY
{
get => _minY;
set => SetProperty(ref _minY, value, "MinY");
}
private double _maxY = double.NaN;
/// <summary>
/// maximum value for whatever current units are for entire dataset
/// </summary>
public double MaxY
{
get => _maxY;
set => SetProperty(ref _maxY, value, "MaxY");
}
private double _aveY = double.NaN;
/// <summary>
/// average value for whatever current units are for entire dataset
/// </summary>
public double AveY
{
get => _aveY;
set => SetProperty(ref _aveY, value, "AveY");
}
private double _stdDevY = double.NaN;
/// <summary>
/// std deviation for whatever current units are
/// </summary>
public double StdDevY
{
get => _stdDevY;
set => SetProperty(ref _stdDevY, value, "StdDevY");
}
private double _T0Value = double.NaN;
/// <summary>
/// Value at T0 in whatever current units are
/// </summary>
public double T0Value
{
get => _T0Value;
set => SetProperty(ref _T0Value, value, "T0Value");
}
private string _setupEID = string.Empty;
/// <summary>
/// EID channel was originally set up with
/// </summary>
public string SetupEID
{
get => _setupEID;
set => SetProperty(ref _setupEID, value, "SetupEID");
}
private string _dataCollectionEID = string.Empty;
/// <summary>
/// EID present on channel when data was collected
/// </summary>
public string DataCollectionEID
{
get => _dataCollectionEID;
set => SetProperty(ref _dataCollectionEID, value, "DataCollectionEID");
}
}
}

View File

@@ -0,0 +1,248 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using DTS.Common.Utilities.Logging;
namespace DTS.Common.Classes
{
public abstract class TagAwareBase : Base.BasePropertyChanged
{
public enum TagTypes
{
User,
Group,
Template,
TestSetup,
Sensors,
SensorModels
}
public abstract TagTypes TagType { get; }
#region Tags
public byte[] TagsBlobBytes
{
get
{
var result = new byte[TagIDs.Length * sizeof(int)];
Buffer.BlockCopy(TagIDs, 0, result, 0, result.Length);
return result;
}
set
{
if (value.Length < sizeof(int)) return;
var tagsBlob = new int[value.Length / sizeof(int)];
try
{
Buffer.BlockCopy(value, 0, tagsBlob, 0, value.Length);
TagIDs = tagsBlob;
}
catch (Exception ex)
{
APILogger.Log(ex);
}
}
}
private int[] _tagIDs = new int[0];
public int[] TagIDs
{
get => _tagIDs;
set => _tagIDs = value ?? new int[0];
}
public void SetTagsFromCommaSeparatedString(string tagText, Tags.GetSqlCommandDelegate getSqlCommand)
{
//if (string.IsNullOrEmpty(tagText)) { return; } // http://fogbugz/fogbugz/default.asp?7176
SetTags(tagText.Split(','), getSqlCommand);
}
public virtual void SetTags(string[] tagsText, Tags.GetSqlCommandDelegate getSqlCommand)
{
Tags.AddRange(tagsText, getSqlCommand);
TagIDs = Tags.GetIDsFromTagText(tagsText, getSqlCommand);
OnPropertyChanged("TagIDs");
}
public string GetTagsAsCommaSeparatedString(Tags.GetSqlCommandDelegate getSqlCommand)
{
var sb = new StringBuilder();
var tagArray = GetTagsArray(getSqlCommand);
foreach (var s in tagArray)
{
if (sb.Length > 0) { sb.Append(","); }
sb.Append(s);
}
return sb.ToString();
}
#region ITagAware
public virtual string[] GetTagsArray(Tags.GetSqlCommandDelegate getSqlCommand)
{
return Tags.GetTagTextFromIDs(TagIDs, getSqlCommand);
}
public virtual int[] GetTagIDs() { return TagIDs; }
public virtual void RemoveTags(string[] tagsText)
{
// remove tags!!!
//-;
}
public bool TagCompatible(string tags, Tags.GetSqlCommandDelegate getSqlCommand)
{
//Make sure there are Tags to check
if (string.IsNullOrWhiteSpace(tags)) return true;
var newTagsArray = tags.Split(',');
//Make sure all Tags are not empty strings
if (newTagsArray.All(string.IsNullOrWhiteSpace)) return true;
var comparisonArray = GetTagsArray(getSqlCommand);
foreach (var tag in newTagsArray)
{
//If a Tag is an empty string, ignore it
if (string.IsNullOrWhiteSpace(tag)) continue;
if (comparisonArray.Contains(tag.Trim()))
{
return true;
}
}
return false;
}
public virtual bool TagCompatible(int[] tags)
{
return !tags.Any() || HasIntersectingTag(tags);
}
public virtual bool HasIntersectingTag(int[] tags)
{
return tags.Intersect(TagIDs).Any();
}
#endregion
#endregion
public void InsertTagsFromCommaSeparatedString(int id, TagTypes tagType, string tags, Tags.GetSqlCommandDelegate getSqlCommand)
{
SetTagsFromCommaSeparatedString(tags, getSqlCommand);
Commit(id, tagType, getSqlCommand);
}
public void Commit(int id, TagTypes tagType, Tags.GetSqlCommandDelegate getSqlCommand)
{
using (var cmd = getSqlCommand(true))
{
try
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = @"sp_TagAssignmentsDelete";
#region params
cmd.Parameters.Add(new SqlParameter("@ObjectID", SqlDbType.Int) { Value = id });
cmd.Parameters.Add(new SqlParameter("@ObjectType", SqlDbType.SmallInt) { Value = tagType });
var errorNumberParam = new SqlParameter("@errorNumber", SqlDbType.Int) { Direction = ParameterDirection.Output };
cmd.Parameters.Add(errorNumberParam);
var errorMessageParam = new SqlParameter("@errorMessage", SqlDbType.NVarChar, 250)
{
Direction = ParameterDirection.Output
};
cmd.Parameters.Add(errorMessageParam);
#endregion params
cmd.ExecuteNonQuery();
if (int.Parse(errorNumberParam.Value.ToString()) != 0)
{
//errorMessageParam.Value
}
}
finally
{
cmd.Connection.Dispose();
}
}
if (!TagIDs.Any()) return;
foreach (var tagId in TagIDs)
{
using (var cmd = getSqlCommand(true))
{
try
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = @"sp_TagAssignmentsInsert";
#region params
cmd.Parameters.Add(new SqlParameter("@ObjectID", SqlDbType.Int) { Value = id });
cmd.Parameters.Add(new SqlParameter("@ObjectType", SqlDbType.SmallInt) { Value = tagType });
cmd.Parameters.Add(new SqlParameter("@TagID", SqlDbType.Int) { Value = tagId });
var errorNumberParam = new SqlParameter("@errorNumber", SqlDbType.Int) { Direction = ParameterDirection.Output };
cmd.Parameters.Add(errorNumberParam);
var errorMessageParam = new SqlParameter("@errorMessage", SqlDbType.NVarChar, 250)
{
Direction = ParameterDirection.Output
};
cmd.Parameters.Add(errorMessageParam);
#endregion params
cmd.ExecuteNonQuery();
if (int.Parse(errorNumberParam.Value.ToString()) != 0)
{
//errorMessageParam.Value
}
}
finally
{
cmd.Connection.Dispose();
}
}
}
}
public List<int> GetTagIdList(int objectId, TagTypes tagType, Tags.GetSqlCommandDelegate getSqlCommand)
{
var tagIdList = new List<int>();
try
{
using (var cmd = getSqlCommand(true))
{
try
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = @"sp_TagAssignmentsGet";
#region params
cmd.Parameters.Add(new SqlParameter("@ObjectType", SqlDbType.Int) { Value = tagType });
#endregion params
//cmd.ExecuteNonQuery();
var reader = cmd.ExecuteReader();
while (reader.Read())
{
if (Convert.ToInt32(reader["ObjectID"]) != objectId) continue;
var tagId = Convert.ToInt32(reader["TagID"]);
if (!tagIdList.Contains(tagId))
{
tagIdList.Add(tagId);
}
}
}
finally
{
cmd.Connection.Dispose();
}
}
}
catch (Exception ex)
{
APILogger.Log("failed to retrieve object tags", ex);
}
return tagIdList;
}
}
}

View File

@@ -0,0 +1,6 @@
using DTS.Common.Base;
namespace DTS.Common.Interface
{
public interface ITRLReportInputView : IBaseView { }
}

View File

@@ -0,0 +1,59 @@
using System;
using System.Windows;
using System.Windows.Data;
namespace DTS.Common.Converters
{
/// <summary>
/// Represents the converter that converts Boolean values to and from <see cref="Visibility">Visibility</see> enumeration values.
/// </summary>
///
/// <remarks>
/// Use the BooleanToVisibilityConverter class to convert a Boolean to and from a <see cref="Visibility">Visibility</see> value.
/// The Convert method returns <see cref="Visibility.Visible">Visibility.Visible</see> when <b>true</b> is passed in
/// or <see cref="Visibility.Collapsed">Visibility.Collapsed</see> when <b>false</b> is passed in.
/// Note that the <see cref="Visibility.Collapsed">Visibility.Collapsed</see> value hides the control and does not reserve space for it in a layout.
/// When you call the ConvertBack method and specify a reference to an object, it returns <b>true</b>
/// if the object is <see cref="Visibility.Visible">Visible</see>; otherwise, it returns <b>false</b>.
/// </remarks>
///
public class BooleanToVisibilityConverter : IValueConverter
{
/// <summary>
/// Converts a Boolean value to a Visibility enumeration value.
/// </summary>
/// <param name="value">The Boolean value to convert. This value can be a standard Boolean value or a nullable Boolean value.</param>
/// <param name="targetType">This parameter is not used.</param>
/// <param name="parameter">The converter parameter to use.</param>
/// <param name="culture">This parameter is not used.</param>
/// <returns>The value to be passed to the target dependency property.</returns>
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
var useFalseAsVisible = parameter != null && parameter.ToString().ToUpper() == "FALSE";
var hideNotCollapse = parameter != null && parameter.ToString().ToUpper() == "HIDE";
if (!useFalseAsVisible)
{
if ((bool)value)
return Visibility.Visible;
return hideNotCollapse ? Visibility.Hidden : Visibility.Collapsed;
}
if ((bool)value)
return hideNotCollapse ? Visibility.Hidden : Visibility.Collapsed;
return Visibility.Visible;
}
/// <summary>
/// Converts a Visibility enumeration value to a Boolean value.
/// </summary>
/// <param name="value">A Visibility enumeration value.</param>
/// <param name="targetType">This parameter is not used.</param>
/// <param name="parameter">This parameter is not used.</param>
/// <param name="culture">This parameter is not used.</param>
/// <returns>The value to be passed to the source object.</returns>
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return null;
}
}
}

View File

@@ -0,0 +1,6 @@
using DTS.Common.Base;
namespace DTS.Common.Interface
{
public interface IStatsView : IBaseView { }
}

View File

@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Windows;
using DTS.Common.Base;
namespace DTS.Common.Interface
{
public interface ISystemSettingsViewModel : IBaseViewModel
{
/// <summary>
/// Gets the Shell View.
/// </summary>
ISystemSettingsView View { get; }
List<FrameworkElement> GetRegions();
Object ContextMenuRegion { get; set; }
Object ContextMainRegion { get; set; }
Object ContextNavigationRegion { get; set; }
}
}