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,371 @@
using System;
using System.Text;
using System.Runtime.InteropServices;
using System.Windows;
using System.Windows.Interop;
namespace DTS.Common.Dialogs
{
/// <summary>
/// Represents a common dialog box (Win32::SHBrowseForFolder()) that allows a user to select a folder.
/// </summary>
public class BrowseForFolderDialog
{
#region Public Properties
/// <summary>
/// Gets the current and or final selected folder path.
/// </summary>
public string SelectedFolder { get; protected set; }
/// <summary>
/// Gets or sets the string that is displayed above the tree View control in the dialog box (must set BEFORE calling ShowDialog()).
/// </summary>
public string Title
{
get => BrowseInfo.lpszTitle;
set => BrowseInfo.lpszTitle = value;
}
/// <summary>
/// Gets or sets the initially selected folder path.
/// </summary>
public string InitialFolder { get; set; }
/// <summary>
/// Gets or sets the initially selected and expanded folder path. Overrides SelectedFolder.
/// </summary>
public string InitialExpandedFolder { get; set; }
/// <summary>
/// Gets or sets the text for the dialog's OK button.
/// </summary>
public string OKButtonText { get; set; }
/// <summary>
/// Provides direct access to the Win32::SHBrowseForFolder() BROWSEINFO structure used to create the dialog in ShowDialog().
/// </summary>
public BROWSEINFOW BrowseInfo { get; protected set; }
/// <summary>
/// Provides direct access to the ulFlags field of the Win32::SHBrowseForFolder() structure used to create the dialog in ShowDialog().
/// </summary>
public BrowseInfoFlags BrowserDialogFlags
{
get => BrowseInfo.ulFlags;
set => BrowseInfo.ulFlags = value;
}
#endregion
#region Public Constructors
/// <summary>
/// Constructs a BrowseForFolderDialog with default BrowseInfoFlags set to BIF_NEWDIALOGSTYLE.
/// </summary>
public BrowseForFolderDialog()
{
BrowseInfo = new BROWSEINFOW();
BrowseInfo.hwndOwner = IntPtr.Zero;
BrowseInfo.pidlRoot = IntPtr.Zero;
BrowseInfo.pszDisplayName = new String(' ', 260);
BrowseInfo.lpszTitle = "Select a folder:";
BrowseInfo.ulFlags = BrowseInfoFlags.BIF_NEWDIALOGSTYLE;
BrowseInfo.lpfn = new BrowseCallbackProc(BrowseEventHandler);
BrowseInfo.lParam = IntPtr.Zero;
BrowseInfo.iImage = -1;
}
#endregion
#region Public ShowDialog() Overloads
/// <summary>
/// Shows the dialog (Win32::SHBrowseForFolder()).
/// </summary>
public Nullable<bool> ShowDialog()
{
return PInvokeSHBrowseForFolder(null);
}
/// <summary>
/// Shows the dialog (Win32::SHBrowseForFolder()) with its hwndOwner set to the handle of 'owner'.
/// </summary>
public Nullable<bool> ShowDialog(Window owner)
{
return PInvokeSHBrowseForFolder(owner);
}
#endregion
#region PInvoke Stuff
private Nullable<bool> PInvokeSHBrowseForFolder(Window owner)
{
WindowInteropHelper windowhelper;
if (null != owner)
{
windowhelper = new WindowInteropHelper(owner);
BrowseInfo.hwndOwner = windowhelper.Handle;
}
var pidl = SHBrowseForFolderW(BrowseInfo);
if (IntPtr.Zero != pidl)
{
var pathsb = new StringBuilder(260);
if (SHGetPathFromIDList(pidl, pathsb))
{
SelectedFolder = pathsb.ToString();
Marshal.FreeCoTaskMem(pidl);
return true;
}
}
return false;
}
private int BrowseEventHandler(IntPtr hwnd, MessageFromBrowser uMsg, IntPtr lParam, IntPtr lpData)
{
switch (uMsg)
{
case MessageFromBrowser.BFFM_INITIALIZED:
{
// The dialog box has finished initializing.
// lParam Not used, value is NULL.
if (!string.IsNullOrEmpty(InitialExpandedFolder))
SendMessageW(hwnd, MessageToBrowser.BFFM_SETEXPANDED, new IntPtr(1), InitialExpandedFolder);
else if (!string.IsNullOrEmpty(InitialFolder))
SendMessageW(hwnd, MessageToBrowser.BFFM_SETSELECTIONW, new IntPtr(1), InitialFolder);
if (!string.IsNullOrEmpty(OKButtonText))
SendMessageW(hwnd, MessageToBrowser.BFFM_SETOKTEXT, new IntPtr(1), OKButtonText);
break;
}
case MessageFromBrowser.BFFM_SELCHANGED:
{
// The selection has changed in the dialog box.
// lParam A pointer to an item identifier list (PIDL) identifying the newly selected item.
var pathsb = new StringBuilder(260);
if (SHGetPathFromIDList(lParam, pathsb))
{
SelectedFolder = pathsb.ToString();
}
break;
}
case MessageFromBrowser.BFFM_VALIDATEFAILEDA: // ANSI
{
// The user typed an invalid name into the dialog's edit box. A nonexistent folder is considered an invalid name.
// lParam A pointer to a string containing the invalid name. An application can use this data in an error dialog informing the user that the name was not valid.
// Return zero to dismiss the dialog or nonzero to keep the dialog displayed
break;
}
case MessageFromBrowser.BFFM_VALIDATEFAILEDW: // Unicode
{
// The user typed an invalid name into the dialog's edit box. A nonexistent folder is considered an invalid name.
// lParam A pointer to a string containing the invalid name. An application can use this data in an error dialog informing the user that the name was not valid.
// Return zero to dismiss the dialog or nonzero to keep the dialog displayed
break;
}
case MessageFromBrowser.BFFM_IUNKNOWN:
{
// An IUnknown interface is available to the dialog box.
// lParam A pointer to an IUnknown interface.
break;
}
}
return 0;
}
public delegate int BrowseCallbackProc(IntPtr hwnd, MessageFromBrowser uMsg, IntPtr lParam, IntPtr lpData);
[Flags]
public enum BrowseInfoFlags : uint
{
/// <summary>
/// No specified BIF_xxx flags.
/// </summary>
BIF_None = 0x0000,
/// <summary>
/// Only return file system directories. If the user selects folders that are not part of the file system, the OK button is grayed.
/// </summary>
BIF_RETURNONLYFSDIRS = 0x0001, // For finding a folder to start document searching
/// <summary>
/// Do not include network folders below the domain level in the dialog box's tree View control.
/// </summary>
BIF_DONTGOBELOWDOMAIN = 0x0002, // For starting the Find Computer
/// <summary>
/// Include a status area in the dialog box.
/// </summary>
BIF_STATUSTEXT = 0x0004, // Top of the dialog has 2 lines of text for BROWSEINFO.lpszTitle and one line if
// this flag is set. Passing the message BFFM_SETSTATUSTEXTA to the hwnd can set the
// rest of the text. This is not used with BIF_USENEWUI and BROWSEINFO.lpszTitle gets
// all three lines of text.
/// <summary>
/// Only return file system ancestors. An ancestor is a subfolder that is beneath the root folder in the namespace hierarchy.
/// </summary>
BIF_RETURNFSANCESTORS = 0x0008,
/// <summary>
/// Include an edit control in the browse dialog box that allows the user to type the name of an item.
/// </summary>
BIF_EDITBOX = 0x0010, // Add an editbox to the dialog
/// <summary>
/// If the user types an invalid name into the edit box, the browse dialog box will call the application's BrowseCallbackProc with the BFFM_VALIDATEFAILED message.
/// </summary>
BIF_VALIDATE = 0x0020, // insist on valid result (or CANCEL)
/// <summary>
/// Use the new user interface. Setting this flag provides the user with a larger dialog box that can be resized.
/// </summary>
BIF_NEWDIALOGSTYLE = 0x0040, // Use the new dialog layout with the ability to resize
// Caller needs to call OleInitialize() before using this API
/// <summary>
/// Use the new user interface, including an edit box. This flag is equivalent to BIF_EDITBOX | BIF_NEWDIALOGSTYLE.
/// </summary>
BIF_USENEWUI = BIF_NEWDIALOGSTYLE | BIF_EDITBOX,
/// <summary>
/// The browse dialog box can display URLs. The BIF_USENEWUI and BIF_BROWSEINCLUDEFILES flags must also be set.
/// </summary>
BIF_BROWSEINCLUDEURLS = 0x0080, // Allow URLs to be displayed or entered. (Requires BIF_USENEWUI)
/// <summary>
/// When combined with BIF_NEWDIALOGSTYLE, adds a usage hint to the dialog box in place of the edit box.
/// </summary>
BIF_UAHINT = 0x0100, // Add a UA hint to the dialog, in place of the edit box. May not be combined with BIF_EDITBOX
/// <summary>
/// Do not include the New Folder button in the browse dialog box.
/// </summary>
BIF_NONEWFOLDERBUTTON = 0x0200, // Do not add the "New Folder" button to the dialog. Only applicable with BIF_NEWDIALOGSTYLE.
/// <summary>
/// When the selected item is a shortcut, return the PIDL of the shortcut itself rather than its target.
/// </summary>
BIF_NOTRANSLATETARGETS = 0x0400,// don't traverse target as shortcut
/// <summary>
/// Only return computers. If the user selects anything other than a computer, the OK button is grayed.
/// </summary>
BIF_BROWSEFORCOMPUTER = 0x1000, // Browsing for Computers.
/// <summary>
/// Only allow the selection of printers. If the user selects anything other than a printer, the OK button is grayed.
/// </summary>
BIF_BROWSEFORPRINTER = 0x2000, // Browsing for Printers
/// <summary>
/// The browse dialog box will display files as well as folders.
/// </summary>
BIF_BROWSEINCLUDEFILES = 0x4000,// Browsing for Everything
/// <summary>
/// The browse dialog box can display shareable resources on remote systems.
/// </summary>
BIF_SHAREABLE = 0x8000 // sharable resources displayed (remote shares, requires BIF_USENEWUI)
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public class BROWSEINFOW
{
/// <summary>
/// A handle to the owner window for the dialog box.
/// </summary>
public IntPtr hwndOwner;
/// <summary>
/// A pointer to an item identifier list (PIDL) specifying the location of the root folder from which to start browsing.
/// </summary>
public IntPtr pidlRoot; // PCIDLIST_ABSOLUTE
/// <summary>
/// The address of a buffer to receive the display name of the folder selected by the user. The size of this buffer is assumed to be MAX_PATH characters.
/// </summary>
public string pszDisplayName; // Output parameter! (length must be >= MAX_PATH)
/// <summary>
/// The address of a null-terminated string that is displayed above the tree View control in the dialog box.
/// </summary>
public string lpszTitle;
/// <summary>
/// Flags specifying the options for the dialog box.
/// </summary>
public BrowseInfoFlags ulFlags;
/// <summary>
/// A BrowseCallbackProc delegate that the dialog box calls when an event occurs.
/// </summary>
public BrowseCallbackProc lpfn;
/// <summary>
/// An application-defined value that the dialog box passes to the BrowseCallbackProc delegate, if one is specified.
/// </summary>
public IntPtr lParam;
/// <summary>
/// A variable to receive the image associated with the selected folder. The image is specified as an index to the system image list.
/// </summary>
public int iImage; // Output parameter!
}
// message from browser
public enum MessageFromBrowser : uint
{
/// <summary>
/// The dialog box has finished initializing.
/// </summary>
BFFM_INITIALIZED = 1,
/// <summary>
/// The selection has changed in the dialog box.
/// </summary>
BFFM_SELCHANGED = 2,
/// <summary>
/// (ANSI) The user typed an invalid name into the dialog's edit box. A nonexistent folder is considered an invalid name.
/// </summary>
BFFM_VALIDATEFAILEDA = 3,
/// <summary>
/// (Unicode) The user typed an invalid name into the dialog's edit box. A nonexistent folder is considered an invalid name.
/// </summary>
BFFM_VALIDATEFAILEDW = 4,
/// <summary>
/// An IUnknown interface is available to the dialog box.
/// </summary>
BFFM_IUNKNOWN = 5
}
// messages to browser
public enum MessageToBrowser : uint
{
/// <summary>
/// Win32 API macro - start of user defined window message range.
/// </summary>
WM_USER = 0x0400,
/// <summary>
/// (ANSI) Sets the status text. Set lpData to point to a null-terminated string with the desired text.
/// </summary>
BFFM_SETSTATUSTEXTA = WM_USER + 100,
/// <summary>
/// Enables or disables the dialog box's OK button. lParam - To enable, set to a nonzero value. To disable, set to zero.
/// </summary>
BFFM_ENABLEOK = WM_USER + 101,
/// <summary>
/// (ANSI) Specifies the path of a folder to select.
/// </summary>
BFFM_SETSELECTIONA = WM_USER + 102,
/// <summary>
/// (Unicode) Specifies the path of a folder to select.
/// </summary>
BFFM_SETSELECTIONW = WM_USER + 103,
/// <summary>
/// (Unicode) Sets the status text. Set lpData to point to a null-terminated string with the desired text.
/// </summary>
BFFM_SETSTATUSTEXTW = WM_USER + 104,
/// <summary>
/// Sets the text that is displayed on the dialog box's OK button.
/// </summary>
BFFM_SETOKTEXT = WM_USER + 105, // Unicode only
/// <summary>
/// Specifies the path of a folder to expand in the Browse dialog box.
/// </summary>
BFFM_SETEXPANDED = WM_USER + 106 // Unicode only
}
[DllImport("shell32.dll")]
private static extern IntPtr SHBrowseForFolderW([MarshalAs(UnmanagedType.LPStruct), In, Out] BROWSEINFOW bi);
[DllImport("shell32.dll")]
private static extern bool SHGetPathFromIDList(IntPtr pidl, StringBuilder path);
[DllImport("user32.dll")]
public static extern IntPtr SendMessageW(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);
[DllImport("user32.dll")]
public static extern IntPtr SendMessageW(IntPtr hWnd, MessageToBrowser msg, IntPtr wParam, [MarshalAs(UnmanagedType.LPWStr)] string str);
#endregion
}
}

View File

@@ -0,0 +1,323 @@
using DTS.Common.Enums;
using DTS.Common.Enums.Sensors;
using DTS.Common.Interface.DASFactory.Diagnostics;
using DTS.Common.Interface.Sensors.SoftwareFilters;
using System;
using System.Xml;
namespace DTS.Common.Interface.DASFactory
{
public interface IAnalogInputDASChannel
{
/// <summary>
/// Type of Wheatstone Bridge in the sensor; half, full, etc.
/// </summary>
SensorConstants.BridgeType TypeOfBridge { get; set; }
/// <summary>
/// 14042 Flash Clear turns of excitation for s6
/// this allows for ILevelTriggerable channels to store and cache a sample average for checking
/// level triggered
/// </summary>
//double? ILevelTriggerable.SampleAverageADC { get; set; } = null;
/// <summary>
/// used during TDAS diagnostics, it's a throw away value that's computed during configuration
/// then compared to during measure shunt.
/// </summary>
int ShuntTargetADC { get; set; }
SensorConstants.BridgeType[] SupportedBridges { get; set; }
/// <summary>
/// the types of digital input modes supported by the channel.
/// by default all digital modes are supported, and some hardware restrict the list (notably the g5)
/// </summary>
DigitalInputModes[] SupportedDigitalInputModes { get; set; }
/// <summary>
/// IEPE Coupling mode (AC, AC/DC)
/// correct voltage base on this property.
/// </summary>
SensorConstants.CouplingModes CouplingMode { get; set; }
/// <summary>
/// Resistance of the Bridge in the sensor.
/// </summary>
double BridgeResistanceOhms { get; set; }
/// <summary>
/// used to store 2D/3D IR-TRACC ZeroPoint Voltage data
/// </summary>
double ZeroPoint { get; set; }
/// <summary>
/// Bi-Polar maximum tolerance of sensor in Engineering Units.
/// </summary>
double SensorCapacityEU { get; set; }
/// <summary>
/// Sensor capacity specified in sensor database.
/// </summary>
double SensorCapacity { get; set; }
/// <summary>
/// Sensor polarity specified in sensor database.
/// </summary>
string SensorPolarity { get; set; }
/// <summary>
/// The desired Bi-Polar range of readings (in Engineering Units)
/// from this sensor for this test or event. This must be
/// within the SensorCapacityEU of the sensor.
/// </summary>
double DesiredRangeWithHeadroomEU { get; set; }
/// <summary>
/// Sensitivity of the sensor in Millivots per Engineering Unit
/// as specified by the sensor's manufacturer or hardware settings.
/// </summary>
double SensitivityMilliVoltsPerEU { get; set; }
double SensitivityMilliVoltsPerEUNormalized { get; }
/// <summary>
/// Are sensor readings proportional to excitation voltage?
/// </summary>
bool IsProportionalToExcitation { get; set; }
bool IsSupported(ExcitationVoltageOptions.ExcitationVoltageOption o);
/// <summary>
/// Is this sensor's output inverted?
/// </summary>
bool IsInverted { get; set; }
string OriginalChannelName { get; set; }
string ChannelName2 { get; set; }
/// <summary>
/// refers to a unique id for a logical channel in the test
/// for now this is using TestObjectChannel.GetId()
/// which is in the form of TestObjectSerial_ChannelType_ChannelId
/// </summary>
string ChannelId { get; set; }
/// <summary>
/// refers to the Group for a logical channel in the test
/// </summary>
string ChannelGroupName { get; set; }
string HardwareChannelName { get; set; }
string DIUnits { get; set; }
DigitalInputModes DigitalMode { get; set; }
DTS.Common.Classes.Sensors.LinearizationFormula LinearizationFormula { get; set; }
/// <summary>
/// The excitation voltage to apply to the sensor. Firmware will provide the
/// correct voltage base on this property.
/// </summary>
ExcitationVoltageOptions.ExcitationVoltageOption Excitation { get; set; }
ExcitationVoltageOptions.ExcitationVoltageOption[] SupportedExcitation { get; set; }
/// <summary>
/// String representation of the Engineering Units this sensor reads, for example
/// "g" or "m/s/s" or "meters per second", etc. Not mathematically relevant, only
/// used for display.
/// </summary>
string EngineeringUnits { get; set; }
/// <summary>
/// Serial number of the sensor.
/// </summary>
string SerialNumber { get; set; }
/// <summary>
/// Manufacturer of the sensor.
/// </summary>
string Manufacturer { get; set; }
/// <summary>
/// Model of the sensor.
/// </summary>
string Model { get; set; }
/// <summary>
/// A text description of the sensor.
/// </summary>
string Description { get; set; }
/// <summary>
/// How will this sensor be zeroed?
/// </summary>
ZeroMethodType ZeroMethod { get; set; }
/// <summary>
/// Start time for the zero window relative to T=0
/// used if ZeroMethod is AverageOverTime.
/// </summary>
double ZeroAverageStartSeconds { get; set; }
/// <summary>
/// Stop time for the zero window relative to T=0
/// used if ZeroMethod is AverageOverTime.
/// </summary>
double ZeroAverageStopSeconds { get; set; }
/// <summary>
/// The initial EU value
/// </summary>
double InitialEU { get; set; }
string InitialOffset { get; set; }
bool Unipolar { get; set; }
/// <summary>
/// Should the shunt be enabled?
/// </summary>
bool ShuntIsEnabled { get; set; }
/// <summary>
/// some DAS require holding zeromV in adc in the xml configuration (slice2)
/// this is here to hold that information
/// </summary>
short ZeromVInADC { get; set; }
/// <summary>
/// should voltage insertion (gain) check be enabled?
/// </summary>
bool VoltageInsertionCheckEnabled { get; set; }
bool IEPEChannel { get; set; }
bool DigitalInputChannel { get; set; }
bool CalSignalIsEnabled { get; set; }
/// <summary>
/// Setting this true will flag the hardware to compensate for the offset of the sensor
/// during a call to DiagnosticsService.Diagnose(...).
/// </summary>
bool RemoveOffset { get; set; }
/// <summary>
/// Should we verify the measured offset to the limits?
/// </summary>
bool VerifyOffset { get; set; }
/// <summary>
/// The lower limit on allowed offset for the connected sensor.
/// </summary>
double OffsetToleranceLowMilliVolts { get; set; }
/// <summary>
/// The upper limit on allowed offset for the connected sensor.
/// </summary>
double OffsetToleranceHighMilliVolts { get; set; }
DateTime LastCalibrationDate { get; set; }
DateTime CalDueDate { get; set; }
/// <summary>
/// The ISO code for this channel.
/// </summary>
string ISOCode { get; set; }
/// <summary>
/// Not available on slice or G5. Remove for now?
/// </summary>
bool BypassAAFilter { get; set; }
string SensorID { get; set; }
/// <summary>
/// Get the channel diagnostics results (if available) for this channel.
/// </summary>
IDiagnosticResult Diagnostics { get; }
/// <summary>
/// some channels should not be refreshed from the database prior to running configuration, for example sensors that are part of a group
/// should not be updated from database
/// </summary>
bool UpdateChannelFromDatabase { get; set; }
/// <inheritdoc />
/// <summary>
/// Get/set the "trigger below" threshold. Set to "null" to deactivate.
/// </summary>
double? TriggerBelowThresholdEu
{
get;
set;
}
/// <inheritdoc />
/// <summary>
/// Get/set the "trigger above" threshold. Set to "null" to deactivate.
/// </summary>
double? TriggerAboveThresholdEu
{
get;
set;
}
bool AlreadyLevelTriggered
{
get;
set;
}
double MeasuredEULevelTriggerCheck
{
get;
set;
}
/// <summary>
/// Temporary fix that'll be addressed in 1.1
/// </summary>
double SoftwareFilterFrequency { get; set; }
/// <summary>
/// Fb 13120 For now continue using SoftwareFilterFrequency needs to be refactored to use SoftwareFilterClass instead
/// </summary>
IFilterClass SoftwareFilterClass { get; set; }
/// <summary>
/// Get/set the <see cref="DTS.DASLib.Service.DiagnosticsResult"/> for this channel.
/// </summary>
IDiagnosticResult DiagnosticInformation { get; }
/// <summary>
/// Get/set the <see cref="double"/> measured excitation voltage.
/// </summary>
double? MeasuredExcitationVolts { get; }
/// <summary>
/// Get/set the <see cref="double"/> factory excitation voltage.
/// </summary>
double? FactoryExcitationVolts { get; }
double ScalefactorMilliVoltsPerADC { get; set; }
double ScalefactorEngineeringUnitsPerADC { get; set; }
double NoiseAsPercentOfFullScale { get; set; }
/// <summary>
/// If this channel is supersampled, what the regular sampling rate is
/// </summary>
double UnsupersampledSampleRate { get; set; }
/// <summary>
/// If the channel has a serial number in the SerialNumber field, it is "Configured".
/// </summary>
bool IsConfigured();
void WriteElementEnd(XmlWriter writer);
void WriteXml(XmlWriter writer);
string GetSupportedExcitationSerialized();
string GetSupportedDigitalInputModesSerialized();
string GetSupportedBridgesSerialized();
void WriteXmlCRC32(XmlWriter writer);
}
}

View File

@@ -0,0 +1,267 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Media;
using DTS.Common.Base;
using DTS.Common.Events;
using DTS.Common.Utilities.Logging;
using Microsoft.Practices.Prism.Events;
using Microsoft.Practices.ServiceLocation;
namespace DTS.Common.Controls
{
/// <inheritdoc cref="IBasePropertyChanged" />
/// <summary>
/// Interaction logic for GridViewColumnHeaderSearchable.xaml
/// </summary>
public partial class GridViewColumnHeaderSearchable : UserControl, IBasePropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
public bool SetProperty<T>(ref T storage, T value, string propertyName = null)
{
if (Equals(storage, value)) return false;
storage = value;
OnPropertyChanged(propertyName);
return true;
}
public void OnPropertyChanged(string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
public GridViewColumnHeaderSearchable()
{
InitializeComponent();
var eventAggregator = ServiceLocator.Current.GetInstance<IEventAggregator>();
eventAggregator.GetEvent<ListViewStatusEvent>().Subscribe(OnListviewStatusEvent, ThreadOption.UIThread);
}
public override string ToString()
{
return HeaderTitle;
}
private void OnListviewStatusEvent(ListViewStatusArg arg)
{
if (arg.Status != ListViewStatusArg.ListViewStatus.Unloaded)
{
return;
}
if (arg.Id == ListviewId)
{
HeaderSearchTerm = string.Empty;
}
}
public string ListviewId
{
get => (string) GetValue(ListviewIdProperty);
set => SetValue(ListviewIdProperty, value);
}
public static readonly DependencyProperty ListviewIdProperty =
DependencyProperty.Register(
"ListviewId",
typeof(string),
typeof(GridViewColumnHeaderSearchable), new PropertyMetadata(""));
public string HeaderTitle
{
get => (string) GetValue(HeaderTitleProperty);
set => SetValue(HeaderTitleProperty, value);
}
// Using a DependencyProperty enables animation, styling, binding, etc.
public static readonly DependencyProperty HeaderTitleProperty =
DependencyProperty.Register(
"HeaderTitle", // The name of the DependencyProperty
typeof(string), // The type of the DependencyProperty
typeof(GridViewColumnHeaderSearchable), // The type of the owner of the DependencyProperty
new PropertyMetadata( // OnHeaderTitleChanged will be called when HeaderTitle changes
"Awesome", // The default value of the DependencyProperty
OnHeaderTitleChanged
)
);
private static void OnHeaderTitleChanged(
DependencyObject d,
DependencyPropertyChangedEventArgs e
)
{
if (d is GridViewColumnHeaderSearchable instance)
{
instance.HeaderTitle = (string) e.NewValue;
}
}
private bool _toggleButtonIsChecked = false;
/// <summary>
/// holds whether the toggle button is checked or not and controls whether the popup is open or not
/// </summary>
public bool ToggleButtonIsChecked
{
get => _toggleButtonIsChecked;
set
{
if (value == _toggleButtonIsChecked) return;
_toggleButtonIsChecked = value;
OnPropertyChanged("ToggleButtonIsChecked");
OnPropertyChanged("ToggleIconGeometry");
RaiseOpenChangedEvent(value);
}
}
public static readonly DependencyProperty HeaderIsCheckedProperty =
DependencyProperty.Register(
"ToggleButtonIsChecked",
typeof(bool),
typeof(GridViewColumnHeaderSearchable),
new PropertyMetadata(
false,
OnHeaderIsOpenChanged
)
);
private static void OnHeaderIsOpenChanged(
DependencyObject d,
DependencyPropertyChangedEventArgs e)
{
if (!(d is GridViewColumnHeaderSearchable instance)) return;
instance.ToggleButtonIsChecked = (bool)e.NewValue;
var isOpen = instance.ToggleButtonIsChecked;
instance.RaiseOpenChangedEvent(isOpen);
}
// Create a custom routed event by first registering a RoutedEventID
// This event uses the bubbling routing strategy
public static readonly RoutedEvent OpenChangedEvent = EventManager.RegisterRoutedEvent(
"OpenChanged", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(GridViewColumnHeaderSearchable));
// Provide CLR accessors for the event
public event RoutedEventHandler OpenChanged
{
add => AddHandler(OpenChangedEvent, value);
remove => RemoveHandler(OpenChangedEvent, value);
}
// This method raises the Tap event
private void RaiseOpenChangedEvent(bool isOpen)
{
var newEventArgs = new RoutedEventArgs(OpenChangedEvent, isOpen);
RaiseEvent(newEventArgs);
}
public static readonly RoutedEvent ClickEvent = EventManager.RegisterRoutedEvent(
"ClickHandler", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(GridViewColumnHeaderSearchable));
public event RoutedEventHandler ClickHandler
{
add => AddHandler(ClickEvent, value);
remove => RemoveHandler(ClickEvent, value);
}
private void RaiseClickEvent(object tag)
{
var newEventArgs = new RoutedEventArgs(ClickEvent, tag);
RaiseEvent(newEventArgs);
}
private void PreviewLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
if (LogicalTreeHelper.GetParent((DependencyObject) e.OriginalSource) is Popup popupParent)
{
//RaiseClickEvent(Tag);
e.Handled = true;
}
}
private void HeaderSearchTerm_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
{
RaiseSearchEvent(((TextBox) sender).Text);
}
public Geometry ToggleIconGeometry
{
get
{
if(string.IsNullOrEmpty(HeaderSearchTerm))
{
return (Geometry)dtsGridViewColumnHeader.FindResource("DownArrowIconGeometry");
}
return (Geometry)dtsGridViewColumnHeader.FindResource("FilterIconGeometry");
}
}
public string HeaderSearchTerm
{
get => (string)GetValue(HeaderSearchTermProperty);
set => SetValue(HeaderSearchTermProperty, value);
}
// Using a DependencyProperty enables animation, styling, binding, etc.
public static readonly DependencyProperty HeaderSearchTermProperty =
DependencyProperty.Register(
"HeaderSearchTerm", // The name of the DependencyProperty
typeof(string), // The type of the DependencyProperty
typeof(GridViewColumnHeaderSearchable), // The type of the owner of the DependencyProperty
new PropertyMetadata( // OnHeaderTitleChanged will be called when HeaderTitle changes
"", // The default value of the DependencyProperty
OnHeaderSearchTermChanged
)
);
private static void OnHeaderSearchTermChanged(
DependencyObject d,
DependencyPropertyChangedEventArgs e
)
{
if (!(d is GridViewColumnHeaderSearchable instance)) return;
instance.HeaderSearchTerm = (string)e.NewValue;
instance.RaiseSearchEvent((string)e.NewValue);
}
// Create a custom routed event by first registering a RoutedEventID
// This event uses the bubbling routing strategy
public static readonly RoutedEvent SearchEvent = EventManager.RegisterRoutedEvent(
"Search", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(GridViewColumnHeaderSearchable));
// Provide CLR accessors for the event
public event RoutedEventHandler Search
{
add => AddHandler(SearchEvent, value);
remove => RemoveHandler(SearchEvent, value);
}
// This method raises the Tap event
private void RaiseSearchEvent(string searchTerm)
{
var newEventArgs = new RoutedEventArgs(SearchEvent, searchTerm);
RaiseEvent(newEventArgs);
OnPropertyChanged("ToggleIconGeometry");
}
}
public class BoolToInvertedBoolConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if (value is bool boolValue)
{
return !boolValue;
}
return false;
}
public object ConvertBack(object value, Type targetType, object parameter,
System.Globalization.CultureInfo culture)
{
throw new NotImplementedException("ConvertBack() of BoolToInvertedBoolConverter is not implemented");
}
}
}

View File

@@ -0,0 +1,22 @@
namespace DTS.Common.Enums.DBExport
{
/// <summary>
/// different tags for an ISODll.MMEPositions object
/// </summary>
public enum PositionFields
{
Date,
Expired,
History,
Last_Change,
Last_Change_Text,
Position,
RecordType,
Remarks,
S_GUID,
SortKey,
Text_L1,
Text_L2,
Version
}
}

View File

@@ -0,0 +1,6 @@
using DTS.Common.Base;
namespace DTS.Common.Interface.TestSetups.Imports.TTS.DIChannels
{
public interface IDigitalInputChannelsView : IBaseView { }
}

View File

@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DTS.Common.Interface.TestSetups
{
/// <summary>
/// Describes a record in the TestSetupROIs table
/// </summary>
public interface ITestSetupROIRecord
{
int TestSetupROIId { get; set; }
int TestSetupId { get; set; }
string Suffix { get; set; }
double ROIStart { get; set; }
double ROIEnd { get; set; }
bool IsEnabled { get; set; }
bool IsDefault { get; set; }
}
}