Compare commits

...
2 Commits
Author SHA1 Message Date
Vincent Maas bc872606a8 add device filter 2020-12-04 13:53:53 +01:00
Vincent Maas 067b6d7b99 fix crash on startup when scaling is not 100% 2020-11-26 22:30:24 +01:00
9 changed files with 81 additions and 42 deletions

No files matched your search

+1 -1
View File
@@ -27,7 +27,7 @@
<ProductName>ColorControl</ProductName>
<PublisherName>Maassoft</PublisherName>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.3.4.0</ApplicationVersion>
<ApplicationVersion>1.3.6.0</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<PublishWizardCompleted>true</PublishWizardCompleted>
<BootstrapperEnabled>true</BootstrapperEnabled>
+1 -1
View File
@@ -48,7 +48,7 @@ namespace ColorControl
{
selectionPolicy = (ColorDataSelectionPolicy)Enum.ToObject(typeof(ColorDataSelectionPolicy), value);
}
return new ColorData(format, dynamicRange: dynamicRange, colorimetry: colorimetry, colorDepth: colorDepth, colorSelectionPolicy: selectionPolicy);
return new ColorData(format, dynamicRange: dynamicRange, colorimetry: colorimetry, colorDepth: colorDepth, colorSelectionPolicy: selectionPolicy, desktopColorDepth: ColorDataDesktopDepth.Default);
}
}
}
+1 -3
View File
@@ -18,8 +18,6 @@ namespace ColorControl
{
public static string LgListAppsJson = "listApps.json";
public static string LgDeviceSearchKey = "[LG]";
private static readonly NLog.Logger Logger = NLog.LogManager.GetCurrentClassLogger();
public string FriendlyScreenName { get; private set; }
@@ -88,7 +86,7 @@ namespace ColorControl
public async Task RefreshDevices(bool connect = true)
{
var devices = await Utils.GetPnpDevices(LgDeviceSearchKey);
var devices = await Utils.GetPnpDevices(Config.DeviceSearchKey);
SetDevices(devices);
if (connect && SelectedDevice != null)
{
+3
View File
@@ -14,9 +14,12 @@
public string PreferredMacAddress { get; set; }
public string DeviceSearchKey { get; set; }
public LgServiceConfig()
{
PowerOnDelayAfterResume = 5000;
DeviceSearchKey = "[LG]";
}
}
}
+41 -28
View File
@@ -71,8 +71,8 @@
this.btnDeleteLg = new System.Windows.Forms.Button();
this.cbxLgApps = new System.Windows.Forms.ComboBox();
this.label5 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.edtLgTvName = new System.Windows.Forms.TextBox();
this.lblDeviceFilter = new System.Windows.Forms.Label();
this.edtLgDeviceFilter = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.edtNameLg = new System.Windows.Forms.TextBox();
this.edtStepsLg = new System.Windows.Forms.TextBox();
@@ -104,6 +104,7 @@
this.chkStartMinimized = new System.Windows.Forms.CheckBox();
this.chkStartAfterLogin = new System.Windows.Forms.CheckBox();
this.tabLog = new System.Windows.Forms.TabPage();
this.btnClearLog = new System.Windows.Forms.Button();
this.edtLog = new System.Windows.Forms.TextBox();
this.tabInfo = new System.Windows.Forms.TabPage();
this.grpNVIDIAInfo = new System.Windows.Forms.GroupBox();
@@ -113,7 +114,7 @@
this.lbPlugins = new System.Windows.Forms.ListBox();
this.label7 = new System.Windows.Forms.Label();
this.lblInfo = new System.Windows.Forms.Label();
this.btnClearLog = new System.Windows.Forms.Button();
this.btnLgDeviceFilterRefresh = new System.Windows.Forms.Button();
this.tcMain.SuspendLayout();
this.tabNVIDIA.SuspendLayout();
this.mnuNvPresets.SuspendLayout();
@@ -442,6 +443,7 @@
//
// tabLG
//
this.tabLG.Controls.Add(this.btnLgDeviceFilterRefresh);
this.tabLG.Controls.Add(this.clbLgPower);
this.tabLG.Controls.Add(this.btnLgAddButton);
this.tabLG.Controls.Add(this.label3);
@@ -451,8 +453,8 @@
this.tabLG.Controls.Add(this.btnDeleteLg);
this.tabLG.Controls.Add(this.cbxLgApps);
this.tabLG.Controls.Add(this.label5);
this.tabLG.Controls.Add(this.label4);
this.tabLG.Controls.Add(this.edtLgTvName);
this.tabLG.Controls.Add(this.lblDeviceFilter);
this.tabLG.Controls.Add(this.edtLgDeviceFilter);
this.tabLG.Controls.Add(this.label1);
this.tabLG.Controls.Add(this.edtNameLg);
this.tabLG.Controls.Add(this.edtStepsLg);
@@ -586,22 +588,22 @@
this.label5.TabIndex = 25;
this.label5.Text = "App:";
//
// label4
// lblDeviceFilter
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(466, 9);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(110, 13);
this.label4.TabIndex = 24;
this.label4.Text = "Friendly screen name:";
this.lblDeviceFilter.AutoSize = true;
this.lblDeviceFilter.Location = new System.Drawing.Point(374, 10);
this.lblDeviceFilter.Name = "lblDeviceFilter";
this.lblDeviceFilter.Size = new System.Drawing.Size(66, 13);
this.lblDeviceFilter.TabIndex = 24;
this.lblDeviceFilter.Text = "Device filter:";
//
// edtLgTvName
// edtLgDeviceFilter
//
this.edtLgTvName.Enabled = false;
this.edtLgTvName.Location = new System.Drawing.Point(579, 6);
this.edtLgTvName.Name = "edtLgTvName";
this.edtLgTvName.Size = new System.Drawing.Size(142, 20);
this.edtLgTvName.TabIndex = 23;
this.edtLgDeviceFilter.Location = new System.Drawing.Point(446, 6);
this.edtLgDeviceFilter.Name = "edtLgDeviceFilter";
this.edtLgDeviceFilter.Size = new System.Drawing.Size(142, 20);
this.edtLgDeviceFilter.TabIndex = 23;
this.edtLgDeviceFilter.TextChanged += new System.EventHandler(this.edtLgDeviceFilter_TextChanged);
//
// label1
//
@@ -962,6 +964,16 @@
this.tabLog.Text = "Log";
this.tabLog.UseVisualStyleBackColor = true;
//
// btnClearLog
//
this.btnClearLog.Location = new System.Drawing.Point(6, 6);
this.btnClearLog.Name = "btnClearLog";
this.btnClearLog.Size = new System.Drawing.Size(75, 23);
this.btnClearLog.TabIndex = 2;
this.btnClearLog.Text = "Clear log";
this.btnClearLog.UseVisualStyleBackColor = true;
this.btnClearLog.Click += new System.EventHandler(this.btnClearLog_Click);
//
// edtLog
//
this.edtLog.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
@@ -1061,15 +1073,15 @@
this.lblInfo.TabIndex = 1;
this.lblInfo.Text = "Info";
//
// btnClearLog
// btnLgDeviceFilterRefresh
//
this.btnClearLog.Location = new System.Drawing.Point(6, 6);
this.btnClearLog.Name = "btnClearLog";
this.btnClearLog.Size = new System.Drawing.Size(75, 23);
this.btnClearLog.TabIndex = 2;
this.btnClearLog.Text = "Clear log";
this.btnClearLog.UseVisualStyleBackColor = true;
this.btnClearLog.Click += new System.EventHandler(this.btnClearLog_Click);
this.btnLgDeviceFilterRefresh.Location = new System.Drawing.Point(594, 5);
this.btnLgDeviceFilterRefresh.Name = "btnLgDeviceFilterRefresh";
this.btnLgDeviceFilterRefresh.Size = new System.Drawing.Size(75, 23);
this.btnLgDeviceFilterRefresh.TabIndex = 35;
this.btnLgDeviceFilterRefresh.Text = "Refresh";
this.btnLgDeviceFilterRefresh.UseVisualStyleBackColor = true;
this.btnLgDeviceFilterRefresh.Click += new System.EventHandler(this.btnLgDeviceFilterRefresh_Click);
//
// MainForm
//
@@ -1153,8 +1165,8 @@
private System.Windows.Forms.TextBox edtNameLg;
private System.Windows.Forms.Button btnNvPresetDelete;
private System.Windows.Forms.Button btnAddModesNv;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox edtLgTvName;
private System.Windows.Forms.Label lblDeviceFilter;
private System.Windows.Forms.TextBox edtLgDeviceFilter;
private System.Windows.Forms.ComboBox cbxLgApps;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.ToolStripMenuItem miNvApply;
@@ -1203,6 +1215,7 @@
private System.Windows.Forms.TabPage tabAMD;
private System.Windows.Forms.Label lblErrorAMD;
private System.Windows.Forms.Button btnClearLog;
private System.Windows.Forms.Button btnLgDeviceFilterRefresh;
}
}
+22 -3
View File
@@ -172,6 +172,7 @@ namespace ColorControl
clbLgPower.SetItemChecked(2, _lgService.Config.PowerOffOnShutdown);
clbLgPower.SetItemChecked(3, _lgService.Config.PowerOffOnStandby);
edtLgPowerOnAfterResumeDelay.Value = _lgService.Config.PowerOnDelayAfterResume;
edtLgDeviceFilter.Text = _lgService.Config.DeviceSearchKey;
}
catch (Exception e)
{
@@ -675,7 +676,7 @@ namespace ColorControl
{
Hide();
}
else if (WindowState == FormWindowState.Normal)
else if (WindowState == FormWindowState.Normal && _config != null)
{
_config.FormWidth = Width;
_config.FormHeight = Height;
@@ -1420,7 +1421,7 @@ namespace ColorControl
var devices = _lgService.Devices;
if (devices == null || !devices.Any())
{
_lgService.RefreshDevices(false).ContinueWith((task) => BeginInvoke(new Action(FillLgDevices)));
RefreshLgDevices();
}
else
{
@@ -1440,6 +1441,7 @@ namespace ColorControl
private void FillLgDevices()
{
cbxLgDevices.Items.Clear();
var devices = _lgService.Devices;
foreach (var device in devices)
{
@@ -1458,7 +1460,6 @@ namespace ColorControl
if (cbxLgApps.Items.Count == 0 && _lgService.SelectedDevice != null)
{
_lgService.RefreshApps().ContinueWith((task) => BeginInvoke(new Action<Task<List<LgApp>>>(FillLgApps), new[] { task }));
edtLgTvName.Text = _lgService.FriendlyScreenName;
}
}
@@ -1890,5 +1891,23 @@ Do you want to continue?";
edtLog.Clear();
}
}
private void edtLgDeviceFilter_TextChanged(object sender, EventArgs e)
{
if (_lgService != null)
{
_lgService.Config.DeviceSearchKey = edtLgDeviceFilter.Text;
}
}
private void btnLgDeviceFilterRefresh_Click(object sender, EventArgs e)
{
RefreshLgDevices();
}
private void RefreshLgDevices()
{
_lgService.RefreshDevices(false).ContinueWith((task) => BeginInvoke(new Action(FillLgDevices)));
}
}
}
+8 -2
View File
@@ -88,8 +88,14 @@ namespace ColorControl
if (preset.applyColorData)
{
var display = GetCurrentDisplay();
//var data = new ColorData(ColorDataFormat.YUV444, ColorDataColorimetry.YCC709, ColorDataDynamicRange.Auto, ColorDataDepth.BPC8, preset.colorData.SelectionPolicy, ColorDataDesktopDepth.Default);
display.DisplayDevice.SetColorData(preset.colorData);
//var data = new ColorData(ColorDataFormat.YUV444, ColorDataColorimetry.Auto, ColorDataDynamicRange.Auto, ColorDataDepth.BPC10, preset.colorData.SelectionPolicy, ColorDataDesktopDepth.Default);
try
{
display.DisplayDevice.SetColorData(preset.colorData);
}
catch (Exception ex)
{
}
//var master = display.DisplayDevice.HDRColorData.MasteringDisplayData;
//var newMaster = new MasteringDisplayColorData(master.FirstColorCoordinate, master.SecondColorCoordinate, master.ThirdColorCoordinate, new ColorDataColorCoordinate(0.25f, 0.25f), 50, 0, 50, 50);
+2 -2
View File
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.3.4.0")]
[assembly: AssemblyFileVersion("1.3.4.0")]
[assembly: AssemblyVersion("1.3.6.0")]
[assembly: AssemblyFileVersion("1.3.6.0")]
+2 -2
View File
@@ -240,7 +240,7 @@ namespace ColorControl
}
else
{
value = objValue.ToString();
value = objValue?.ToString();
}
}
@@ -272,7 +272,7 @@ namespace ColorControl
var ipAddress = GetDeviceProperty(dev2, "System.Devices.IpAddress");
var macAddress = GetDeviceProperty(dev2, PKEY_PNPX_PhysicalAddress);
if (!devices.Any(x => x.Name.Equals(name) && x.IpAddress.Equals(ipAddress)))
if (!devices.Any(x => x.Name.Equals(name) && x.IpAddress != null && x.IpAddress.Equals(ipAddress)))
{
var device = new PnpDev(dev, dev2, name, ipAddress, macAddress);
devices.Add(device);