public virtual void ShowDialog(CecLogicalAddress address, ref LibCecSharp lib, bool devicePresent, CecVendorId vendor, bool isActiveSource, ushort physicalAddress, CecVersion version, CecPowerStatus power, string osdName, string menuLanguage) { DeviceInformation di = new DeviceInformation(_controller, _address, ref _lib, devicePresent, vendor, isActiveSource, physicalAddress, version, power, osdName, menuLanguage); _controller.DisplayDialog(di, false); }
public UpdateDeviceInfo(CECController controller, LibCecSharp lib, DeviceInformation dialog) : base(controller, lib, dialog.Address) { _dialog = dialog; }
/// <summary> /// Updates the contents of a device information window /// </summary> /// <param name="panel">The panel to update</param> public void UpdateInfoPanel(DeviceInformation panel) { if (SuppressUpdates || _activeProcess != null) return; _controller.SetControlsEnabled(false); _updatingInfoPanel = panel; panel.SetControlEnabled(panel.bUpdate, false); _activeProcess = new UpdateDeviceInfo(_controller, _controller.Lib, panel); _activeProcess.EventHandler += ProcessEventHandler; (new Thread(_activeProcess.Run)).Start(); }
/// <summary> /// Event handler for processing updates for a background thread /// </summary> /// <param name="src">The source that sent the event</param> /// <param name="updateEvent">The type of event</param> private void ProcessEventHandler(object src, UpdateEvent updateEvent) { switch (updateEvent.Type) { case UpdateEventType.StatusText: _controller.SetStatusText(updateEvent.StringValue); break; case UpdateEventType.ProgressBar: _controller.SetProgressBar(updateEvent.IntValue, true); break; case UpdateEventType.PhysicalAddress: _controller.Settings.PhysicalAddress.Value = (ushort)updateEvent.IntValue; break; case UpdateEventType.TVVendorId: _controller.Settings.SetVendorName(CecLogicalAddress.Tv, (CecVendorId)updateEvent.IntValue, _controller.Lib.ToString((CecVendorId)updateEvent.IntValue)); break; case UpdateEventType.BaseDevice: _controller.Settings.ConnectedDevice.Value = (CecLogicalAddress)updateEvent.IntValue; break; case UpdateEventType.HDMIPort: _controller.Settings.HDMIPort.Value = (byte)updateEvent.IntValue; break; case UpdateEventType.HasAVRDevice: CecLogicalAddresses allowedMask = new CecLogicalAddresses(); allowedMask.Set(CecLogicalAddress.Tv); if (updateEvent.BoolValue) allowedMask.Set(CecLogicalAddress.AudioSystem); _controller.Settings.ConnectedDevice.AllowedAddressMask = allowedMask; break; case UpdateEventType.AVRVendorId: _controller.Settings.SetVendorName(CecLogicalAddress.AudioSystem, (CecVendorId)updateEvent.IntValue, _controller.Lib.ToString((CecVendorId)updateEvent.IntValue)); break; case UpdateEventType.Configuration: SuppressUpdates = true; _controller.ConfigurationChanged(updateEvent.ConfigValue); SuppressUpdates = false; break; case UpdateEventType.PollDevices: _controller.CheckActiveDevices(); break; case UpdateEventType.ProcessCompleted: if (!(_activeProcess is GetCurrentPhysicalAddress)) { _activeProcess = new GetCurrentPhysicalAddress(_controller.Lib); _activeProcess.EventHandler += ProcessEventHandler; (new Thread(_activeProcess.Run)).Start(); } else { _activeProcess = null; } if (_updatingInfoPanel != null) { _updatingInfoPanel.SetControlEnabled(_updatingInfoPanel.bUpdate, true); _updatingInfoPanel = null; } _controller.SetControlsEnabled(true); _controller.SetProgressBar(100, false); if (_controller.Settings.StartHidden.Value) { _controller.SetShowInTaskbar(false); //SetToolStripMenuText(tsMenuShowHide, Resources.show); _controller.Hide(true); } break; case UpdateEventType.ExitApplication: _activeProcess = null; Application.Exit(); break; } }