Implement smart meter interface enhancements for AllyReader: Add `ISmartMeterReader` interface, update `RegisterReaderSelection` logic, integrate smart-meter position selection, and expand unit test coverage.
39 lines
1.1 KiB
C#
39 lines
1.1 KiB
C#
using System;
|
|
using System.Runtime.InteropServices;
|
|
using System.Windows.Forms;
|
|
|
|
namespace TBF.Rig.DataEntry.Uni
|
|
{
|
|
/// <summary>
|
|
/// Displays status text without changing the editable value of a control.
|
|
/// </summary>
|
|
internal static class DataEntryWatermark
|
|
{
|
|
private const int EmSetCueBanner = 0x1501;
|
|
private const int CbSetCueBanner = 0x1703;
|
|
|
|
[DllImport("user32.dll", CharSet = CharSet.Unicode)]
|
|
private static extern IntPtr SendMessage(
|
|
IntPtr hWnd,
|
|
int message,
|
|
IntPtr wParam,
|
|
[MarshalAs(UnmanagedType.LPWStr)] string lParam);
|
|
|
|
public static void Set(Control control, string text)
|
|
{
|
|
if (control == null || control.IsDisposed)
|
|
return;
|
|
|
|
int message;
|
|
if (control is TextBox)
|
|
message = EmSetCueBanner;
|
|
else if (control is ComboBox)
|
|
message = CbSetCueBanner;
|
|
else
|
|
return;
|
|
|
|
SendMessage(control.Handle, message, new IntPtr(1), text ?? string.Empty);
|
|
}
|
|
}
|
|
}
|