cec: fixed typo in GetStatus()
[deb_libcec.git] / src / cec-config-gui / DeviceInformation.cs
CommitLineData
96fa7764
LOK
1using System;
2using System.Collections.Generic;
3using System.ComponentModel;
4using System.Data;
5using System.Drawing;
6using System.Text;
7using System.Windows.Forms;
8using CecSharp;
9
10namespace CecConfigGui
11{
75af24f1 12 public partial class DeviceInformation : AsyncForm
96fa7764 13 {
ece1582e 14 public DeviceInformation(CecConfigGUI gui, CecLogicalAddress address, ref LibCecSharp lib,
96fa7764
LOK
15 bool devicePresent, CecVendorId vendor, bool isActiveSource, ushort physicalAddress,
16 CecVersion version, CecPowerStatus power, string osdName, string menuLanguage)
17 {
ece1582e
LOK
18 Gui = gui;
19 Lib = lib;
20 Address = address;
96fa7764
LOK
21 InitializeComponent();
22 this.lDevice.Text = lib.ToString(address);
ece1582e 23 this.lLogicalAddress.Text = String.Format("{0,1:X}", (int)address);
6d866874
LOK
24 Update(devicePresent, vendor, isActiveSource, physicalAddress, version, power, osdName, menuLanguage);
25 }
26
27 public void Update(bool devicePresent, CecVendorId vendor, bool isActiveSource, ushort physicalAddress,
28 CecVersion version, CecPowerStatus power, string osdName, string menuLanguage)
29 {
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);
96fa7764 40 }
ece1582e 41
ece1582e
LOK
42 private void lInactiveSource_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
43 {
44 SetControlVisible(lInactiveSource, false);
45 SetControlVisible(lActiveSource, true);
46 Gui.ActivateSource(Address);
47 }
48
ece1582e
LOK
49 private void lStandby_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
50 {
51 LinkLabel label = sender as LinkLabel;
52 bool sendPowerOn = label.Text != Lib.ToString(CecPowerStatus.InTransitionStandbyToOn) &&
53 label.Text != Lib.ToString(CecPowerStatus.On);
54
55 SetControlText(lPowerStatus, Lib.ToString(sendPowerOn ? CecPowerStatus.On : CecPowerStatus.Standby));
56 if (sendPowerOn)
57 Gui.SendImageViewOn(Address);
58 else
59 Gui.SendStandby(Address);
60 }
61
6d866874
LOK
62
63 private void button1_Click(object sender, EventArgs e)
64 {
65 Gui.UpdateInfoPanel(this);
66 }
67
68 public CecLogicalAddress Address
69 {
70 private set;
71 get;
72 }
ece1582e
LOK
73 private CecConfigGUI Gui;
74 private LibCecSharp Lib;
96fa7764
LOK
75 }
76}