SetControlText(tbPhysicalAddress, string.Format("{0,4:X}", updateEvent.IntValue));
break;
case UpdateEventType.ProgressBar:
+ SetControlVisible(pProgress, true);
SetProgressValue(pProgress, updateEvent.IntValue);
break;
case UpdateEventType.TVVendorId:
UpdatingInfoPanel.SetControlEnabled(UpdatingInfoPanel.bUpdate, true);
UpdatingInfoPanel = null;
}
+ SetControlVisible(pProgress, false);
break;
}
}
private void SetControlsEnabled(bool val)
{
- SetControlEnabled(cbPortNumber, val);
- SetControlEnabled(cbConnectedDevice, cbConnectedDevice.Items.Count > 1 ? val : false);
- SetControlEnabled(tbPhysicalAddress, val);
+ SetControlEnabled(cbPortNumber, val && !Config.AutodetectAddress);
+ SetControlEnabled(cbConnectedDevice, cbConnectedDevice.Items.Count > 1 && !Config.AutodetectAddress ? val : false);
+ SetControlEnabled(cbOverrideAddress, val);
+ SetControlEnabled(tbPhysicalAddress, val && !Config.AutodetectAddress && cbOverrideAddress.Checked);
SetControlEnabled(cbDeviceType, val);
SetControlEnabled(cbUseTVMenuLanguage, val);
SetControlEnabled(cbActivateSource, val);
}
}
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing)
+ {
+ Lib.DisableCallbacks();
+ Lib.StandbyDevices(CecLogicalAddress.Broadcast);
+ Lib.Close();
+ }
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
#region Actions
public void ReloadXMLConfiguration()
{
public void SetPhysicalAddress(ushort physicalAddress)
{
- if (!SuppressUpdates && ActiveProcess == null)
+ if (!SuppressUpdates && ActiveProcess == null && cbOverrideAddress.Checked)
{
SetControlsEnabled(false);
SetControlText(cbPortNumber, string.Empty);
#endregion
#region Configuration tab
+ private void cbOverrideAddress_CheckedChanged(object sender, EventArgs e)
+ {
+ SetControlEnabled(tbPhysicalAddress, ((CheckBox)sender).Checked);
+ }
+
private void tbPhysicalAddress_TextChanged(object sender, EventArgs e)
{
- if (tbPhysicalAddress.Text.Length != 4)
+ if (tbPhysicalAddress.Text.Length != 4 ||
+ cbOverrideAddress.Checked)
return;
ushort physicalAddress = 0;
if (!ushort.TryParse(tbPhysicalAddress.Text, NumberStyles.AllowHexSpecifier, null, out physicalAddress))
StringBuilder output = new StringBuilder();
output.AppendLine("<settings>");
output.AppendLine("<setting id=\"cec_hdmi_port\" value=\"" + Config.HDMIPort + "\" />");
- output.AppendLine("<setting id=\"connected_device\" value=\"" + (Config.BaseDevice == CecLogicalAddress.AudioSystem ? 5 : 1) + "\" />");
+ output.AppendLine("<setting id=\"connected_device\" value=\"" + (Config.BaseDevice == CecLogicalAddress.AudioSystem ? 5 : 0) + "\" />");
output.AppendLine("<setting id=\"cec_power_on_startup\" value=\"" + (Config.ActivateSource ? 1 : 0) + "\" />");
output.AppendLine("<setting id=\"cec_power_off_shutdown\" value=\"" + (Config.PowerOffDevices.IsSet(CecLogicalAddress.Broadcast) ? 1 : 0) + "\" />");
output.AppendLine("<setting id=\"cec_standby_screensaver\" value=\"" + (Config.PowerOffScreensaver ? 1 : 0) + "\" />");
// only supported by 1.5.0+ clients
output.AppendLine("<!-- the following lines are only supported by v1.5.0+ clients -->");
- output.AppendLine("<setting id=\"physical_address\" value=\"" + string.Format("{0,4:X}", Config.PhysicalAddress) + "\" />");
+ output.AppendLine("<setting id=\"activate_source\" value=\"" + (Config.ActivateSource ? 1 : 0) + "\" />");
+ output.AppendLine("<setting id=\"physical_address\" value=\"" + string.Format("{0,4:X}", cbOverrideAddress.Checked ? Config.PhysicalAddress : 0).Trim() + "\" />");
output.AppendLine("<setting id=\"device_type\" value=\"" + (int)Config.DeviceTypes.Types[0] + "\" />");
output.AppendLine("<setting id=\"tv_vendor\" value=\"" + string.Format("{0,6:X}", (int)Config.TvVendor).Trim() + "\" />");
output.Append("<setting id=\"wake_devices\" value=\"");
+ StringBuilder strWakeDevices = new StringBuilder();
foreach (CecLogicalAddress addr in Config.WakeDevices.Addresses)
if (addr != CecLogicalAddress.Unknown)
- output.Append(" " + (int)addr);
+ strWakeDevices.Append(" " + (int)addr);
+ output.Append(strWakeDevices.ToString().Trim());
output.AppendLine("\" />");
output.Append("<setting id=\"standby_devices\" value=\"");
+ StringBuilder strSleepDevices = new StringBuilder();
foreach (CecLogicalAddress addr in Config.PowerOffDevices.Addresses)
if (addr != CecLogicalAddress.Unknown)
- output.Append(" " + (int)addr);
+ strSleepDevices.Append(" " + (int)addr);
+ output.Append(strSleepDevices.ToString().Trim());
output.AppendLine("\" />");
output.AppendLine("</settings>");
if (!SuppressUpdates && ActiveProcess == null)
{
SetControlsEnabled(false);
- ActiveProcess = new RescanDevices();
+ ActiveProcess = new RescanDevices(ref Lib);
ActiveProcess.EventHandler += new EventHandler<UpdateEvent>(ProcessEventHandler);
(new Thread(new ThreadStart(ActiveProcess.Run))).Start();
}
SetCheckboxItemChecked(cbWakeDevices, iPtr, Config.WakeDevices.IsSet((CecLogicalAddress)iPtr));
for (int iPtr = 0; iPtr < 15; iPtr++)
SetCheckboxItemChecked(cbPowerOffDevices, iPtr, Config.PowerOffDevices.IsSet((CecLogicalAddress)iPtr));
+
+ SetControlText(this, "Pulse-Eight USB-CEC Adapter - libCEC " + Lib.ToString(Config.ServerVersion));
return 1;
}