X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcec-config-gui%2FDeviceInformation.cs;h=f7992e3ef68e2fe11cb5872da187380dee61a77d;hb=2b44051cbfa70deafc30d9767323214debbc1a75;hp=2900ab31e164187611e9db19fb4495fb7fb0f5a8;hpb=75af24f133bfd316bc69a9b63e190047186f169a;p=deb_libcec.git diff --git a/src/cec-config-gui/DeviceInformation.cs b/src/cec-config-gui/DeviceInformation.cs index 2900ab3..f7992e3 100644 --- a/src/cec-config-gui/DeviceInformation.cs +++ b/src/cec-config-gui/DeviceInformation.cs @@ -1,9 +1,4 @@ using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Text; using System.Windows.Forms; using CecSharp; @@ -19,19 +14,24 @@ namespace CecConfigGui Lib = lib; Address = address; InitializeComponent(); - this.lDevice.Text = lib.ToString(address); - 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.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; + lDevice.Text = lib.ToString(address); + lLogicalAddress.Text = String.Format("{0,1:X}", (int)address); + Update(devicePresent, vendor, isActiveSource, physicalAddress, version, power, osdName, menuLanguage); + } + + public void Update(bool devicePresent, CecVendorId vendor, bool isActiveSource, ushort physicalAddress, + CecVersion version, CecPowerStatus power, string osdName, string menuLanguage) + { + SetControlText(lPhysicalAddress, String.Format("{0,4:X}", physicalAddress)); + SetControlText(lDevicePresent, devicePresent ? "yes" : "no"); + SetControlVisible(lActiveSource, isActiveSource); + SetControlVisible(lInactiveSource, !isActiveSource); + SetControlText(lVendor, vendor != CecVendorId.Unknown ? Lib.ToString(vendor) : "unknown"); + SetControlText(lCecVersion, Lib.ToString(version)); + SetControlText(lPowerStatus, Lib.ToString(power)); + SetControlText(lOsdName, osdName); + SetControlText(lMenuLanguage, menuLanguage); + SetControlText(this, "Device: " + osdName); } private void lInactiveSource_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) @@ -54,7 +54,17 @@ namespace CecConfigGui Gui.SendStandby(Address); } - private CecLogicalAddress Address; + + private void button1_Click(object sender, EventArgs e) + { + Gui.UpdateInfoPanel(this); + } + + public CecLogicalAddress Address + { + private set; + get; + } private CecConfigGUI Gui; private LibCecSharp Lib; }