2 using LibCECTray.Properties;
5 namespace LibCECTray.controller.actions
7 class ShowDeviceInfo : UpdateProcess
9 public ShowDeviceInfo(CECController controller, LibCecSharp lib, CecLogicalAddress address)
11 _controller = controller;
16 public virtual void ShowDialog(CecLogicalAddress address, ref LibCecSharp lib,
17 bool devicePresent, CecVendorId vendor, bool isActiveSource, ushort physicalAddress,
18 CecVersion version, CecPowerStatus power, string osdName, string menuLanguage)
20 DeviceInformation di = new DeviceInformation(_controller, _address, ref _lib, devicePresent, vendor, isActiveSource, physicalAddress, version, power, osdName, menuLanguage);
21 _controller.DisplayDialog(di, false);
24 public override void Process()
26 CecVendorId vendor = CecVendorId.Unknown;
27 bool isActiveSource = false;
28 ushort physicalAddress = 0xFFFF;
29 CecVersion version = CecVersion.Unknown;
30 CecPowerStatus power = CecPowerStatus.Unknown;
31 string osdName = Resources.unknown;
32 string menuLanguage = Resources.unknown;
34 SendEvent(UpdateEventType.StatusText, string.Format(Resources.action_check_device_present, _lib.ToString(_address)));
35 SendEvent(UpdateEventType.ProgressBar, 10);
37 bool devicePresent = _lib.IsActiveDevice(_address);
40 SendEvent(UpdateEventType.StatusText, Resources.action_requesting_vendor_id);
41 SendEvent(UpdateEventType.ProgressBar, 20);
42 vendor = _lib.GetDeviceVendorId(_address);
44 SendEvent(UpdateEventType.StatusText, Resources.action_requesting_active_source_state);
45 SendEvent(UpdateEventType.ProgressBar, 30);
46 isActiveSource = _lib.IsActiveSource(_address);
48 SendEvent(UpdateEventType.StatusText, Resources.action_requesting_physical_address);
49 SendEvent(UpdateEventType.ProgressBar, 40);
50 physicalAddress = _lib.GetDevicePhysicalAddress(_address);
52 SendEvent(UpdateEventType.StatusText, Resources.action_requesting_cec_version);
53 SendEvent(UpdateEventType.ProgressBar, 50);
54 version = _lib.GetDeviceCecVersion(_address);
56 SendEvent(UpdateEventType.StatusText, Resources.action_requesting_power_status);
57 SendEvent(UpdateEventType.ProgressBar, 60);
58 power = _lib.GetDevicePowerStatus(_address);
60 SendEvent(UpdateEventType.StatusText, Resources.action_requesting_osd_name);
61 SendEvent(UpdateEventType.ProgressBar, 70);
62 osdName = _lib.GetDeviceOSDName(_address);
64 SendEvent(UpdateEventType.StatusText, Resources.action_requesting_menu_language);
65 SendEvent(UpdateEventType.ProgressBar, 80);
66 menuLanguage = _lib.GetDeviceMenuLanguage(_address);
69 SendEvent(UpdateEventType.StatusText, Resources.action_showing_device_information);
70 SendEvent(UpdateEventType.ProgressBar, 90);
71 SendEvent(UpdateEventType.ProcessCompleted, true);
73 ShowDialog(_address, ref _lib, devicePresent, vendor, isActiveSource, physicalAddress, version, power, osdName, menuLanguage);
75 SendEvent(UpdateEventType.StatusText, Resources.ready);
76 SendEvent(UpdateEventType.ProgressBar, 100);
79 private readonly CECController _controller;
80 private LibCecSharp _lib;
81 private readonly CecLogicalAddress _address;