Commit | Line | Data |
---|---|---|
96fa7764 LOK |
1 | using System; |
2 | using System.Collections.Generic; | |
3 | using System.ComponentModel; | |
4 | using System.Data; | |
5 | using System.Drawing; | |
6 | using System.Text; | |
7 | using System.Windows.Forms; | |
8 | using CecSharp; | |
9 | ||
10 | namespace 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 LOK |
23 | this.lLogicalAddress.Text = String.Format("{0,1:X}", (int)address); |
24 | this.lPhysicalAddress.Text = String.Format("{0,4:X}", physicalAddress); | |
96fa7764 | 25 | this.lDevicePresent.Text = devicePresent ? "yes" : "no"; |
ece1582e LOK |
26 | this.lActiveSource.Visible = isActiveSource; |
27 | this.lInactiveSource.Visible = !isActiveSource; | |
28 | this.lVendor.Text = vendor != CecVendorId.Unknown ? lib.ToString(vendor) : "unknown"; | |
96fa7764 LOK |
29 | this.lCecVersion.Text = lib.ToString(version); |
30 | this.lPowerStatus.Text = lib.ToString(power); | |
ece1582e | 31 | bool isPoweredOn = (power == CecPowerStatus.On || power == CecPowerStatus.InTransitionStandbyToOn); |
96fa7764 LOK |
32 | this.lOsdName.Text = osdName; |
33 | this.lMenuLanguage.Text = menuLanguage; | |
ece1582e | 34 | this.Text = "Device: " + osdName; |
96fa7764 | 35 | } |
ece1582e | 36 | |
ece1582e LOK |
37 | private void lInactiveSource_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) |
38 | { | |
39 | SetControlVisible(lInactiveSource, false); | |
40 | SetControlVisible(lActiveSource, true); | |
41 | Gui.ActivateSource(Address); | |
42 | } | |
43 | ||
ece1582e LOK |
44 | private void lStandby_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) |
45 | { | |
46 | LinkLabel label = sender as LinkLabel; | |
47 | bool sendPowerOn = label.Text != Lib.ToString(CecPowerStatus.InTransitionStandbyToOn) && | |
48 | label.Text != Lib.ToString(CecPowerStatus.On); | |
49 | ||
50 | SetControlText(lPowerStatus, Lib.ToString(sendPowerOn ? CecPowerStatus.On : CecPowerStatus.Standby)); | |
51 | if (sendPowerOn) | |
52 | Gui.SendImageViewOn(Address); | |
53 | else | |
54 | Gui.SendStandby(Address); | |
55 | } | |
56 | ||
57 | private CecLogicalAddress Address; | |
58 | private CecConfigGUI Gui; | |
59 | private LibCecSharp Lib; | |
96fa7764 LOK |
60 | } |
61 | } |