X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcec-config-gui%2FDeviceInformation.cs;h=2900ab31e164187611e9db19fb4495fb7fb0f5a8;hb=5de1dde470c394fc45791fbb747fdf8ad6e73b2a;hp=9d9b983a158bd0ae3ead618754caa539029fb456;hpb=96fa7764c1af5034afaba2646831df0a74419249;p=deb_libcec.git diff --git a/src/cec-config-gui/DeviceInformation.cs b/src/cec-config-gui/DeviceInformation.cs index 9d9b983..2900ab3 100644 --- a/src/cec-config-gui/DeviceInformation.cs +++ b/src/cec-config-gui/DeviceInformation.cs @@ -9,23 +9,53 @@ using CecSharp; namespace CecConfigGui { - public partial class DeviceInformation : Form + public partial class DeviceInformation : AsyncForm { - public DeviceInformation(CecLogicalAddress address, ref LibCecSharp lib, + public DeviceInformation(CecConfigGUI gui, CecLogicalAddress address, ref LibCecSharp lib, bool devicePresent, CecVendorId vendor, bool isActiveSource, ushort physicalAddress, CecVersion version, CecPowerStatus power, string osdName, string menuLanguage) { + Gui = gui; + Lib = lib; + Address = address; InitializeComponent(); this.lDevice.Text = lib.ToString(address); - this.lLogicalAddress.Text = "#" + (int)address; - this.lPhysicalAddress.Text = physicalAddress.ToString(); + this.lLogicalAddress.Text = String.Format("{0,1:X}", (int)address); + this.lPhysicalAddress.Text = String.Format("{0,4:X}", physicalAddress); this.lDevicePresent.Text = devicePresent ? "yes" : "no"; - this.lActiveSource.Text = isActiveSource ? "yes" : "no"; - this.lVendor.Text = lib.ToString(vendor) + " (" + (UInt64)vendor +")"; + this.lActiveSource.Visible = isActiveSource; + this.lInactiveSource.Visible = !isActiveSource; + this.lVendor.Text = vendor != CecVendorId.Unknown ? lib.ToString(vendor) : "unknown"; this.lCecVersion.Text = lib.ToString(version); this.lPowerStatus.Text = lib.ToString(power); + bool isPoweredOn = (power == CecPowerStatus.On || power == CecPowerStatus.InTransitionStandbyToOn); this.lOsdName.Text = osdName; this.lMenuLanguage.Text = menuLanguage; + this.Text = "Device: " + osdName; } + + private void lInactiveSource_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + { + SetControlVisible(lInactiveSource, false); + SetControlVisible(lActiveSource, true); + Gui.ActivateSource(Address); + } + + private void lStandby_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + { + LinkLabel label = sender as LinkLabel; + bool sendPowerOn = label.Text != Lib.ToString(CecPowerStatus.InTransitionStandbyToOn) && + label.Text != Lib.ToString(CecPowerStatus.On); + + SetControlText(lPowerStatus, Lib.ToString(sendPowerOn ? CecPowerStatus.On : CecPowerStatus.Standby)); + if (sendPowerOn) + Gui.SendImageViewOn(Address); + else + Gui.SendStandby(Address); + } + + private CecLogicalAddress Address; + private CecConfigGUI Gui; + private LibCecSharp Lib; } }