2 using System.Collections.Generic;
3 using System.ComponentModel;
7 using System.Windows.Forms;
10 namespace CecConfigGui
12 public partial class DeviceInformation : AsyncForm
14 public DeviceInformation(CecConfigGUI gui, CecLogicalAddress address, ref LibCecSharp lib,
15 bool devicePresent, CecVendorId vendor, bool isActiveSource, ushort physicalAddress,
16 CecVersion version, CecPowerStatus power, string osdName, string menuLanguage)
21 InitializeComponent();
22 this.lDevice.Text = lib.ToString(address);
23 this.lLogicalAddress.Text = String.Format("{0,1:X}", (int)address);
24 Update(devicePresent, vendor, isActiveSource, physicalAddress, version, power, osdName, menuLanguage);
27 public void Update(bool devicePresent, CecVendorId vendor, bool isActiveSource, ushort physicalAddress,
28 CecVersion version, CecPowerStatus power, string osdName, string menuLanguage)
30 SetControlText(lPhysicalAddress, String.Format("{0,4:X}", physicalAddress));
31 SetControlText(lDevicePresent, devicePresent ? "yes" : "no");
32 SetControlVisible(lActiveSource, isActiveSource);
33 SetControlVisible(lInactiveSource, !isActiveSource);
34 SetControlText(lVendor, vendor != CecVendorId.Unknown ? Lib.ToString(vendor) : "unknown");
35 SetControlText(lCecVersion, Lib.ToString(version));
36 SetControlText(lPowerStatus, Lib.ToString(power));
37 SetControlText(lOsdName, osdName);
38 SetControlText(lMenuLanguage, menuLanguage);
39 SetControlText(this, "Device: " + osdName);
42 private void lInactiveSource_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
44 SetControlVisible(lInactiveSource, false);
45 SetControlVisible(lActiveSource, true);
46 Gui.ActivateSource(Address);
49 private void lStandby_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
51 LinkLabel label = sender as LinkLabel;
52 bool sendPowerOn = label.Text != Lib.ToString(CecPowerStatus.InTransitionStandbyToOn) &&
53 label.Text != Lib.ToString(CecPowerStatus.On);
55 SetControlText(lPowerStatus, Lib.ToString(sendPowerOn ? CecPowerStatus.On : CecPowerStatus.Standby));
57 Gui.SendImageViewOn(Address);
59 Gui.SendStandby(Address);
63 private void button1_Click(object sender, EventArgs e)
65 Gui.UpdateInfoPanel(this);
68 public CecLogicalAddress Address
73 private CecConfigGUI Gui;
74 private LibCecSharp Lib;