implemented lazy loading of Info panel, fixed some Nvidia issues, add support for 2022 series OLED full service menu activation

This commit is contained in:
Vincent Maas committed 2023-12-09 14:26:26 +01:00
1 parent bc565abd38
commit 6b3b0b4b17
14 files changed
+399 -160

No files matched your search

+5 -2
View File
@@ -18,8 +18,8 @@
<PublisherName>Maassoft</PublisherName>
<Company>Maassoft</Company>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>9.7.1.0</ApplicationVersion>
<Version>9.7.1.0</Version>
<ApplicationVersion>9.7.2.0</ApplicationVersion>
<Version>9.7.2.0</Version>
<UseApplicationTrust>false</UseApplicationTrust>
<PublishWizardCompleted>true</PublishWizardCompleted>
<BootstrapperEnabled>false</BootstrapperEnabled>
@@ -58,6 +58,9 @@
<Compile Update="Forms\ElevatedForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Update="Forms\InfoPanel.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Update="Services\Common\QuickAccessForm.cs">
<SubType>Form</SubType>
</Compile>
+119
View File
@@ -0,0 +1,119 @@
namespace ColorControl.Forms
{
partial class InfoPanel
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
wvInfo = new Microsoft.Web.WebView2.WinForms.WebView2();
grpInfo = new System.Windows.Forms.GroupBox();
lbPlugins = new System.Windows.Forms.ListBox();
label7 = new System.Windows.Forms.Label();
lblInfo = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)wvInfo).BeginInit();
grpInfo.SuspendLayout();
SuspendLayout();
//
// wvInfo
//
wvInfo.AllowExternalDrop = true;
wvInfo.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
wvInfo.CreationProperties = null;
wvInfo.DefaultBackgroundColor = System.Drawing.Color.White;
wvInfo.Location = new System.Drawing.Point(433, 3);
wvInfo.Name = "wvInfo";
wvInfo.Size = new System.Drawing.Size(671, 526);
wvInfo.Source = new System.Uri("https://github.com/Maassoft/ColorControl/releases", System.UriKind.Absolute);
wvInfo.TabIndex = 8;
wvInfo.ZoomFactor = 1D;
//
// grpInfo
//
grpInfo.Controls.Add(lbPlugins);
grpInfo.Controls.Add(label7);
grpInfo.Controls.Add(lblInfo);
grpInfo.Location = new System.Drawing.Point(4, 3);
grpInfo.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
grpInfo.Name = "grpInfo";
grpInfo.Padding = new System.Windows.Forms.Padding(4, 3, 4, 3);
grpInfo.Size = new System.Drawing.Size(422, 336);
grpInfo.TabIndex = 7;
grpInfo.TabStop = false;
grpInfo.Text = "Info";
//
// lbPlugins
//
lbPlugins.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
lbPlugins.FormattingEnabled = true;
lbPlugins.HorizontalScrollbar = true;
lbPlugins.ItemHeight = 15;
lbPlugins.Location = new System.Drawing.Point(11, 77);
lbPlugins.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
lbPlugins.Name = "lbPlugins";
lbPlugins.Size = new System.Drawing.Size(403, 244);
lbPlugins.TabIndex = 3;
//
// label7
//
label7.AutoSize = true;
label7.Location = new System.Drawing.Point(8, 59);
label7.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
label7.Name = "label7";
label7.Size = new System.Drawing.Size(267, 15);
label7.TabIndex = 2;
label7.Text = "This app contains the following 3rd party plugins:";
//
// lblInfo
//
lblInfo.AutoSize = true;
lblInfo.Location = new System.Drawing.Point(8, 23);
lblInfo.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
lblInfo.Name = "lblInfo";
lblInfo.Size = new System.Drawing.Size(28, 15);
lblInfo.TabIndex = 1;
lblInfo.Text = "Info";
//
// InfoPanel
//
Controls.Add(wvInfo);
Controls.Add(grpInfo);
Name = "InfoPanel";
Size = new System.Drawing.Size(1110, 534);
((System.ComponentModel.ISupportInitialize)wvInfo).EndInit();
grpInfo.ResumeLayout(false);
grpInfo.PerformLayout();
ResumeLayout(false);
}
#endregion
private Microsoft.Web.WebView2.WinForms.WebView2 wvInfo;
private System.Windows.Forms.GroupBox grpInfo;
private System.Windows.Forms.ListBox lbPlugins;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label lblInfo;
}
}
+56
View File
@@ -0,0 +1,56 @@
using ColorControl.Shared.Forms;
using ColorControl.Shared.Services;
using System.Diagnostics;
using System.Windows.Forms;
namespace ColorControl.Forms
{
public partial class InfoPanel : UserControl
{
private readonly WinApiService _winApiService;
private bool _initialized;
public InfoPanel(WinApiService winApiService)
{
_winApiService = winApiService;
InitializeComponent();
_initialized = true;
if (DarkModeUtils.UseDarkMode)
{
grpInfo.ForeColor = FormUtils.CurrentForeColor;
}
Init();
}
private void Init()
{
var currentVersionInfo = FileVersionInfo.GetVersionInfo(Application.ExecutablePath);
Text = Application.ProductName + " " + Application.ProductVersion;
if (_winApiService.IsAdministrator())
{
Text += " (administrator)";
}
lblInfo.Text = Text + " - " + currentVersionInfo.LegalCopyright;
lbPlugins.Items.Add("lgtv.net by gr4b4z");
lbPlugins.Items.Add("Newtonsoft.Json by James Newton-King");
lbPlugins.Items.Add("NLog by Jarek Kowalski, Kim Christensen, Julian Verdurmen");
lbPlugins.Items.Add("NvAPIWrapper.Net by Soroush Falahati");
lbPlugins.Items.Add("NWin32 by zmjack");
lbPlugins.Items.Add("TaskScheduler by David Hall");
lbPlugins.Items.Add("NVIDIA Profile Inspector by Orbmu2k");
lbPlugins.Items.Add("NvidiaML wrapper by LibreHardwareMonitor");
lbPlugins.Items.Add("Novideo sRGB by ledoge");
lbPlugins.Items.Add("NLogViewer by dojo90");
lbPlugins.Items.Add("WPFDarkTheme by AngryCarrot789");
}
}
}
+120
View File
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
+4 -82
View File
@@ -59,20 +59,12 @@
chkStartMinimized = new System.Windows.Forms.CheckBox();
chkStartAfterLogin = new System.Windows.Forms.CheckBox();
tabInfo = new System.Windows.Forms.TabPage();
webView21 = new Microsoft.Web.WebView2.WinForms.WebView2();
groupBox3 = new System.Windows.Forms.GroupBox();
lbPlugins = new System.Windows.Forms.ListBox();
label7 = new System.Windows.Forms.Label();
lblInfo = new System.Windows.Forms.Label();
btnUpdate = new System.Windows.Forms.Button();
tcMain.SuspendLayout();
tabOptions.SuspendLayout();
grpOptionsModules.SuspendLayout();
grpMiscellaneousOptions.SuspendLayout();
grpGeneralOptions.SuspendLayout();
tabInfo.SuspendLayout();
((System.ComponentModel.ISupportInitialize)webView21).BeginInit();
groupBox3.SuspendLayout();
SuspendLayout();
//
// tcMain
@@ -110,7 +102,7 @@
grpOptionsModules.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
grpOptionsModules.Name = "grpOptionsModules";
grpOptionsModules.Padding = new System.Windows.Forms.Padding(4, 3, 4, 3);
grpOptionsModules.Size = new System.Drawing.Size(522, 131);
grpOptionsModules.Size = new System.Drawing.Size(658, 131);
grpOptionsModules.TabIndex = 11;
grpOptionsModules.TabStop = false;
grpOptionsModules.Text = "Modules";
@@ -147,7 +139,7 @@
grpMiscellaneousOptions.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
grpMiscellaneousOptions.Name = "grpMiscellaneousOptions";
grpMiscellaneousOptions.Padding = new System.Windows.Forms.Padding(4, 3, 4, 3);
grpMiscellaneousOptions.Size = new System.Drawing.Size(522, 131);
grpMiscellaneousOptions.Size = new System.Drawing.Size(658, 131);
grpMiscellaneousOptions.TabIndex = 5;
grpMiscellaneousOptions.TabStop = false;
grpMiscellaneousOptions.Text = "Miscellaneous";
@@ -229,7 +221,7 @@
grpGeneralOptions.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
grpGeneralOptions.Name = "grpGeneralOptions";
grpGeneralOptions.Padding = new System.Windows.Forms.Padding(4, 3, 4, 3);
grpGeneralOptions.Size = new System.Drawing.Size(522, 211);
grpGeneralOptions.Size = new System.Drawing.Size(662, 211);
grpGeneralOptions.TabIndex = 2;
grpGeneralOptions.TabStop = false;
grpGeneralOptions.Text = "General";
@@ -283,7 +275,7 @@
// btnStartStopService
//
btnStartStopService.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right;
btnStartStopService.Location = new System.Drawing.Point(474, 129);
btnStartStopService.Location = new System.Drawing.Point(614, 129);
btnStartStopService.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
btnStartStopService.Name = "btnStartStopService";
btnStartStopService.Size = new System.Drawing.Size(40, 27);
@@ -439,8 +431,6 @@
//
// tabInfo
//
tabInfo.Controls.Add(webView21);
tabInfo.Controls.Add(groupBox3);
tabInfo.Location = new System.Drawing.Point(4, 24);
tabInfo.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
tabInfo.Name = "tabInfo";
@@ -450,65 +440,6 @@
tabInfo.Text = "Info";
tabInfo.UseVisualStyleBackColor = true;
//
// webView21
//
webView21.AllowExternalDrop = true;
webView21.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
webView21.CreationProperties = null;
webView21.DefaultBackgroundColor = System.Drawing.Color.White;
webView21.Location = new System.Drawing.Point(436, 7);
webView21.Name = "webView21";
webView21.Size = new System.Drawing.Size(671, 526);
webView21.Source = new System.Uri("https://github.com/Maassoft/ColorControl/releases", System.UriKind.Absolute);
webView21.TabIndex = 6;
webView21.ZoomFactor = 1D;
//
// groupBox3
//
groupBox3.Controls.Add(lbPlugins);
groupBox3.Controls.Add(label7);
groupBox3.Controls.Add(lblInfo);
groupBox3.Location = new System.Drawing.Point(7, 7);
groupBox3.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
groupBox3.Name = "groupBox3";
groupBox3.Padding = new System.Windows.Forms.Padding(4, 3, 4, 3);
groupBox3.Size = new System.Drawing.Size(422, 271);
groupBox3.TabIndex = 5;
groupBox3.TabStop = false;
groupBox3.Text = "Info";
//
// lbPlugins
//
lbPlugins.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
lbPlugins.FormattingEnabled = true;
lbPlugins.HorizontalScrollbar = true;
lbPlugins.ItemHeight = 15;
lbPlugins.Location = new System.Drawing.Point(10, 77);
lbPlugins.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
lbPlugins.Name = "lbPlugins";
lbPlugins.Size = new System.Drawing.Size(405, 184);
lbPlugins.TabIndex = 3;
//
// label7
//
label7.AutoSize = true;
label7.Location = new System.Drawing.Point(7, 59);
label7.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
label7.Name = "label7";
label7.Size = new System.Drawing.Size(267, 15);
label7.TabIndex = 2;
label7.Text = "This app contains the following 3rd party plugins:";
//
// lblInfo
//
lblInfo.AutoSize = true;
lblInfo.Location = new System.Drawing.Point(7, 23);
lblInfo.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
lblInfo.Name = "lblInfo";
lblInfo.Size = new System.Drawing.Size(28, 15);
lblInfo.TabIndex = 1;
lblInfo.Text = "Info";
//
// btnUpdate
//
btnUpdate.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right;
@@ -555,10 +486,6 @@
grpMiscellaneousOptions.PerformLayout();
grpGeneralOptions.ResumeLayout(false);
grpGeneralOptions.PerformLayout();
tabInfo.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)webView21).EndInit();
groupBox3.ResumeLayout(false);
groupBox3.PerformLayout();
ResumeLayout(false);
}
@@ -570,10 +497,6 @@
private System.Windows.Forms.CheckBox chkStartMinimized;
private System.Windows.Forms.CheckBox chkStartAfterLogin;
private System.Windows.Forms.TabPage tabInfo;
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.ListBox lbPlugins;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label lblInfo;
private System.Windows.Forms.GroupBox grpMiscellaneousOptions;
private System.Windows.Forms.CheckBox chkFixChromeFonts;
private System.Windows.Forms.Label lblFixChromeFontsDescription;
@@ -599,7 +522,6 @@
private System.Windows.Forms.CheckBox chkOptionsUseDarkMode;
private System.Windows.Forms.Button btnOptionsAdvanced;
private System.Windows.Forms.Button btnOptionsLog;
private Microsoft.Web.WebView2.WinForms.WebView2 webView21;
}
}
+19 -29
View File
@@ -1,4 +1,5 @@
using ColorControl.Services.AMD;
using ColorControl.Forms;
using ColorControl.Services.AMD;
using ColorControl.Services.Common;
using ColorControl.Services.EventDispatcher;
using ColorControl.Services.GameLauncher;
@@ -151,7 +152,6 @@ namespace ColorControl
InitShortcut(SHORTCUTID_SCREENSAVER, _config.ScreenSaverShortcut, StartScreenSaver);
InitModules();
InitInfo();
UpdateServiceInfo();
_screenStateNotify = WinApi.RegisterPowerSettingNotification(Handle, ref Utils.GUID_CONSOLE_DISPLAY_STATE, 0);
@@ -387,32 +387,6 @@ namespace ColorControl
}
}
private void InitInfo()
{
_currentVersionInfo = FileVersionInfo.GetVersionInfo(Application.ExecutablePath);
Text = Application.ProductName + " " + Application.ProductVersion;
if (_winApiService.IsAdministrator())
{
Text += " (administrator)";
}
lblInfo.Text = Text + " - " + _currentVersionInfo.LegalCopyright;
lbPlugins.Items.Add("lgtv.net by gr4b4z");
lbPlugins.Items.Add("Newtonsoft.Json by James Newton-King");
lbPlugins.Items.Add("NLog by Jarek Kowalski, Kim Christensen, Julian Verdurmen");
lbPlugins.Items.Add("NvAPIWrapper.Net by Soroush Falahati");
lbPlugins.Items.Add("NWin32 by zmjack");
lbPlugins.Items.Add("TaskScheduler by David Hall");
lbPlugins.Items.Add("NVIDIA Profile Inspector by Orbmu2k");
lbPlugins.Items.Add("NvidiaML wrapper by LibreHardwareMonitor");
lbPlugins.Items.Add("Novideo sRGB by ledoge");
lbPlugins.Items.Add("NLogViewer by dojo90");
lbPlugins.Items.Add("WPFDarkTheme by AngryCarrot789");
}
private void OpenForm(object sender, EventArgs e)
{
Show();
@@ -770,6 +744,7 @@ NOTE: installing the service may cause a User Account Control popup.");
{
if (tcMain.SelectedTab == tabInfo)
{
InitInfoTab();
}
else if (tcMain.SelectedTab == tabOptions)
{
@@ -811,6 +786,21 @@ NOTE: installing the service may cause a User Account Control popup.");
UpdateServiceInfo();
}
private void InitInfoTab()
{
if (tabInfo.Controls.Count > 0)
{
return;
}
var control = _serviceProvider.GetRequiredService<InfoPanel>();
control.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
tabInfo.Controls.Add(control);
control.Size = tabInfo.ClientSize;
//control.BackColor = SystemColors.Window;
}
private void UpdateTrayMenu(ToolStripMenuItem menu, IEnumerable<PresetBase> presets, EventHandler eventHandler)
{
menu.DropDownItems.Clear();
@@ -1291,7 +1281,7 @@ Currently ColorControl is {(_winApiService.IsAdministrator() ? "" : "not ")}runn
//InstallUpdate("");
//await Test();
_serviceManager.NvService.TestResolution();
//_serviceManager.NvService.TestResolution();
}
private async Task Test()
+1 -3
View File
@@ -59,9 +59,6 @@ namespace ColorControl
{
DataDir = Utils.GetDataPath();
//Utils.UpdateFiles(@"H:\temp\ColorControl\ColorControl", @"C:\Users\vinni\source\repos\ColorControl\ColorControl\bin\Debug\net6.0-windows10.0.20348.0");
//Utils.UnZipFile(@"H:\temp\ColorControl\ColorControl.zip", @"H:\temp\ColorControl\temp");
var runAsService = args.Contains("--service") || WinApiService.IsAdministratorStatic() && Process.GetCurrentProcess().Parent()?.ProcessName?.Equals("services", StringComparison.InvariantCultureIgnoreCase) == true;
var runElevated = args.Contains("--elevated");
@@ -260,6 +257,7 @@ namespace ColorControl
services.AddSingleton<ElevatedForm>();
services.AddSingleton<LogWindow>();
services.AddSingleton<RestartDetector>();
services.AddSingleton<InfoPanel>();
});
}
private static async Task RunService(string[] args)
@@ -1,5 +1,6 @@
using ColorControl.Shared.Common;
using ColorControl.Shared.Contracts;
using NStandard;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@@ -124,6 +125,7 @@ namespace ColorControl.Services.Common
public List<PresetTrigger> Triggers { get; set; }
public string Description { get; set; }
public bool ShowInQuickAccess { get; set; }
public string IdOrName => name.IsNullOrEmpty() ? _id.ToString() : name;
private int _id;
+5 -5
View File
@@ -389,14 +389,14 @@
mnuLgExpert.ImageScalingSize = new System.Drawing.Size(20, 20);
mnuLgExpert.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { mnuLgOLEDMotionPro, mnuLgSetSvcMenuFlag, miLgExpertSeparator1 });
mnuLgExpert.Name = "mnuLgButtons";
mnuLgExpert.Size = new System.Drawing.Size(321, 76);
mnuLgExpert.Size = new System.Drawing.Size(328, 76);
mnuLgExpert.Opening += mnuLgExpert_Opening;
//
// mnuLgOLEDMotionPro
//
mnuLgOLEDMotionPro.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { miLgEnableMotionPro, miLgDisableMotionPro });
mnuLgOLEDMotionPro.Name = "mnuLgOLEDMotionPro";
mnuLgOLEDMotionPro.Size = new System.Drawing.Size(320, 22);
mnuLgOLEDMotionPro.Size = new System.Drawing.Size(327, 22);
mnuLgOLEDMotionPro.Text = "Activate OLED Motion Pro (B9/C9/E9/W9 only)";
//
// miLgEnableMotionPro
@@ -417,8 +417,8 @@
//
mnuLgSetSvcMenuFlag.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { miLgFullServiceMenuEnable, miLgFullServiceMenuDisable });
mnuLgSetSvcMenuFlag.Name = "mnuLgSetSvcMenuFlag";
mnuLgSetSvcMenuFlag.Size = new System.Drawing.Size(320, 22);
mnuLgSetSvcMenuFlag.Text = "Enable Full Service Menu (B3/C3/G3 only)";
mnuLgSetSvcMenuFlag.Size = new System.Drawing.Size(327, 22);
mnuLgSetSvcMenuFlag.Text = "Enable Full Service Menu (2022/2023 OLED only)";
//
// miLgFullServiceMenuEnable
//
@@ -437,7 +437,7 @@
// miLgExpertSeparator1
//
miLgExpertSeparator1.Name = "miLgExpertSeparator1";
miLgExpertSeparator1.Size = new System.Drawing.Size(317, 6);
miLgExpertSeparator1.Size = new System.Drawing.Size(324, 6);
//
// chkLgRemoteControlShow
//
+1 -1
View File
@@ -829,7 +829,7 @@ Do you want to continue?"
mnuLgOLEDMotionPro.Visible = visible;
miLgEnableMotionPro.Visible = enableVisible;
var svcMenuFlagVisible = new[] { "B3", "C3", "G3" }.Any(m => device?.ModelName?.Contains(m) == true);
var svcMenuFlagVisible = new[] { "B2", "C2", "G2", "B3", "C3", "G3" }.Any(m => device?.ModelName?.Contains(m) == true);
mnuLgSetSvcMenuFlag.Visible = svcMenuFlagVisible;
+15 -23
View File
@@ -1819,31 +1819,23 @@ namespace ColorControl.Services.NVIDIA
var presetIdOrName = !string.IsNullOrEmpty(startUpParams.NvidiaPresetIdOrName) ? startUpParams.NvidiaPresetIdOrName : _config.NvPresetId_ApplyOnStartup.ToString();
if (!string.IsNullOrEmpty(presetIdOrName))
if (string.IsNullOrEmpty(presetIdOrName))
{
var preset = _nvService?.GetPresetByIdOrName(presetIdOrName);
if (preset == null)
{
if (string.IsNullOrEmpty(startUpParams.NvidiaPresetIdOrName))
{
_config.NvPresetId_ApplyOnStartup = 0;
}
}
else if (_nvService != null)
{
if (_nvService.HasDisplaysAttached())
{
await ApplyNvPreset(preset);
return;
}
attempts--;
if (attempts > 0)
{
await Task.Delay(2000);
await ApplyNvPresetOnStartup(attempts);
}
}
return;
}
var preset = _nvService?.GetPresetByIdOrName(presetIdOrName);
if (preset == null)
{
if (string.IsNullOrEmpty(startUpParams.NvidiaPresetIdOrName))
{
_config.NvPresetId_ApplyOnStartup = 0;
}
return;
}
preset.IsStartupPreset = true;
await ApplyNvPreset(preset);
}
private void miNvDithering6bit_Click(object sender, EventArgs e)
+2
View File
@@ -53,6 +53,8 @@ namespace ColorControl.Services.NVIDIA
[JsonIgnore]
public string InfoLine { get; set; }
public NvDitherState DitherState => ditheringEnabled.HasValue ? ditheringEnabled == true ? NvDitherState.Enabled : NvDitherState.Disabled : NvDitherState.Auto;
[JsonIgnore]
public bool IsStartupPreset { get; set; }
public NvPreset() : base()
{
+45 -15
View File
@@ -241,9 +241,11 @@ namespace ColorControl.Services.NVIDIA
Utils.WriteObject(_presetsFilename, _presets);
}
private void SetCurrentDisplay(NvPreset preset)
private Display SetCurrentDisplay(NvPreset preset)
{
_currentDisplay = GetPresetDisplay(preset);
return _currentDisplay;
}
private Display GetPresetDisplay(NvPreset preset)
@@ -284,22 +286,48 @@ namespace ColorControl.Services.NVIDIA
}
}
public override Task<bool> ApplyPreset(NvPreset preset)
private async Task<Display> WaitForDisplayAsync(NvPreset preset)
{
var attempt = 0;
Display display = null;
while (attempt < 20)
{
if (HasDisplaysAttached())
{
display = SetCurrentDisplay(preset);
}
if (display != null)
{
break;
}
if (preset.IsStartupPreset)
{
await Task.Delay(1000);
attempt++;
}
else
{
break;
}
}
return display;
}
public override async Task<bool> ApplyPreset(NvPreset preset)
{
var result = true;
if (!HasDisplaysAttached())
{
return Task.FromResult(false);
}
SetCurrentDisplay(preset);
var display = GetCurrentDisplay();
var display = await WaitForDisplayAsync(preset);
if (display == null)
{
return Task.FromResult(false);
Logger.Warn($"Cannot apply preset {preset.IdOrName} because the associated display is not active/found");
return false;
}
if (preset.applyOther && preset.scaling.HasValue)
@@ -382,9 +410,11 @@ namespace ColorControl.Services.NVIDIA
_lastAppliedPreset = preset;
preset.IsStartupPreset = false;
PresetApplied();
return Task.FromResult(result);
return result;
}
public bool ApplyOverclocking(List<NvGpuOcSettings> settings)
@@ -761,8 +791,8 @@ namespace ColorControl.Services.NVIDIA
}
var displayDevice = display.DisplayDevice;
var hdr = displayDevice.HDRColorData;
return hdr?.HDRMode == ColorDataHDRMode.UHDA;
var hdr = Logger.Swallow(() => displayDevice.HDRColorData?.HDRMode == ColorDataHDRMode.UHDA);
return hdr;
}
public void SetHdmiSettings(Display display, NvHdmiInfoFrameSettings settings)
@@ -779,7 +809,7 @@ namespace ColorControl.Services.NVIDIA
var infoValue = info.Value;
var newInfo = new InfoFrameVideo(
infoValue.VideoIdentificationCode.Value,
infoValue.VideoIdentificationCode ?? 0xFF,
InfoFrameVideoPixelRepetition.None,
settings.ColorFormat ?? infoValue.ColorFormat,
settings.Colorimetry ?? infoValue.Colorimetry,
+5
View File
@@ -35,6 +35,11 @@ namespace novideo_srgb
check(GetDisplayConfigBufferSizes(QDC.QDC_ONLY_ACTIVE_PATHS, out var pathCount, out var modeCount));
if (pathCount == 0 || modeCount == 0)
{
return new HashSet<string>();
}
var paths = new DISPLAYCONFIG_PATH_INFO[pathCount];
var modes = new DISPLAYCONFIG_MODE_INFO[modeCount];