From dbf5670bc34a339b6906dfcb7d053beec89c268c Mon Sep 17 00:00:00 2001 From: Vincent Maas Date: Sat, 4 Mar 2023 14:30:13 +0100 Subject: [PATCH] move LG UI to separate panel --- ColorControl/MainForm.Designer.cs | 843 ----------- ColorControl/MainForm.cs | 1310 ++--------------- ColorControl/MainForm.resx | 12 - .../Services/GameLauncher/GamePanel.cs | 2 +- ColorControl/Services/LG/LgPanel.Designer.cs | 899 +++++++++++ ColorControl/Services/LG/LgPanel.cs | 1199 +++++++++++++++ ColorControl/Services/LG/LgPanel.resx | 66 + ColorControl/Services/LG/LgService.cs | 4 + 8 files changed, 2255 insertions(+), 2080 deletions(-) create mode 100644 ColorControl/Services/LG/LgPanel.Designer.cs create mode 100644 ColorControl/Services/LG/LgPanel.cs create mode 100644 ColorControl/Services/LG/LgPanel.resx diff --git a/ColorControl/MainForm.Designer.cs b/ColorControl/MainForm.Designer.cs index a1f5d31..50383c6 100644 --- a/ColorControl/MainForm.Designer.cs +++ b/ColorControl/MainForm.Designer.cs @@ -34,65 +34,6 @@ this.tabNVIDIA = new System.Windows.Forms.TabPage(); this.tabAMD = new System.Windows.Forms.TabPage(); this.tabLG = new System.Windows.Forms.TabPage(); - this.scLgController = new System.Windows.Forms.SplitContainer(); - this.btnLgSettings = new System.Windows.Forms.Button(); - this.chkLgQuickAccess = new System.Windows.Forms.CheckBox(); - this.cbxLgPcHdmiPort = new System.Windows.Forms.ComboBox(); - this.lblLgPcHdmiPort = new System.Windows.Forms.Label(); - this.edtLgPresetDescription = new System.Windows.Forms.TextBox(); - this.lblLgPresetDescription = new System.Windows.Forms.Label(); - this.btnLgDeviceOptionsHelp = new System.Windows.Forms.Button(); - this.btnLgGameBar = new System.Windows.Forms.Button(); - this.btnLgPresetEditTriggerConditions = new System.Windows.Forms.Button(); - this.edtLgPresetTriggerConditions = new System.Windows.Forms.TextBox(); - this.lblLgPresetExcludedProcesses = new System.Windows.Forms.Label(); - this.edtLgPresetExcludedProcesses = new System.Windows.Forms.TextBox(); - this.lblLgPresetIncludedProcesses = new System.Windows.Forms.Label(); - this.edtLgPresetIncludedProcesses = new System.Windows.Forms.TextBox(); - this.lblLgPresetTriggerCondition = new System.Windows.Forms.Label(); - this.cbxLgPresetTrigger = new System.Windows.Forms.ComboBox(); - this.lblLgPresetTrigger = new System.Windows.Forms.Label(); - this.btnLgExpert = new System.Windows.Forms.Button(); - this.mnuLgExpert = new System.Windows.Forms.ContextMenuStrip(this.components); - this.mnuLgOLEDMotionPro = new System.Windows.Forms.ToolStripMenuItem(); - this.miLgEnableMotionPro = new System.Windows.Forms.ToolStripMenuItem(); - this.miLgDisableMotionPro = new System.Windows.Forms.ToolStripMenuItem(); - this.miLgExpertSeparator1 = new System.Windows.Forms.ToolStripSeparator(); - this.chkLgRemoteControlShow = new System.Windows.Forms.CheckBox(); - this.label3 = new System.Windows.Forms.Label(); - this.cbxLgDevices = new System.Windows.Forms.ComboBox(); - this.btnLgDeviceConvertToCustom = new System.Windows.Forms.Button(); - this.cbxLgApps = new System.Windows.Forms.ComboBox(); - this.lvLgPresets = new System.Windows.Forms.ListView(); - this.label5 = new System.Windows.Forms.Label(); - this.cbxLgPresetDevice = new System.Windows.Forms.ComboBox(); - this.btnDeleteLg = new System.Windows.Forms.Button(); - this.btnApplyLg = new System.Windows.Forms.Button(); - this.lblDeviceFilter = new System.Windows.Forms.Label(); - this.lblLgPresetDevice = new System.Windows.Forms.Label(); - this.btnAddLg = new System.Windows.Forms.Button(); - this.edtShortcutLg = new System.Windows.Forms.TextBox(); - this.edtLgDeviceFilter = new System.Windows.Forms.TextBox(); - this.btnLgRemoveDevice = new System.Windows.Forms.Button(); - this.btnLgRefreshApps = new System.Windows.Forms.Button(); - this.label2 = new System.Windows.Forms.Label(); - this.label1 = new System.Windows.Forms.Label(); - this.btnLgAddDevice = new System.Windows.Forms.Button(); - this.edtNameLg = new System.Windows.Forms.TextBox(); - this.btnSetShortcutLg = new System.Windows.Forms.Button(); - this.edtStepsLg = new System.Windows.Forms.TextBox(); - this.btnLgAddButton = new System.Windows.Forms.Button(); - this.mnuLgButtons = new System.Windows.Forms.ContextMenuStrip(this.components); - this.mnuLgRcButtons = new System.Windows.Forms.ToolStripMenuItem(); - this.mnuLgActions = new System.Windows.Forms.ToolStripMenuItem(); - this.mnuLgNvPresets = new System.Windows.Forms.ToolStripMenuItem(); - this.mnuLgAmdPresets = new System.Windows.Forms.ToolStripMenuItem(); - this.mnuLgProgram = new System.Windows.Forms.ToolStripMenuItem(); - this.btnCloneLg = new System.Windows.Forms.Button(); - this.lblStepsLg = new System.Windows.Forms.Label(); - this.btnLgDeviceFilterRefresh = new System.Windows.Forms.Button(); - this.clbLgPower = new System.Windows.Forms.CheckedListBox(); - this.lblLgError = new System.Windows.Forms.Label(); this.tabGameLauncher = new System.Windows.Forms.TabPage(); this.tabOptions = new System.Windows.Forms.TabPage(); this.grpNvidiaOptions = new System.Windows.Forms.GroupBox(); @@ -151,14 +92,7 @@ this.label7 = new System.Windows.Forms.Label(); this.lblInfo = new System.Windows.Forms.Label(); this.btnUpdate = new System.Windows.Forms.Button(); - this.lvNvPresetsToolTip = new System.Windows.Forms.ToolTip(this.components); this.tcMain.SuspendLayout(); - this.tabLG.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.scLgController)).BeginInit(); - this.scLgController.Panel1.SuspendLayout(); - this.scLgController.SuspendLayout(); - this.mnuLgExpert.SuspendLayout(); - this.mnuLgButtons.SuspendLayout(); this.tabOptions.SuspendLayout(); this.grpNvidiaOptions.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pbGradient)).BeginInit(); @@ -217,7 +151,6 @@ // // tabLG // - this.tabLG.Controls.Add(this.scLgController); this.tabLG.Location = new System.Drawing.Point(4, 24); this.tabLG.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); this.tabLG.Name = "tabLG"; @@ -227,726 +160,6 @@ this.tabLG.Text = "LG controller"; this.tabLG.UseVisualStyleBackColor = true; // - // scLgController - // - this.scLgController.Dock = System.Windows.Forms.DockStyle.Fill; - this.scLgController.Location = new System.Drawing.Point(4, 3); - this.scLgController.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.scLgController.Name = "scLgController"; - // - // scLgController.Panel1 - // - this.scLgController.Panel1.Controls.Add(this.btnLgSettings); - this.scLgController.Panel1.Controls.Add(this.chkLgQuickAccess); - this.scLgController.Panel1.Controls.Add(this.cbxLgPcHdmiPort); - this.scLgController.Panel1.Controls.Add(this.lblLgPcHdmiPort); - this.scLgController.Panel1.Controls.Add(this.edtLgPresetDescription); - this.scLgController.Panel1.Controls.Add(this.lblLgPresetDescription); - this.scLgController.Panel1.Controls.Add(this.btnLgDeviceOptionsHelp); - this.scLgController.Panel1.Controls.Add(this.btnLgGameBar); - this.scLgController.Panel1.Controls.Add(this.btnLgPresetEditTriggerConditions); - this.scLgController.Panel1.Controls.Add(this.edtLgPresetTriggerConditions); - this.scLgController.Panel1.Controls.Add(this.lblLgPresetExcludedProcesses); - this.scLgController.Panel1.Controls.Add(this.edtLgPresetExcludedProcesses); - this.scLgController.Panel1.Controls.Add(this.lblLgPresetIncludedProcesses); - this.scLgController.Panel1.Controls.Add(this.edtLgPresetIncludedProcesses); - this.scLgController.Panel1.Controls.Add(this.lblLgPresetTriggerCondition); - this.scLgController.Panel1.Controls.Add(this.cbxLgPresetTrigger); - this.scLgController.Panel1.Controls.Add(this.lblLgPresetTrigger); - this.scLgController.Panel1.Controls.Add(this.btnLgExpert); - this.scLgController.Panel1.Controls.Add(this.chkLgRemoteControlShow); - this.scLgController.Panel1.Controls.Add(this.label3); - this.scLgController.Panel1.Controls.Add(this.cbxLgDevices); - this.scLgController.Panel1.Controls.Add(this.btnLgDeviceConvertToCustom); - this.scLgController.Panel1.Controls.Add(this.cbxLgApps); - this.scLgController.Panel1.Controls.Add(this.lvLgPresets); - this.scLgController.Panel1.Controls.Add(this.label5); - this.scLgController.Panel1.Controls.Add(this.cbxLgPresetDevice); - this.scLgController.Panel1.Controls.Add(this.btnDeleteLg); - this.scLgController.Panel1.Controls.Add(this.btnApplyLg); - this.scLgController.Panel1.Controls.Add(this.lblDeviceFilter); - this.scLgController.Panel1.Controls.Add(this.lblLgPresetDevice); - this.scLgController.Panel1.Controls.Add(this.btnAddLg); - this.scLgController.Panel1.Controls.Add(this.edtShortcutLg); - this.scLgController.Panel1.Controls.Add(this.edtLgDeviceFilter); - this.scLgController.Panel1.Controls.Add(this.btnLgRemoveDevice); - this.scLgController.Panel1.Controls.Add(this.btnLgRefreshApps); - this.scLgController.Panel1.Controls.Add(this.label2); - this.scLgController.Panel1.Controls.Add(this.label1); - this.scLgController.Panel1.Controls.Add(this.btnLgAddDevice); - this.scLgController.Panel1.Controls.Add(this.edtNameLg); - this.scLgController.Panel1.Controls.Add(this.btnSetShortcutLg); - this.scLgController.Panel1.Controls.Add(this.edtStepsLg); - this.scLgController.Panel1.Controls.Add(this.btnLgAddButton); - this.scLgController.Panel1.Controls.Add(this.btnCloneLg); - this.scLgController.Panel1.Controls.Add(this.lblStepsLg); - this.scLgController.Panel1.Controls.Add(this.btnLgDeviceFilterRefresh); - this.scLgController.Panel1.Controls.Add(this.clbLgPower); - this.scLgController.Panel1.Controls.Add(this.lblLgError); - this.scLgController.Panel1MinSize = 750; - this.scLgController.Panel2MinSize = 150; - this.scLgController.Size = new System.Drawing.Size(1106, 533); - this.scLgController.SplitterDistance = 894; - this.scLgController.SplitterWidth = 5; - this.scLgController.TabIndex = 43; - // - // btnLgSettings - // - this.btnLgSettings.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.btnLgSettings.Location = new System.Drawing.Point(804, 278); - this.btnLgSettings.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.btnLgSettings.Name = "btnLgSettings"; - this.btnLgSettings.Size = new System.Drawing.Size(88, 27); - this.btnLgSettings.TabIndex = 64; - this.btnLgSettings.Text = "Settings..."; - this.btnLgSettings.UseVisualStyleBackColor = true; - this.btnLgSettings.Click += new System.EventHandler(this.btnLgSettings_Click); - // - // chkLgQuickAccess - // - this.chkLgQuickAccess.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.chkLgQuickAccess.AutoSize = true; - this.chkLgQuickAccess.Enabled = false; - this.chkLgQuickAccess.Location = new System.Drawing.Point(341, 314); - this.chkLgQuickAccess.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.chkLgQuickAccess.Name = "chkLgQuickAccess"; - this.chkLgQuickAccess.Size = new System.Drawing.Size(96, 19); - this.chkLgQuickAccess.TabIndex = 63; - this.chkLgQuickAccess.Text = "Quick Access"; - this.chkLgQuickAccess.UseVisualStyleBackColor = true; - // - // cbxLgPcHdmiPort - // - this.cbxLgPcHdmiPort.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.cbxLgPcHdmiPort.FormattingEnabled = true; - this.cbxLgPcHdmiPort.Items.AddRange(new object[] { - "None", - "HDMI1", - "HDMI2", - "HDMI3", - "HDMI4"}); - this.cbxLgPcHdmiPort.Location = new System.Drawing.Point(667, 42); - this.cbxLgPcHdmiPort.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.cbxLgPcHdmiPort.Name = "cbxLgPcHdmiPort"; - this.cbxLgPcHdmiPort.Size = new System.Drawing.Size(86, 23); - this.cbxLgPcHdmiPort.TabIndex = 62; - this.cbxLgPcHdmiPort.SelectedIndexChanged += new System.EventHandler(this.cbxLgPcHdmiPort_SelectedIndexChanged); - // - // lblLgPcHdmiPort - // - this.lblLgPcHdmiPort.AutoSize = true; - this.lblLgPcHdmiPort.Location = new System.Drawing.Point(577, 45); - this.lblLgPcHdmiPort.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.lblLgPcHdmiPort.Name = "lblLgPcHdmiPort"; - this.lblLgPcHdmiPort.Size = new System.Drawing.Size(84, 15); - this.lblLgPcHdmiPort.TabIndex = 61; - this.lblLgPcHdmiPort.Text = "PC HDMI port:"; - // - // edtLgPresetDescription - // - this.edtLgPresetDescription.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.edtLgPresetDescription.Enabled = false; - this.edtLgPresetDescription.Location = new System.Drawing.Point(100, 483); - this.edtLgPresetDescription.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.edtLgPresetDescription.Multiline = true; - this.edtLgPresetDescription.Name = "edtLgPresetDescription"; - this.edtLgPresetDescription.Size = new System.Drawing.Size(694, 43); - this.edtLgPresetDescription.TabIndex = 60; - // - // lblLgPresetDescription - // - this.lblLgPresetDescription.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.lblLgPresetDescription.AutoSize = true; - this.lblLgPresetDescription.Location = new System.Drawing.Point(6, 488); - this.lblLgPresetDescription.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.lblLgPresetDescription.Name = "lblLgPresetDescription"; - this.lblLgPresetDescription.Size = new System.Drawing.Size(70, 15); - this.lblLgPresetDescription.TabIndex = 59; - this.lblLgPresetDescription.Text = "Description:"; - // - // btnLgDeviceOptionsHelp - // - this.btnLgDeviceOptionsHelp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.btnLgDeviceOptionsHelp.Location = new System.Drawing.Point(867, 70); - this.btnLgDeviceOptionsHelp.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.btnLgDeviceOptionsHelp.Name = "btnLgDeviceOptionsHelp"; - this.btnLgDeviceOptionsHelp.Size = new System.Drawing.Size(22, 27); - this.btnLgDeviceOptionsHelp.TabIndex = 58; - this.btnLgDeviceOptionsHelp.Text = "?"; - this.btnLgDeviceOptionsHelp.UseVisualStyleBackColor = true; - this.btnLgDeviceOptionsHelp.Click += new System.EventHandler(this.btnLgDeviceOptionsHelp_Click); - // - // btnLgGameBar - // - this.btnLgGameBar.Location = new System.Drawing.Point(478, 40); - this.btnLgGameBar.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.btnLgGameBar.Name = "btnLgGameBar"; - this.btnLgGameBar.Size = new System.Drawing.Size(88, 27); - this.btnLgGameBar.TabIndex = 55; - this.btnLgGameBar.Text = "Game Bar"; - this.btnLgGameBar.UseVisualStyleBackColor = true; - this.btnLgGameBar.Click += new System.EventHandler(this.btnLgGameBar_Click); - // - // btnLgPresetEditTriggerConditions - // - this.btnLgPresetEditTriggerConditions.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.btnLgPresetEditTriggerConditions.Enabled = false; - this.btnLgPresetEditTriggerConditions.Location = new System.Drawing.Point(804, 341); - this.btnLgPresetEditTriggerConditions.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.btnLgPresetEditTriggerConditions.Name = "btnLgPresetEditTriggerConditions"; - this.btnLgPresetEditTriggerConditions.Size = new System.Drawing.Size(88, 27); - this.btnLgPresetEditTriggerConditions.TabIndex = 54; - this.btnLgPresetEditTriggerConditions.Text = "Edit..."; - this.btnLgPresetEditTriggerConditions.UseVisualStyleBackColor = true; - this.btnLgPresetEditTriggerConditions.Click += new System.EventHandler(this.btnLgPresetEditTriggerConditions_Click); - // - // edtLgPresetTriggerConditions - // - this.edtLgPresetTriggerConditions.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.edtLgPresetTriggerConditions.Enabled = false; - this.edtLgPresetTriggerConditions.Location = new System.Drawing.Point(601, 343); - this.edtLgPresetTriggerConditions.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.edtLgPresetTriggerConditions.Name = "edtLgPresetTriggerConditions"; - this.edtLgPresetTriggerConditions.ReadOnly = true; - this.edtLgPresetTriggerConditions.Size = new System.Drawing.Size(194, 23); - this.edtLgPresetTriggerConditions.TabIndex = 53; - // - // lblLgPresetExcludedProcesses - // - this.lblLgPresetExcludedProcesses.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.lblLgPresetExcludedProcesses.AutoSize = true; - this.lblLgPresetExcludedProcesses.Location = new System.Drawing.Point(475, 408); - this.lblLgPresetExcludedProcesses.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.lblLgPresetExcludedProcesses.Name = "lblLgPresetExcludedProcesses"; - this.lblLgPresetExcludedProcesses.Size = new System.Drawing.Size(112, 15); - this.lblLgPresetExcludedProcesses.TabIndex = 52; - this.lblLgPresetExcludedProcesses.Text = "Excluded processes:"; - // - // edtLgPresetExcludedProcesses - // - this.edtLgPresetExcludedProcesses.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.edtLgPresetExcludedProcesses.Enabled = false; - this.edtLgPresetExcludedProcesses.Location = new System.Drawing.Point(601, 405); - this.edtLgPresetExcludedProcesses.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.edtLgPresetExcludedProcesses.Name = "edtLgPresetExcludedProcesses"; - this.edtLgPresetExcludedProcesses.Size = new System.Drawing.Size(289, 23); - this.edtLgPresetExcludedProcesses.TabIndex = 51; - // - // lblLgPresetIncludedProcesses - // - this.lblLgPresetIncludedProcesses.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.lblLgPresetIncludedProcesses.AutoSize = true; - this.lblLgPresetIncludedProcesses.Location = new System.Drawing.Point(475, 378); - this.lblLgPresetIncludedProcesses.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.lblLgPresetIncludedProcesses.Name = "lblLgPresetIncludedProcesses"; - this.lblLgPresetIncludedProcesses.Size = new System.Drawing.Size(110, 15); - this.lblLgPresetIncludedProcesses.TabIndex = 50; - this.lblLgPresetIncludedProcesses.Text = "Included processes:"; - // - // edtLgPresetIncludedProcesses - // - this.edtLgPresetIncludedProcesses.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.edtLgPresetIncludedProcesses.Enabled = false; - this.edtLgPresetIncludedProcesses.Location = new System.Drawing.Point(601, 375); - this.edtLgPresetIncludedProcesses.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.edtLgPresetIncludedProcesses.Name = "edtLgPresetIncludedProcesses"; - this.edtLgPresetIncludedProcesses.Size = new System.Drawing.Size(289, 23); - this.edtLgPresetIncludedProcesses.TabIndex = 49; - // - // lblLgPresetTriggerCondition - // - this.lblLgPresetTriggerCondition.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.lblLgPresetTriggerCondition.AutoSize = true; - this.lblLgPresetTriggerCondition.Location = new System.Drawing.Point(475, 347); - this.lblLgPresetTriggerCondition.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.lblLgPresetTriggerCondition.Name = "lblLgPresetTriggerCondition"; - this.lblLgPresetTriggerCondition.Size = new System.Drawing.Size(63, 15); - this.lblLgPresetTriggerCondition.TabIndex = 47; - this.lblLgPresetTriggerCondition.Text = "Condition:"; - // - // cbxLgPresetTrigger - // - this.cbxLgPresetTrigger.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.cbxLgPresetTrigger.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.cbxLgPresetTrigger.Enabled = false; - this.cbxLgPresetTrigger.FormattingEnabled = true; - this.cbxLgPresetTrigger.Location = new System.Drawing.Point(601, 312); - this.cbxLgPresetTrigger.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.cbxLgPresetTrigger.Name = "cbxLgPresetTrigger"; - this.cbxLgPresetTrigger.Size = new System.Drawing.Size(289, 23); - this.cbxLgPresetTrigger.TabIndex = 46; - // - // lblLgPresetTrigger - // - this.lblLgPresetTrigger.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.lblLgPresetTrigger.AutoSize = true; - this.lblLgPresetTrigger.Location = new System.Drawing.Point(475, 315); - this.lblLgPresetTrigger.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.lblLgPresetTrigger.Name = "lblLgPresetTrigger"; - this.lblLgPresetTrigger.Size = new System.Drawing.Size(46, 15); - this.lblLgPresetTrigger.TabIndex = 45; - this.lblLgPresetTrigger.Text = "Trigger:"; - // - // btnLgExpert - // - this.btnLgExpert.ContextMenuStrip = this.mnuLgExpert; - this.btnLgExpert.Location = new System.Drawing.Point(368, 39); - this.btnLgExpert.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.btnLgExpert.Name = "btnLgExpert"; - this.btnLgExpert.Size = new System.Drawing.Size(88, 27); - this.btnLgExpert.TabIndex = 44; - this.btnLgExpert.Text = "Expert..."; - this.btnLgExpert.UseVisualStyleBackColor = true; - this.btnLgExpert.Click += new System.EventHandler(this.btnLgExpert_Click); - // - // mnuLgExpert - // - this.mnuLgExpert.ImageScalingSize = new System.Drawing.Size(20, 20); - this.mnuLgExpert.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.mnuLgOLEDMotionPro, - this.miLgExpertSeparator1}); - this.mnuLgExpert.Name = "mnuLgButtons"; - this.mnuLgExpert.Size = new System.Drawing.Size(359, 32); - this.mnuLgExpert.Opening += new System.ComponentModel.CancelEventHandler(this.mnuLgExpert_Opening); - // - // mnuLgOLEDMotionPro - // - this.mnuLgOLEDMotionPro.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.miLgEnableMotionPro, - this.miLgDisableMotionPro}); - this.mnuLgOLEDMotionPro.Name = "mnuLgOLEDMotionPro"; - this.mnuLgOLEDMotionPro.Size = new System.Drawing.Size(358, 22); - this.mnuLgOLEDMotionPro.Text = "Activate OLED Motion Pro (B9/C9/E9/W9/C2/G2 only)"; - // - // miLgEnableMotionPro - // - this.miLgEnableMotionPro.Name = "miLgEnableMotionPro"; - this.miLgEnableMotionPro.Size = new System.Drawing.Size(207, 22); - this.miLgEnableMotionPro.Text = "Enable OLED Motion Pro"; - this.miLgEnableMotionPro.Click += new System.EventHandler(this.miLgEnableMotionPro_Click); - // - // miLgDisableMotionPro - // - this.miLgDisableMotionPro.Name = "miLgDisableMotionPro"; - this.miLgDisableMotionPro.Size = new System.Drawing.Size(207, 22); - this.miLgDisableMotionPro.Text = "Disable OLED Motion Pro"; - this.miLgDisableMotionPro.Click += new System.EventHandler(this.miLgDisableMotionPro_Click); - // - // miLgExpertSeparator1 - // - this.miLgExpertSeparator1.Name = "miLgExpertSeparator1"; - this.miLgExpertSeparator1.Size = new System.Drawing.Size(355, 6); - // - // chkLgRemoteControlShow - // - this.chkLgRemoteControlShow.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.chkLgRemoteControlShow.Appearance = System.Windows.Forms.Appearance.Button; - this.chkLgRemoteControlShow.AutoSize = true; - this.chkLgRemoteControlShow.Location = new System.Drawing.Point(788, 8); - this.chkLgRemoteControlShow.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.chkLgRemoteControlShow.Name = "chkLgRemoteControlShow"; - this.chkLgRemoteControlShow.Size = new System.Drawing.Size(101, 25); - this.chkLgRemoteControlShow.TabIndex = 43; - this.chkLgRemoteControlShow.Text = "Remote Control"; - this.chkLgRemoteControlShow.UseVisualStyleBackColor = true; - this.chkLgRemoteControlShow.CheckedChanged += new System.EventHandler(this.chkLgRemoteControlShow_CheckedChanged); - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(6, 14); - this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(45, 15); - this.label3.TabIndex = 31; - this.label3.Text = "Device:"; - // - // cbxLgDevices - // - this.cbxLgDevices.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.cbxLgDevices.DropDownWidth = 400; - this.cbxLgDevices.FormattingEnabled = true; - this.cbxLgDevices.Location = new System.Drawing.Point(100, 9); - this.cbxLgDevices.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.cbxLgDevices.Name = "cbxLgDevices"; - this.cbxLgDevices.Size = new System.Drawing.Size(370, 23); - this.cbxLgDevices.TabIndex = 30; - this.cbxLgDevices.SelectedIndexChanged += new System.EventHandler(this.cbxLgDevices_SelectedIndexChanged); - // - // btnLgDeviceConvertToCustom - // - this.btnLgDeviceConvertToCustom.Location = new System.Drawing.Point(667, 8); - this.btnLgDeviceConvertToCustom.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.btnLgDeviceConvertToCustom.Name = "btnLgDeviceConvertToCustom"; - this.btnLgDeviceConvertToCustom.Size = new System.Drawing.Size(88, 27); - this.btnLgDeviceConvertToCustom.TabIndex = 41; - this.btnLgDeviceConvertToCustom.Text = "To custom..."; - this.btnLgDeviceConvertToCustom.UseVisualStyleBackColor = true; - this.btnLgDeviceConvertToCustom.Click += new System.EventHandler(this.btnLgDeviceConvertToCustom_Click); - // - // cbxLgApps - // - this.cbxLgApps.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.cbxLgApps.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.cbxLgApps.Enabled = false; - this.cbxLgApps.FormattingEnabled = true; - this.cbxLgApps.Location = new System.Drawing.Point(100, 374); - this.cbxLgApps.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.cbxLgApps.Name = "cbxLgApps"; - this.cbxLgApps.Size = new System.Drawing.Size(233, 23); - this.cbxLgApps.TabIndex = 26; - this.cbxLgApps.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.cbxLgApps_KeyPress); - // - // lvLgPresets - // - this.lvLgPresets.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.lvLgPresets.CheckBoxes = true; - this.lvLgPresets.FullRowSelect = true; - this.lvLgPresets.Location = new System.Drawing.Point(6, 152); - this.lvLgPresets.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.lvLgPresets.MultiSelect = false; - this.lvLgPresets.Name = "lvLgPresets"; - this.lvLgPresets.ShowItemToolTips = true; - this.lvLgPresets.Size = new System.Drawing.Size(883, 120); - this.lvLgPresets.TabIndex = 8; - this.lvLgPresets.UseCompatibleStateImageBehavior = false; - this.lvLgPresets.View = System.Windows.Forms.View.Details; - this.lvLgPresets.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.lvLgPresets_ColumnClick); - this.lvLgPresets.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(this.lvLgPresets_ItemChecked); - this.lvLgPresets.SelectedIndexChanged += new System.EventHandler(this.lvLgPresets_SelectedIndexChanged); - this.lvLgPresets.DoubleClick += new System.EventHandler(this.lvLgPresets_DoubleClick); - // - // label5 - // - this.label5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(6, 378); - this.label5.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(32, 15); - this.label5.TabIndex = 25; - this.label5.Text = "App:"; - // - // cbxLgPresetDevice - // - this.cbxLgPresetDevice.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.cbxLgPresetDevice.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.cbxLgPresetDevice.Enabled = false; - this.cbxLgPresetDevice.FormattingEnabled = true; - this.cbxLgPresetDevice.Location = new System.Drawing.Point(100, 342); - this.cbxLgPresetDevice.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.cbxLgPresetDevice.Name = "cbxLgPresetDevice"; - this.cbxLgPresetDevice.Size = new System.Drawing.Size(370, 23); - this.cbxLgPresetDevice.TabIndex = 40; - // - // btnDeleteLg - // - this.btnDeleteLg.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.btnDeleteLg.Enabled = false; - this.btnDeleteLg.Location = new System.Drawing.Point(289, 278); - this.btnDeleteLg.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.btnDeleteLg.Name = "btnDeleteLg"; - this.btnDeleteLg.Size = new System.Drawing.Size(88, 27); - this.btnDeleteLg.TabIndex = 27; - this.btnDeleteLg.Text = "Delete"; - this.btnDeleteLg.UseVisualStyleBackColor = true; - this.btnDeleteLg.Click += new System.EventHandler(this.btnDeleteLg_Click); - // - // btnApplyLg - // - this.btnApplyLg.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.btnApplyLg.Enabled = false; - this.btnApplyLg.Location = new System.Drawing.Point(6, 278); - this.btnApplyLg.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.btnApplyLg.Name = "btnApplyLg"; - this.btnApplyLg.Size = new System.Drawing.Size(88, 27); - this.btnApplyLg.TabIndex = 9; - this.btnApplyLg.Text = "Apply"; - this.btnApplyLg.UseVisualStyleBackColor = true; - this.btnApplyLg.Click += new System.EventHandler(this.btnApplyLg_Click); - // - // lblDeviceFilter - // - this.lblDeviceFilter.AutoSize = true; - this.lblDeviceFilter.Location = new System.Drawing.Point(6, 45); - this.lblDeviceFilter.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.lblDeviceFilter.Name = "lblDeviceFilter"; - this.lblDeviceFilter.Size = new System.Drawing.Size(72, 15); - this.lblDeviceFilter.TabIndex = 24; - this.lblDeviceFilter.Text = "Device filter:"; - // - // lblLgPresetDevice - // - this.lblLgPresetDevice.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.lblLgPresetDevice.AutoSize = true; - this.lblLgPresetDevice.Location = new System.Drawing.Point(6, 345); - this.lblLgPresetDevice.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.lblLgPresetDevice.Name = "lblLgPresetDevice"; - this.lblLgPresetDevice.Size = new System.Drawing.Size(45, 15); - this.lblLgPresetDevice.TabIndex = 39; - this.lblLgPresetDevice.Text = "Device:"; - // - // btnAddLg - // - this.btnAddLg.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.btnAddLg.Location = new System.Drawing.Point(195, 278); - this.btnAddLg.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.btnAddLg.Name = "btnAddLg"; - this.btnAddLg.Size = new System.Drawing.Size(88, 27); - this.btnAddLg.TabIndex = 28; - this.btnAddLg.Text = "Add"; - this.btnAddLg.UseVisualStyleBackColor = true; - this.btnAddLg.Click += new System.EventHandler(this.btnAddLg_Click); - // - // edtShortcutLg - // - this.edtShortcutLg.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.edtShortcutLg.Enabled = false; - this.edtShortcutLg.Location = new System.Drawing.Point(100, 405); - this.edtShortcutLg.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.edtShortcutLg.Name = "edtShortcutLg"; - this.edtShortcutLg.ReadOnly = true; - this.edtShortcutLg.Size = new System.Drawing.Size(233, 23); - this.edtShortcutLg.TabIndex = 11; - this.edtShortcutLg.TextChanged += new System.EventHandler(this.edtShortcutLg_TextChanged); - this.edtShortcutLg.KeyDown += new System.Windows.Forms.KeyEventHandler(this.edtShortcut_KeyDown); - this.edtShortcutLg.KeyUp += new System.Windows.Forms.KeyEventHandler(this.edtShortcut_KeyUp); - // - // edtLgDeviceFilter - // - this.edtLgDeviceFilter.Location = new System.Drawing.Point(100, 40); - this.edtLgDeviceFilter.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.edtLgDeviceFilter.Name = "edtLgDeviceFilter"; - this.edtLgDeviceFilter.Size = new System.Drawing.Size(165, 23); - this.edtLgDeviceFilter.TabIndex = 23; - this.edtLgDeviceFilter.TextChanged += new System.EventHandler(this.edtLgDeviceFilter_TextChanged); - // - // btnLgRemoveDevice - // - this.btnLgRemoveDevice.Location = new System.Drawing.Point(573, 8); - this.btnLgRemoveDevice.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.btnLgRemoveDevice.Name = "btnLgRemoveDevice"; - this.btnLgRemoveDevice.Size = new System.Drawing.Size(88, 27); - this.btnLgRemoveDevice.TabIndex = 38; - this.btnLgRemoveDevice.Text = "Remove"; - this.btnLgRemoveDevice.UseVisualStyleBackColor = true; - this.btnLgRemoveDevice.Click += new System.EventHandler(this.btnLgRemoveDevice_Click); - // - // btnLgRefreshApps - // - this.btnLgRefreshApps.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.btnLgRefreshApps.Enabled = false; - this.btnLgRefreshApps.Location = new System.Drawing.Point(341, 372); - this.btnLgRefreshApps.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.btnLgRefreshApps.Name = "btnLgRefreshApps"; - this.btnLgRefreshApps.Size = new System.Drawing.Size(88, 27); - this.btnLgRefreshApps.TabIndex = 29; - this.btnLgRefreshApps.Text = "Refresh"; - this.btnLgRefreshApps.UseVisualStyleBackColor = true; - this.btnLgRefreshApps.Click += new System.EventHandler(this.btnLgRefreshApps_Click); - // - // label2 - // - this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(6, 409); - this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(55, 15); - this.label2.TabIndex = 12; - this.label2.Text = "Shortcut:"; - // - // label1 - // - this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(6, 315); - this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(42, 15); - this.label1.TabIndex = 20; - this.label1.Text = "Name:"; - // - // btnLgAddDevice - // - this.btnLgAddDevice.Location = new System.Drawing.Point(478, 8); - this.btnLgAddDevice.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.btnLgAddDevice.Name = "btnLgAddDevice"; - this.btnLgAddDevice.Size = new System.Drawing.Size(88, 27); - this.btnLgAddDevice.TabIndex = 37; - this.btnLgAddDevice.Text = "Add"; - this.btnLgAddDevice.UseVisualStyleBackColor = true; - this.btnLgAddDevice.Click += new System.EventHandler(this.btnLgAddDevice_Click); - // - // edtNameLg - // - this.edtNameLg.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.edtNameLg.Enabled = false; - this.edtNameLg.Location = new System.Drawing.Point(100, 312); - this.edtNameLg.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.edtNameLg.Name = "edtNameLg"; - this.edtNameLg.Size = new System.Drawing.Size(233, 23); - this.edtNameLg.TabIndex = 19; - // - // btnSetShortcutLg - // - this.btnSetShortcutLg.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.btnSetShortcutLg.Enabled = false; - this.btnSetShortcutLg.Location = new System.Drawing.Point(384, 278); - this.btnSetShortcutLg.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.btnSetShortcutLg.Name = "btnSetShortcutLg"; - this.btnSetShortcutLg.Size = new System.Drawing.Size(88, 27); - this.btnSetShortcutLg.TabIndex = 13; - this.btnSetShortcutLg.Text = "Save"; - this.btnSetShortcutLg.UseVisualStyleBackColor = true; - this.btnSetShortcutLg.Click += new System.EventHandler(this.btnSetShortcutLg_Click); - // - // edtStepsLg - // - this.edtStepsLg.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.edtStepsLg.Enabled = false; - this.edtStepsLg.Location = new System.Drawing.Point(100, 434); - this.edtStepsLg.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.edtStepsLg.Multiline = true; - this.edtStepsLg.Name = "edtStepsLg"; - this.edtStepsLg.Size = new System.Drawing.Size(694, 43); - this.edtStepsLg.TabIndex = 17; - // - // btnLgAddButton - // - this.btnLgAddButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.btnLgAddButton.ContextMenuStrip = this.mnuLgButtons; - this.btnLgAddButton.Enabled = false; - this.btnLgAddButton.Location = new System.Drawing.Point(802, 433); - this.btnLgAddButton.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.btnLgAddButton.Name = "btnLgAddButton"; - this.btnLgAddButton.Size = new System.Drawing.Size(88, 27); - this.btnLgAddButton.TabIndex = 32; - this.btnLgAddButton.Text = "Add step"; - this.btnLgAddButton.UseVisualStyleBackColor = true; - this.btnLgAddButton.Click += new System.EventHandler(this.btnLgAddButton_Click); - // - // mnuLgButtons - // - this.mnuLgButtons.ImageScalingSize = new System.Drawing.Size(20, 20); - this.mnuLgButtons.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.mnuLgRcButtons, - this.mnuLgActions, - this.mnuLgNvPresets, - this.mnuLgAmdPresets, - this.mnuLgProgram}); - this.mnuLgButtons.Name = "mnuLgButtons"; - this.mnuLgButtons.Size = new System.Drawing.Size(153, 114); - this.mnuLgButtons.Opening += new System.ComponentModel.CancelEventHandler(this.mnuLgButtons_Opening); - // - // mnuLgRcButtons - // - this.mnuLgRcButtons.Name = "mnuLgRcButtons"; - this.mnuLgRcButtons.Size = new System.Drawing.Size(152, 22); - this.mnuLgRcButtons.Text = "Buttons"; - // - // mnuLgActions - // - this.mnuLgActions.Name = "mnuLgActions"; - this.mnuLgActions.Size = new System.Drawing.Size(152, 22); - this.mnuLgActions.Text = "Actions"; - // - // mnuLgNvPresets - // - this.mnuLgNvPresets.Name = "mnuLgNvPresets"; - this.mnuLgNvPresets.Size = new System.Drawing.Size(152, 22); - this.mnuLgNvPresets.Text = "NVIDIA presets"; - // - // mnuLgAmdPresets - // - this.mnuLgAmdPresets.Name = "mnuLgAmdPresets"; - this.mnuLgAmdPresets.Size = new System.Drawing.Size(152, 22); - this.mnuLgAmdPresets.Text = "AMD presets"; - // - // mnuLgProgram - // - this.mnuLgProgram.Name = "mnuLgProgram"; - this.mnuLgProgram.Size = new System.Drawing.Size(152, 22); - this.mnuLgProgram.Text = "Start Program"; - this.mnuLgProgram.Click += new System.EventHandler(this.mnuLgProgram_Click); - // - // btnCloneLg - // - this.btnCloneLg.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.btnCloneLg.Enabled = false; - this.btnCloneLg.Location = new System.Drawing.Point(100, 278); - this.btnCloneLg.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.btnCloneLg.Name = "btnCloneLg"; - this.btnCloneLg.Size = new System.Drawing.Size(88, 27); - this.btnCloneLg.TabIndex = 14; - this.btnCloneLg.Text = "Clone"; - this.btnCloneLg.UseVisualStyleBackColor = true; - this.btnCloneLg.Click += new System.EventHandler(this.btnCloneLg_Click); - // - // lblStepsLg - // - this.lblStepsLg.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.lblStepsLg.AutoSize = true; - this.lblStepsLg.Location = new System.Drawing.Point(6, 439); - this.lblStepsLg.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.lblStepsLg.Name = "lblStepsLg"; - this.lblStepsLg.Size = new System.Drawing.Size(38, 15); - this.lblStepsLg.TabIndex = 16; - this.lblStepsLg.Text = "Steps:"; - // - // btnLgDeviceFilterRefresh - // - this.btnLgDeviceFilterRefresh.Location = new System.Drawing.Point(273, 39); - this.btnLgDeviceFilterRefresh.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.btnLgDeviceFilterRefresh.Name = "btnLgDeviceFilterRefresh"; - this.btnLgDeviceFilterRefresh.Size = new System.Drawing.Size(88, 27); - this.btnLgDeviceFilterRefresh.TabIndex = 35; - this.btnLgDeviceFilterRefresh.Text = "Refresh"; - this.btnLgDeviceFilterRefresh.UseVisualStyleBackColor = true; - this.btnLgDeviceFilterRefresh.Click += new System.EventHandler(this.btnLgDeviceFilterRefresh_Click); - // - // clbLgPower - // - this.clbLgPower.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.clbLgPower.CheckOnClick = true; - this.clbLgPower.ColumnWidth = 240; - this.clbLgPower.FormattingEnabled = true; - this.clbLgPower.Items.AddRange(new object[] { - "Power on after startup", - "Power on after resume from standby", - "Power off on shutdown", - "Power off on standby", - "Power off when screensaver activates", - "Power on when screensaver deactivates", - "Power on even after manual power off", - "Allow triggers to be fired for this device", - "Use Windows power settings to power on", - "Use Windows power settings to power off", - "Use secure connection"}); - this.clbLgPower.Location = new System.Drawing.Point(6, 70); - this.clbLgPower.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.clbLgPower.MultiColumn = true; - this.clbLgPower.Name = "clbLgPower"; - this.clbLgPower.Size = new System.Drawing.Size(856, 76); - this.clbLgPower.TabIndex = 34; - this.clbLgPower.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.clbLgPower_ItemCheck); - // - // lblLgError - // - this.lblLgError.AutoSize = true; - this.lblLgError.Location = new System.Drawing.Point(6, 9); - this.lblLgError.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.lblLgError.Name = "lblLgError"; - this.lblLgError.Size = new System.Drawing.Size(53, 15); - this.lblLgError.TabIndex = 15; - this.lblLgError.Text = "ErrorText"; - this.lblLgError.Visible = false; - // // tabGameLauncher // this.tabGameLauncher.Location = new System.Drawing.Point(4, 24); @@ -1707,13 +920,6 @@ this.Click += new System.EventHandler(this.MainForm_Click); this.Resize += new System.EventHandler(this.MainForm_Resize); this.tcMain.ResumeLayout(false); - this.tabLG.ResumeLayout(false); - this.scLgController.Panel1.ResumeLayout(false); - this.scLgController.Panel1.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.scLgController)).EndInit(); - this.scLgController.ResumeLayout(false); - this.mnuLgExpert.ResumeLayout(false); - this.mnuLgButtons.ResumeLayout(false); this.tabOptions.ResumeLayout(false); this.grpNvidiaOptions.ResumeLayout(false); this.grpNvidiaOptions.PerformLayout(); @@ -1780,37 +986,6 @@ private System.Windows.Forms.ToolStripMenuItem mnuLgRcButtons; private System.Windows.Forms.ToolStripMenuItem mnuLgActions; private System.Windows.Forms.CheckBox chkMinimizeToSystemTray; - private System.Windows.Forms.SplitContainer scLgController; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.ComboBox cbxLgDevices; - private System.Windows.Forms.Button btnLgDeviceConvertToCustom; - private System.Windows.Forms.ComboBox cbxLgApps; - private System.Windows.Forms.ListView lvLgPresets; - private System.Windows.Forms.Label label5; - private System.Windows.Forms.ComboBox cbxLgPresetDevice; - private System.Windows.Forms.Button btnDeleteLg; - private System.Windows.Forms.Button btnApplyLg; - private System.Windows.Forms.Label lblDeviceFilter; - private System.Windows.Forms.Label lblLgPresetDevice; - private System.Windows.Forms.Button btnAddLg; - private System.Windows.Forms.TextBox edtShortcutLg; - private System.Windows.Forms.TextBox edtLgDeviceFilter; - private System.Windows.Forms.Button btnLgRemoveDevice; - private System.Windows.Forms.Button btnLgRefreshApps; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.Button btnLgAddDevice; - private System.Windows.Forms.TextBox edtNameLg; - private System.Windows.Forms.Button btnSetShortcutLg; - private System.Windows.Forms.TextBox edtStepsLg; - private System.Windows.Forms.Button btnLgAddButton; - private System.Windows.Forms.Button btnCloneLg; - private System.Windows.Forms.Label lblStepsLg; - private System.Windows.Forms.Button btnLgDeviceFilterRefresh; - private System.Windows.Forms.CheckedListBox clbLgPower; - private System.Windows.Forms.Label lblLgError; - private System.Windows.Forms.CheckBox chkLgRemoteControlShow; - private System.Windows.Forms.Button btnLgExpert; private System.Windows.Forms.ContextMenuStrip mnuLgExpert; private System.Windows.Forms.ToolStripMenuItem mnuLgOLEDMotionPro; private System.Windows.Forms.ToolStripMenuItem miLgEnableMotionPro; @@ -1818,33 +993,16 @@ private System.Windows.Forms.ToolStripSeparator miLgExpertSeparator1; private System.Windows.Forms.ToolStripMenuItem mnuLgNvPresets; private System.Windows.Forms.ToolStripMenuItem mnuLgAmdPresets; - private System.Windows.Forms.ComboBox cbxLgPresetTrigger; - private System.Windows.Forms.Label lblLgPresetTrigger; - private System.Windows.Forms.Label lblLgPresetTriggerCondition; - private System.Windows.Forms.Label lblLgPresetExcludedProcesses; - private System.Windows.Forms.TextBox edtLgPresetExcludedProcesses; - private System.Windows.Forms.Label lblLgPresetIncludedProcesses; - private System.Windows.Forms.TextBox edtLgPresetIncludedProcesses; - private System.Windows.Forms.Button btnLgPresetEditTriggerConditions; - private System.Windows.Forms.TextBox edtLgPresetTriggerConditions; private System.Windows.Forms.CheckBox chkCheckForUpdates; private System.Windows.Forms.CheckBox chkLgShowAdvancedActions; - private System.Windows.Forms.Button btnLgGameBar; private System.Windows.Forms.CheckBox chkGdiScaling; - private System.Windows.Forms.Button btnLgDeviceOptionsHelp; private System.Windows.Forms.Label lblLgOptionShutdownDelayHelp; private System.Windows.Forms.NumericUpDown edtLgOptionShutdownDelay; private System.Windows.Forms.Label lblLgOptionShutdownDelay; - private System.Windows.Forms.TextBox edtLgPresetDescription; - private System.Windows.Forms.Label lblLgPresetDescription; private System.Windows.Forms.Label lblGameBarShortcut; private System.Windows.Forms.TextBox edtLgGameBarShortcut; - private System.Windows.Forms.ComboBox cbxLgPcHdmiPort; - private System.Windows.Forms.Label lblLgPcHdmiPort; private System.Windows.Forms.ToolStripMenuItem mnuLgProgram; private System.Windows.Forms.TabPage tabGameLauncher; - private System.Windows.Forms.CheckBox chkLgQuickAccess; - private System.Windows.Forms.Button btnLgSettings; private System.Windows.Forms.RadioButton rbElevationService; private System.Windows.Forms.RadioButton rbElevationProcess; private System.Windows.Forms.RadioButton rbElevationAdmin; @@ -1859,7 +1017,6 @@ private System.Windows.Forms.Button btnUpdate; private System.Windows.Forms.Label lblDitheringDisplay; private System.Windows.Forms.ComboBox cbxDitheringDisplay; - private System.Windows.Forms.ToolTip lvNvPresetsToolTip; } } diff --git a/ColorControl/MainForm.cs b/ColorControl/MainForm.cs index f636437..5a1de6a 100644 --- a/ColorControl/MainForm.cs +++ b/ColorControl/MainForm.cs @@ -7,15 +7,12 @@ using ColorControl.Services.GameLauncher; using ColorControl.Services.LG; using ColorControl.Services.NVIDIA; using ColorControl.Svc; -using LgTv; using Microsoft.Extensions.DependencyInjection; using NLog; -using NStandard; using NvAPIWrapper.Display; using NWin32; using System; using System.Collections.Generic; -using System.ComponentModel; using System.Diagnostics; using System.Drawing; using System.IO; @@ -52,6 +49,7 @@ namespace ColorControl private bool _setVisibleCalled = false; private LgService _lgService; + private LgPanel _lgPanel; private ToolStripMenuItem _nvTrayMenu; private ToolStripMenuItem _amdTrayMenu; @@ -137,9 +135,9 @@ namespace ColorControl //Utils.StartService(); - InitLgService(); InitNvService(); InitAmdService(); + InitLgService(); InitGameService(); InitInfo(); @@ -267,51 +265,33 @@ namespace ColorControl var appContextProvider = Program.ServiceProvider.GetRequiredService(); _lgService = new LgService(appContextProvider, StartUpParams.RunningFromScheduledTask); - _lgService.RefreshDevices(afterStartUp: true).ContinueWith((_) => BeginInvoke(() => AfterLgServiceRefreshDevices())); - _lgService.SelectedDeviceChangedEvent += _lgService_SelectedDeviceChangedEvent; - FillLgPresets(); + _lgPanel = new LgPanel(_lgService, _nvService, _amdService, _trayIcon, Handle); + _lgPanel.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; + + tabLG.Controls.Add(_lgPanel); edtLgMaxPowerOnRetries.Value = _lgService.Config.PowerOnRetries; edtLgOptionShutdownDelay.Value = _lgService.Config.ShutdownDelay; - edtLgDeviceFilter.Text = _lgService.Config.DeviceSearchKey; chkLgShowAdvancedActions.Checked = _lgService.Config.ShowAdvancedActions; chkLgSetSelectedDeviceByPowerOn.Checked = _lgService.Config.SetSelectedDeviceByPowerOn; - FormUtils.InitSortState(lvLgPresets, _config.LgPresetsSortState); - - var values = Enum.GetValues(typeof(ButtonType)); - foreach (var button in values) - { - var text = button.ToString(); - if (text[0] == '_') - { - text = text.Substring(1); - } - - var item = mnuLgRcButtons.DropDownItems.Add(text); - item.Click += miLgAddButton_Click; - } - - _lgService.InstallEventHandlers(); - LgDevice.ExternalServiceHandler = HandleExternalServiceForLgDevice; - - InitShortcut(SHORTCUTID_GAMEBAR, _lgService.Config.GameBarShortcut, ToggleGameBar); + InitShortcut(SHORTCUTID_GAMEBAR, _lgService.Config.GameBarShortcut, _lgPanel.ToggleGameBar); InitShortcut(SHORTCUTID_LGQA, _config.LgQuickAccessShortcut, _lgService.ToggleQuickAccessForm); if (!string.IsNullOrEmpty(_lgService.Config.GameBarShortcut)) { - // New shortcut manager, not working yet - //if (_keyboardHookManager == null) - //{ - // _keyboardHookManager = new KeyboardHookManager(); - // _keyboardHookManager.Start(); - //} - //_keyboardHookManager.RegisterHotkey(NonInvasiveKeyboardHookLibrary.ModifierKeys.Control | NonInvasiveKeyboardHookLibrary.ModifierKeys.Alt, (int)Keys.F9, new Action(TestKey)); - edtLgGameBarShortcut.Text = _lgService.Config.GameBarShortcut; } + + // New shortcut manager, not working yet + //if (_keyboardHookManager == null) + //{ + // _keyboardHookManager = new KeyboardHookManager(); + // _keyboardHookManager.Start(); + //} + //_keyboardHookManager.RegisterHotkey(NonInvasiveKeyboardHookLibrary.ModifierKeys.Control | NonInvasiveKeyboardHookLibrary.ModifierKeys.Alt, (int)Keys.F9, new Action(TestKey)); } catch (Exception e) { @@ -329,32 +309,6 @@ namespace ColorControl }); } - private void _lgService_SelectedDeviceChangedEvent(object sender, EventArgs e) - { - BeginInvoke(() => SetLgDevicesSelectedIndex(sender)); - } - - private void SetLgDevicesSelectedIndex(object sender) - { - if (sender == null) - { - cbxLgDevices.SelectedIndex = -1; - return; - } - - cbxLgDevices.SelectedIndex = cbxLgDevices.Items.IndexOf(sender); - } - - private void AfterLgServiceRefreshDevices() - { - FillLgDevices(); - - if (StartUpParams.ExecuteLgPreset) - { - var _ = _lgService.ApplyPreset(StartUpParams.LgPresetName); - } - } - private bool HandleExternalServiceForLgDevice(string serviceName, string[] parameters) { if (string.IsNullOrEmpty(serviceName) || parameters.Length == 0) @@ -483,10 +437,9 @@ namespace ColorControl _nvPanel?.Save(); _amdPanel?.Save(); + _lgPanel?.Save(); _gamePanel?.Save(); - FormUtils.SaveSortState(lvLgPresets.ListViewItemSorter, _config.LgPresetsSortState); - SaveConfig(); } @@ -542,7 +495,7 @@ namespace ColorControl var lgPreset = _lgService?.GetPresets().FirstOrDefault(x => x.id == id); if (lgPreset != null) { - ApplyLgPreset(lgPreset); + _lgPanel?.ApplyLgPreset(lgPreset); } } } @@ -703,9 +656,9 @@ namespace ColorControl if (_lgService == null) { - FormUtils.ShowControls(tabLG, false, lblLgError); - lblLgError.Text = "Error while initializing the LG-controller. You either don't have a LG TV, it is disabled or a configuration file is corrupt."; - lblLgError.Visible = true; + //FormUtils.ShowControls(tabLG, false, lblLgError); + //lblLgError.Text = "Error while initializing the LG-controller. You either don't have a LG TV, it is disabled or a configuration file is corrupt."; + //lblLgError.Visible = true; } InitSelectedTab(); @@ -780,198 +733,6 @@ NOTE: installing the service may cause a User Account Control popup."); Utils.HandleKeyboardShortcutUp(e); } - private void FillLgPresets() - { - FormUtils.InitListView(lvLgPresets, LgPreset.GetColumnNames()); - - foreach (var preset in _lgService.GetPresets()) - { - AddOrUpdateItemLg(preset); - Utils.RegisterShortcut(Handle, preset.id, preset.shortcut); - } - } - - private void AddOrUpdateItemLg(LgPreset preset = null, ListViewItem specItem = null) - { - FormUtils.AddOrUpdateListItem(lvLgPresets, _lgService.GetPresets(), _config, preset, specItem); - } - - private void btnCloneLg_Click(object sender, EventArgs e) - { - var preset = GetSelectedLgPreset(); - - var newPreset = preset.Clone(); - AddOrUpdateItemLg(newPreset); - } - - private LgPreset GetSelectedLgPreset() - { - if (lvLgPresets.SelectedItems.Count > 0) - { - var item = lvLgPresets.SelectedItems[0]; - return (LgPreset)item.Tag; - } - else - { - return null; - } - } - - private void lvLgPresets_SelectedIndexChanged(object sender, EventArgs e) - { - var enabled = lvLgPresets.SelectedItems.Count > 0; - btnApplyLg.Enabled = enabled; - btnCloneLg.Enabled = enabled; - edtNameLg.Enabled = enabled; - chkLgQuickAccess.Enabled = enabled; - edtLgPresetDescription.Enabled = enabled; - cbxLgPresetDevice.Enabled = enabled; - edtShortcutLg.Enabled = enabled; - btnSetShortcutLg.Enabled = enabled; - edtStepsLg.Enabled = enabled; - btnLgAddButton.Enabled = enabled; - cbxLgApps.Enabled = enabled; - btnLgRefreshApps.Enabled = enabled; - btnDeleteLg.Enabled = enabled; - cbxLgPresetTrigger.Enabled = enabled; - edtLgPresetTriggerConditions.Enabled = enabled; - btnLgPresetEditTriggerConditions.Enabled = enabled; - edtLgPresetIncludedProcesses.Enabled = enabled; - edtLgPresetExcludedProcesses.Enabled = enabled; - - var preset = GetSelectedLgPreset(); - - if (preset != null) - { - edtNameLg.Text = preset.name; - chkLgQuickAccess.Checked = preset.ShowInQuickAccess; - edtLgPresetDescription.Text = preset.Description; - var lgApps = _lgService?.GetApps(); - cbxLgApps.SelectedIndex = lgApps == null ? -1 : lgApps.FindIndex(x => x.appId.Equals(preset.appId)); - edtShortcutLg.Text = preset.shortcut; - edtStepsLg.Text = preset.steps.Aggregate("", (a, b) => (string.IsNullOrEmpty(a) ? "" : a + ", ") + b); - - var index = -1; - - for (var i = 0; i < cbxLgPresetDevice.Items.Count; i++) - { - var pnpDev = (LgDevice)cbxLgPresetDevice.Items[i]; - if ((string.IsNullOrEmpty(preset.DeviceMacAddress) && string.IsNullOrEmpty(pnpDev.MacAddress)) || pnpDev.MacAddress.Equals(preset.DeviceMacAddress, StringComparison.OrdinalIgnoreCase)) - { - index = i; - break; - } - } - - cbxLgPresetDevice.SelectedIndex = index; - - var trigger = preset.Triggers.FirstOrDefault(); - - FormUtils.SetComboBoxEnumIndex(cbxLgPresetTrigger, (int)(trigger?.Trigger ?? PresetTriggerType.None)); - - edtLgPresetTriggerConditions.Text = Utils.GetDescriptions(trigger != null ? (int)trigger.Conditions : 0).Join(", "); - edtLgPresetTriggerConditions.Tag = trigger != null ? (int)trigger.Conditions : 0; - - edtLgPresetIncludedProcesses.Text = trigger?.IncludedProcesses?.Join(", ") ?? string.Empty; - edtLgPresetExcludedProcesses.Text = trigger?.ExcludedProcesses?.Join(", ") ?? string.Empty; - } - else - { - edtNameLg.Text = string.Empty; - chkLgQuickAccess.Checked = false; - edtLgPresetDescription.Text = string.Empty; - cbxLgApps.SelectedIndex = -1; - edtShortcutLg.Text = string.Empty; - edtStepsLg.Text = string.Empty; - cbxLgPresetDevice.SelectedIndex = -1; - cbxLgPresetTrigger.SelectedIndex = -1; - edtLgPresetTriggerConditions.Text = string.Empty; - edtLgPresetTriggerConditions.Tag = 0; - edtLgPresetIncludedProcesses.Text = string.Empty; - edtLgPresetExcludedProcesses.Text = string.Empty; - } - } - - private void btnApplyLg_Click(object sender, EventArgs e) - { - var preset = GetSelectedLgPreset(); - - ApplyLgPreset(preset); - } - - private void btnSetShortcutLg_Click(object sender, EventArgs e) - { - var shortcut = edtShortcutLg.Text.Trim(); - if (!Utils.ValidateShortcut(shortcut)) - { - return; - } - - var preset = GetSelectedLgPreset(); - - var name = edtNameLg.Text.Trim(); - - if (name.Length == 0 || _lgService.GetPresets().Any(x => x.id != preset.id && x.name.Equals(name, StringComparison.OrdinalIgnoreCase))) - { - MessageForms.WarningOk("The name can not be empty and must be unique."); - return; - } - - var clear = !string.IsNullOrEmpty(preset.shortcut); - - preset.name = name; - preset.ShowInQuickAccess = chkLgQuickAccess.Checked; - preset.Description = edtLgPresetDescription.Text.Trim(); - - if (cbxLgPresetDevice.SelectedIndex == -1) - { - preset.DeviceMacAddress = string.Empty; - } - else - { - var device = (LgDevice)cbxLgPresetDevice.SelectedItem; - preset.DeviceMacAddress = device.MacAddress; - } - - if (cbxLgApps.SelectedIndex == -1) - { - preset.appId = string.Empty; - } - else - { - var lgApp = (LgApp)cbxLgApps.SelectedItem; - preset.appId = lgApp.appId; - } - - var triggerType = FormUtils.GetComboBoxEnumItem(cbxLgPresetTrigger); - preset.UpdateTrigger(triggerType, - (PresetConditionType)edtLgPresetTriggerConditions.Tag, - edtLgPresetIncludedProcesses.Text, - edtLgPresetExcludedProcesses.Text); - - if (triggerType != PresetTriggerType.None) - { - _lgService.InstallEventHandlers(); - } - - var shortcutChanged = !shortcut.Equals(preset.shortcut); - if (shortcutChanged) - { - preset.shortcut = shortcut; - } - - var text = edtStepsLg.Text; - - Utils.ParseWords(preset.steps, text); - - AddOrUpdateItemLg(); - - if (shortcutChanged) - { - Utils.RegisterShortcut(Handle, preset.id, preset.shortcut, clear); - } - } - private void tabControl1_SelectedIndexChanged(object sender, EventArgs e) { InitSelectedTab(); @@ -981,7 +742,7 @@ NOTE: installing the service may cause a User Account Control popup."); { if (tcMain.SelectedTab == tabLG) { - InitLgTab(); + _lgPanel?.UpdateInfo(); } else if (tcMain.SelectedTab == tabLog) { @@ -1005,31 +766,6 @@ NOTE: installing the service may cause a User Account Control popup."); } } - private void InitLgTab() - { - if (_lgService == null) - { - return; - } - - if (scLgController.Panel2.Controls.Count == 0) - { - var rcPanel = new RemoteControlPanel(_lgService, _lgService.GetRemoteControlButtons()); - rcPanel.Parent = scLgController.Panel2; - rcPanel.Dock = DockStyle.Fill; - } - chkLgRemoteControlShow.Checked = _lgService.Config.ShowRemoteControl; - scLgController.Panel2Collapsed = !_lgService.Config.ShowRemoteControl; - - FormUtils.BuildComboBox(cbxLgPresetTrigger, PresetTriggerType.Resume, PresetTriggerType.Shutdown, PresetTriggerType.Standby, PresetTriggerType.Startup, PresetTriggerType.Reserved5, PresetTriggerType.ScreensaverStart, PresetTriggerType.ScreensaverStop); - - if (!string.IsNullOrEmpty(_lgTabMessage)) - { - MessageForms.WarningOk(_lgTabMessage); - _lgTabMessage = null; - } - } - private void InitOptionsTab() { grpNvidiaOptions.Visible = _nvService != null; @@ -1106,113 +842,6 @@ NOTE: installing the service may cause a User Account Control popup."); } } - private void FillLgDevices() - { - var devices = _lgService.Devices; - - cbxLgDevices.Items.Clear(); - cbxLgDevices.Items.AddRange(devices.ToArray()); - - cbxLgPresetDevice.Items.Clear(); - cbxLgPresetDevice.Items.AddRange(devices.ToArray()); - var globalDevice = new LgDevice("Globally selected device", string.Empty, string.Empty, true, true); - cbxLgPresetDevice.Items.Insert(0, globalDevice); - - var device = _lgService.SelectedDevice; - - if (device != null) - { - cbxLgDevices.SelectedIndex = cbxLgDevices.Items.IndexOf(device); - } - - if (!devices.Any()) - { - var message = "It seems there's no LG TV available! Please make sure it's connected to the same network as this PC."; - - if (tcMain.SelectedTab == tabLG) - { - MessageForms.WarningOk(message); - } - else - { - _lgTabMessage = message; - } - } - - if (cbxLgApps.Items.Count == 0 && device != null) - { - _lgService.RefreshApps().ContinueWith((task) => BeginInvoke(() => FillLgApps(false))); - } - - btnLgDeviceConvertToCustom.Enabled = devices.Any(); - btnLgExpert.Enabled = devices.Any(); - btnLgGameBar.Enabled = devices.Any(); - - cbxLgDevices_SelectedIndexChanged(cbxLgDevices, null); - - SetLgDevicePowerOptions(); - } - - private void SetLgDevicePowerOptions() - { - var device = _lgService.SelectedDevice; - clbLgPower.Enabled = device != null; - - _disableEvents = true; - try - { - clbLgPower.SetItemChecked(0, device?.PowerOnAfterStartup ?? false); - clbLgPower.SetItemChecked(1, device?.PowerOnAfterResume ?? false); - clbLgPower.SetItemChecked(2, device?.PowerOffOnShutdown ?? false); - clbLgPower.SetItemChecked(3, device?.PowerOffOnStandby ?? false); - clbLgPower.SetItemChecked(4, device?.PowerOffOnScreenSaver ?? false); - clbLgPower.SetItemChecked(5, device?.PowerOnAfterScreenSaver ?? false); - clbLgPower.SetItemChecked(6, device?.PowerOnAfterManualPowerOff ?? false); - clbLgPower.SetItemChecked(7, device?.TriggersEnabled ?? true); - clbLgPower.SetItemChecked(8, device?.PowerOffByWindows ?? false); - clbLgPower.SetItemChecked(9, device?.PowerOnByWindows ?? false); - clbLgPower.SetItemChecked(10, device?.UseSecureConnection ?? false); - } - finally - { - _disableEvents = false; - } - } - - private void FillLgApps(bool forced) - { - var lgApps = _lgService?.GetApps(); - if (forced && (lgApps == null || !lgApps.Any())) - { - MessageForms.WarningOk("Could not refresh the apps. Check the log for details."); - return; - } - InitLgApps(); - } - - private void InitLgApps() - { - var lgApps = _lgService?.GetApps(); - - cbxLgApps.Items.Clear(); - if (lgApps != null) - { - cbxLgApps.Items.AddRange(lgApps.ToArray()); - } - - for (var i = 0; i < lvLgPresets.Items.Count; i++) - { - var item = lvLgPresets.Items[i]; - AddOrUpdateItemLg((LgPreset)item.Tag, item); - } - - var preset = GetSelectedLgPreset(); - if (preset != null) - { - cbxLgApps.SelectedIndex = lgApps == null ? -1 : lgApps.FindIndex(x => x.appId.Equals(preset.appId)); - } - } - private void UpdateTrayMenu(ToolStripMenuItem menu, IEnumerable presets, EventHandler eventHandler) { menu.DropDownItems.Clear(); @@ -1256,7 +885,7 @@ NOTE: installing the service may cause a User Account Control popup."); var item = sender as ToolStripMenuItem; var preset = (GamePreset)item.Tag; - ApplyGamePreset(preset); + _gamePanel?.ApplyGamePreset(preset); } private void trayIconContextMenu_Popup(object sender, EventArgs e) @@ -1303,78 +932,7 @@ NOTE: installing the service may cause a User Account Control popup."); var item = sender as ToolStripMenuItem; var preset = (LgPreset)item.Tag; - ApplyLgPreset(preset); - } - - private void btnDeleteLg_Click(object sender, EventArgs e) - { - var preset = GetSelectedLgPreset(); - - if (preset == null) - { - return; - } - - if (!string.IsNullOrEmpty(preset.shortcut)) - { - WinApi.UnregisterHotKey(Handle, preset.id); - } - - _lgService.GetPresets().Remove(preset); - - var item = lvLgPresets.SelectedItems[0]; - lvLgPresets.Items.Remove(item); - } - - private void btnAddLg_Click(object sender, EventArgs e) - { - AddOrUpdateItemLg(_lgService.CreateNewPreset()); - } - - private void ApplyLgPreset(LgPreset preset, bool reconnect = false, bool wait = false) - { - if (preset == null) - { - return; - } - - var applyTask = _lgService.ApplyPreset(preset, reconnect).ContinueWith((task) => BeginInvoke(() => LgPresetApplied(task))); - if (wait) - { - Utils.WaitForTask(applyTask); - } - } - - private void LgPresetApplied(Task task) - { - var result = task.Result; - if (!result) - { - MessageForms.WarningOk("Could not apply the preset (entirely). Check the log for details."); - } - } - - private bool ApplyGamePreset(GamePreset preset) - { - if (preset == null || _gameService == null) - { - return false; - } - try - { - var result = _gameService.ApplyPreset(preset, Program.AppContext); - if (!result) - { - throw new Exception("Error while applying Game-preset. At least one setting could not be applied. Check the log for details."); - } - - return true; - } - catch (Exception e) - { - MessageForms.ErrorOk($"Error applying Game-preset ({e.TargetSite.Name}): {e.Message}"); - return false; - } + _lgPanel?.ApplyLgPreset(preset); } private void LoadLog() @@ -1424,42 +982,6 @@ NOTE: installing the service may cause a User Account Control popup."); grpNVIDIAInfo.Visible = _nvService != null; } - private void btnLgRefreshApps_Click(object sender, EventArgs e) - { - _lgService.RefreshApps(true).ContinueWith((task) => BeginInvoke(() => FillLgApps(true))); - } - - private void cbxLgDevices_SelectedIndexChanged(object sender, EventArgs e) - { - cbxLgPcHdmiPort.Enabled = cbxLgDevices.SelectedIndex > -1; - if (cbxLgDevices.SelectedIndex == -1) - { - _lgService.SelectedDevice = null; - cbxLgPcHdmiPort.SelectedIndex = 0; - } - else - { - _lgService.SelectedDevice = (LgDevice)cbxLgDevices.SelectedItem; - cbxLgPcHdmiPort.SelectedIndex = _lgService.SelectedDevice.HDMIPortNumber; - } - chkLgRemoteControlShow.Enabled = _lgService.SelectedDevice != null; - btnLgRemoveDevice.Enabled = _lgService.SelectedDevice != null && _lgService.SelectedDevice.IsCustom; - btnLgDeviceConvertToCustom.Enabled = _lgService.SelectedDevice != null && !_lgService.SelectedDevice.IsCustom; - - SetLgDevicePowerOptions(); - } - - private void lvLgPresets_DoubleClick(object sender, EventArgs e) - { - ApplySelectedLgPreset(); - } - - private void ApplySelectedLgPreset() - { - var preset = GetSelectedLgPreset(); - ApplyLgPreset(preset); - } - private void btnRefreshNVIDIAInfo_Click(object sender, EventArgs e) { if (_nvService != null) @@ -1475,209 +997,6 @@ NOTE: installing the service may cause a User Account Control popup."); } } - private void btnLgAddButton_Click(object sender, EventArgs e) - { - mnuLgButtons.Show(btnLgAddButton, btnLgAddButton.PointToClient(Cursor.Position)); - } - - private void miLgAddButton_Click(object sender, EventArgs e) - { - var item = sender as ToolStripItem; - - FormUtils.AddStepToTextBox(edtStepsLg, item.Text); - } - - private void miLgAddAction_Click(object sender, EventArgs e) - { - var item = sender as ToolStripItem; - var action = item.Tag as LgDevice.InvokableAction; - - var value = ShowLgActionForm(action); - - if (!string.IsNullOrEmpty(value)) - { - var text = $"{action.Name}({value})"; - - FormUtils.AddStepToTextBox(edtStepsLg, text); - } - } - - private string ShowLgActionForm(LgDevice.InvokableAction action) - { - var text = action.Name; - var title = action.Title ?? action.Name; - - var value = string.Empty; - - if (action.EnumType == null) - { - if (action.MinValue != action.MaxValue) - { - List fields = new(); - - if (action.NumberOfValues == 1) - { - fields.Add(new MessageForms.FieldDefinition - { - Label = "Enter desired " + title, - FieldType = MessageForms.FieldType.Numeric, - MinValue = action.MinValue, - MaxValue = action.MaxValue, - }); - } - else - { - var array = Enumerable.Range(0, action.NumberOfValues); - - fields.AddRange(array.Select(i => new MessageForms.FieldDefinition - { - Label = "Value for " + i, - FieldType = MessageForms.FieldType.Numeric, - MinValue = action.MinValue, - MaxValue = action.MaxValue, - })); - } - - var values = MessageForms.ShowDialog($"Enter value for {title}", fields); - - if (!values.Any()) - { - return null; - } - - if (values.Count > 1) - { - value = string.Join("; ", values.Select(v => v.Value)); - } - else - { - value = values.First().Value.ToString(); - } - } - } - else - { - var dropDownValues = new List(); - foreach (var enumValue in Enum.GetValues(action.EnumType)) - { - var description = Utils.GetDescription(action.EnumType, enumValue as IConvertible) ?? enumValue.ToString().Replace("_", ""); - dropDownValues.Add(description); - } - - var values = MessageForms.ShowDialog("Choose value", new[] { - new MessageForms.FieldDefinition - { - Label = "Choose desired " + title, - FieldType = MessageForms.FieldType.DropDown, - Values = dropDownValues - } - }); - - if (!values.Any()) - { - return null; - } - - value = values.First().Value.ToString(); - var enumName = Utils.GetEnumNameByDescription(action.EnumType, value); - if (enumName != null) - { - value = enumName; - } - } - - return value; - } - - private void miLgAddNvPreset_Click(object sender, EventArgs e) - { - var item = sender as ToolStripItem; - var preset = item.Tag as NvPreset; - - var text = $"NvPreset({preset.name})"; - - FormUtils.AddStepToTextBox(edtStepsLg, text); - } - - private void miLgAddAmdPreset_Click(object sender, EventArgs e) - { - var item = sender as ToolStripItem; - var preset = item.Tag as AmdPreset; - - var text = $"AmdPreset({preset.name})"; - - FormUtils.AddStepToTextBox(edtStepsLg, text); - } - - private void clbLgPower_ItemCheck(object sender, ItemCheckEventArgs e) - { - if (!_initialized || _disableEvents) - { - return; - } - - var device = _lgService?.SelectedDevice; - if (device == null) - { - return; - } - - if (e.Index is 0 or 1 or 4 or 7 && !(device.PowerOnAfterResume || device.PowerOnAfterStartup || device.PowerOnAfterScreenSaver || device.PowerOnByWindows)) - { - MessageForms.InfoOk( -@"Be sure to activate the following setting on the TV, or the app will not be able to wake the TV: - -Connection > Mobile TV On > Turn on via Wi-Fi (Networked Standby Mode) - -See Options to test this functionality. -You can also activate this option by using the Expert-button and selecting Wake-On-LAN > Enabled." - ); - } - - BeginInvoke(() => - { - device.PowerOnAfterStartup = clbLgPower.GetItemChecked(0); - device.PowerOnAfterResume = clbLgPower.GetItemChecked(1); - device.PowerOffOnShutdown = clbLgPower.GetItemChecked(2); - device.PowerOffOnStandby = clbLgPower.GetItemChecked(3); - device.PowerOffOnScreenSaver = clbLgPower.GetItemChecked(4); - device.PowerOnAfterScreenSaver = clbLgPower.GetItemChecked(5); - device.PowerOnAfterManualPowerOff = clbLgPower.GetItemChecked(6); - device.TriggersEnabled = clbLgPower.GetItemChecked(7); - device.PowerOffByWindows = clbLgPower.GetItemChecked(8); - device.PowerOnByWindows = clbLgPower.GetItemChecked(9); - device.UseSecureConnection = clbLgPower.GetItemChecked(10); - - _lgService.InstallEventHandlers(); - - if (e.Index == 10) - { - _lgService.RefreshDevices().ContinueWith((_) => BeginInvoke(() => FillLgDevices())); - } - }); - } - - private void edtLgPowerOnAfterResumeDelay_ValueChanged(object sender, EventArgs e) - { - _lgService.Config.PowerOnRetries = (int)edtLgMaxPowerOnRetries.Value; - } - - private void chkFixChromeFonts_CheckedChanged(object sender, EventArgs e) - { - if (_initialized) - { - _config.FixChromeFonts = chkFixChromeFonts.Checked; - if (chkFixChromeFonts.Checked) - { - Utils.ExecuteElevated(StartUpParams.ActivateChromeFontFixParam); - } - else - { - Utils.ExecuteElevated(StartUpParams.DeactivateChromeFontFixParam); - } - } - } - private void btnLGTestPower_Click(object sender, EventArgs e) { var text = @@ -1764,24 +1083,6 @@ 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(() => FillLgDevices())); - } - private void FillGradient() { if (pbGradient.Image == null) @@ -1939,22 +1240,6 @@ Do you want to continue?"; (_lgService?.GetPresets().Any(x => x.id != presetId && shortcut.Equals(x.shortcut)) ?? false); } - private void edtShortcutLg_TextChanged(object sender, EventArgs e) - { - var text = edtShortcutLg.Text; - - var preset = GetSelectedLgPreset(); - - if (preset == null || string.IsNullOrEmpty(text)) - { - edtShortcutLg.ForeColor = SystemColors.WindowText; - } - else - { - edtShortcutLg.ForeColor = ShortCutExists(text, preset.id) ? Color.Red : SystemColors.WindowText; - } - } - private void chkMinimizeToSystemTray_CheckedChanged(object sender, EventArgs e) { if (_initialized) @@ -1964,328 +1249,6 @@ Do you want to continue?"; } } - private void btnLgAddDevice_Click(object sender, EventArgs e) - { - var values = MessageForms.ShowDialog("Add tv", new[] { "Name", "Ip-address", "MAC-address" }, ValidateAddDevice); - if (values.Any()) - { - var device = new LgDevice(values[0].Value.ToString(), values[1].Value.ToString(), values[2].Value.ToString()); - - var form = MessageForms.ShowProgress("Connecting to device..."); - - var result = false; - Enabled = false; - try - { - var task = device.TestConnection(); - - result = Utils.WaitForTask(task); - } - finally - { - form.Close(); - Enabled = true; - } - - if (!result && MessageForms.QuestionYesNo("Unable to connect to the device. Are you sure you want to add it?") != DialogResult.Yes) - { - return; - } - - _lgService.AddCustomDevice(device); - - FillLgDevices(); - } - } - - private string ValidateAddDevice(IEnumerable values) - { - if (values.Any(v => string.IsNullOrEmpty(v.Value?.ToString()))) - { - return "Please fill in all the fields"; - } - - return null; - } - - private void btnLgRemoveDevice_Click(object sender, EventArgs e) - { - if (MessageForms.QuestionYesNo("Are you sure you want to remove this device?") != DialogResult.Yes) - { - return; - } - - var device = _lgService.SelectedDevice; - - if (device != null) - { - _lgService.RemoveCustomDevice(device); - - FillLgDevices(); - } - } - - private void mnuLgButtons_Opening(object sender, CancelEventArgs e) - { - mnuLgActions.DropDownItems.Clear(); - - var preset = GetSelectedLgPreset(); - - if (preset == null) - { - return; - } - - var device = _lgService.GetPresetDevice(preset); - - BuildLgActionMenu(device, mnuLgActions.DropDownItems, mnuLgActions.Name, miLgAddAction_Click); - FormUtils.BuildServicePresetsMenu(mnuLgNvPresets, _nvService, "NVIDIA", miLgAddNvPreset_Click); - FormUtils.BuildServicePresetsMenu(mnuLgAmdPresets, _amdService, "AMD", miLgAddAmdPreset_Click); - } - - private void btnLgDeviceConvertToCustom_Click(object sender, EventArgs e) - { - if (MessageForms.QuestionYesNo( -@"This will convert the automatically detected device to a custom variant. -This means that the device will remain here even if it is not detected anymore. -Do you want to continue?" - ) != DialogResult.Yes) - { - return; - } - - _lgService.SelectedDevice.ConvertToCustom(); - - FillLgDevices(); - } - - private void chkLgRemoteControlShow_CheckedChanged(object sender, EventArgs e) - { - scLgController.Panel2Collapsed = !chkLgRemoteControlShow.Checked; - _lgService.Config.ShowRemoteControl = chkLgRemoteControlShow.Checked; - } - - private void mnuLgExpert_Opening(object sender, CancelEventArgs e) - { - var device = _lgService.SelectedDevice; - - var eligibleModels = new[] { "B9", "C9", "E9", "W9", "C2", "G2" }; - var eligibleModelsEnable = new[] { "B9", "C9", "E9", "W9" }; - - var visible = eligibleModels.Any(m => device?.ModelName?.Contains(m) == true); - var enableVisible = eligibleModelsEnable.Any(m => device?.ModelName?.Contains(m) == true); - mnuLgOLEDMotionPro.Visible = visible; - miLgEnableMotionPro.Visible = enableVisible; - miLgExpertSeparator1.Visible = visible; - - BuildLgActionMenu(device, mnuLgExpert.Items, mnuLgExpert.Name, btnLgExpertColorGamut_Click, _lgService.Config.ShowAdvancedActions, true); - } - - private void BuildLgActionMenu(LgDevice device, ToolStripItemCollection parent, string parentName, EventHandler clickEvent, bool showAdvanced = false, bool showGameBar = false) - { - if (device == null) - { - return; - } - - var actions = device.GetInvokableActions(showAdvanced); - var gameBarActions = device.GetInvokableActionsForGameBar(); - var activatedGameBarActions = device.GetActionsForGameBar(); - - const string gameBarName = "miGameBar"; - - var expertActions = actions.Where(a => a.EnumType != null || a.MaxValue > a.MinValue).ToList(); - - var categories = expertActions.Select(a => a.Category ?? "misc").Where(c => !string.IsNullOrEmpty(c)).Distinct(); - - foreach (var category in categories) - { - var catMenuItem = FormUtils.BuildDropDownMenuEx(parent, parentName, Utils.FirstCharUpperCase(category), null, null, category); - - foreach (var action in expertActions.Where(a => (a.Category ?? "misc") == category)) - { - if (!showGameBar) - { - var text = action.Title ?? action.Name; - - var item = catMenuItem.DropDownItems.Add(text); - item.Tag = action; - item.Click += clickEvent; - continue; - } - - var menu = FormUtils.BuildDropDownMenuEx(catMenuItem.DropDownItems, catMenuItem.Name, action.Title, action.EnumType, clickEvent, action, (int)action.MinValue, (int)action.MaxValue, action.NumberOfValues > 1); - - if (!gameBarActions.Contains(action)) - { - continue; - } - - var itemName = $"{menu.Name}_{gameBarName}"; - var gameBarItem = (ToolStripMenuItem)menu.DropDownItems.Find(itemName, false).FirstOrDefault(); - - if (gameBarItem == null) - { - var separator = new ToolStripSeparator(); - menu.DropDownItems.Add(separator); - - gameBarItem = (ToolStripMenuItem)menu.DropDownItems.Add("Show in Game Bar", null, miLgGameBarToggle_Click); - gameBarItem.CheckOnClick = true; - gameBarItem.Checked = activatedGameBarActions.Contains(action); - gameBarItem.Name = itemName; - gameBarItem.Tag = action.Name; - } - } - } - - if (!showAdvanced) - { - return; - } - - var presetActions = actions.Where(a => a.Preset != null); - - if (presetActions.Any() && parent.Find("miLgExpertActionsSeparator", false).Length == 0) - { - parent.Add(new ToolStripSeparator - { - Name = "miLgExpertActionsSeparator" - }); - } - - foreach (var presetAction in presetActions) - { - var menu = FormUtils.BuildDropDownMenuEx(parent, parentName, presetAction.Name, null, btnLgExpertPresetAction_Click, presetAction.Preset); - } - } - - private void miLgGameBarToggle_Click(object sender, EventArgs e) - { - var device = _lgService.SelectedDevice; - - if (device == null) - { - return; - } - - var item = sender as ToolStripMenuItem; - if (item.Checked) - { - device.AddGameBarAction((string)item.Tag); - } - else - { - device.RemoveGameBarAction((string)item.Tag); - } - } - - private void btnLgExpert_Click(object sender, EventArgs e) - { - mnuLgExpert.Show(btnLgExpert, btnLgExpert.PointToClient(Cursor.Position)); - } - - private void btnLgExpertColorGamut_Click(object sender, EventArgs e) - { - var item = sender as ToolStripItem; - var action = item.Tag as LgDevice.InvokableAction; - var value = item.AccessibleName ?? item.Text; - - if (action.NumberOfValues > 1) - { - ApplyLgExpertValueRange(action); - return; - } - - try - { - _lgService.SelectedDevice?.ExecuteAction(action, new[] { value }); - } - catch (InvalidOperationException ex) - { - Logger.Error(ex); - - MessageForms.ErrorOk("Error exectuting action: " + ex.Message); - } - } - - private void ApplyLgExpertValueRange(LgDevice.InvokableAction action) - { - var value = ShowLgActionForm(action); - - if (value == null) - { - return; - } - - var values = value.Split(";"); - - _lgService.SelectedDevice?.ExecuteAction(action, values); - } - - private void btnLgExpertPresetAction_Click(object sender, EventArgs e) - { - var item = sender as ToolStripItem; - var preset = (LgPreset)item.Tag; - - _lgService.ApplyPreset(preset).ConfigureAwait(false); - } - - private void miLgEnableMotionPro_Click(object sender, EventArgs e) - { - if (MessageForms.QuestionYesNo("Are you sure you want to enable OLED Motion Pro? This app and its creator are in no way accountable for any damages it may cause to your tv.") == DialogResult.Yes) - { - _lgService.SelectedDevice?.SetOLEDMotionPro("OLED Motion Pro"); - - MessageForms.InfoOk("Setting applied."); - } - } - - private void miLgDisableMotionPro_Click(object sender, EventArgs e) - { - _lgService.SelectedDevice?.SetOLEDMotionPro("OLED Motion"); - - MessageForms.InfoOk("Setting applied."); - } - - private void cbxLgApps_KeyPress(object sender, KeyPressEventArgs e) - { - if (e.KeyChar == ((char)Keys.Back)) - { - cbxLgApps.SelectedIndex = -1; - } - } - - private void btnLgPresetEditTriggerConditions_Click(object sender, EventArgs e) - { - var preset = GetSelectedLgPreset(); - - if (preset == null) - { - return; - } - - var dropDownValues = Utils.GetDescriptions(fromValue: 1); - - var values = MessageForms.ShowDialog("Set trigger conditions", new[] { - new MessageForms.FieldDefinition - { - Label = "Set desired trigger conditions", - FieldType = MessageForms.FieldType.Flags, - Values = dropDownValues, - Value = edtLgPresetTriggerConditions.Tag ?? 0 - } - }); - - if (!values.Any()) - { - return; - } - - var value = (PresetConditionType)values.First().Value; - edtLgPresetTriggerConditions.Tag = (PresetConditionType)values.First().Value; - edtLgPresetTriggerConditions.Text = Utils.GetDescriptions((int)value).Join(", "); - } - private void chkCheckForUpdates_CheckedChanged(object sender, EventArgs e) { if (_initialized) @@ -2327,66 +1290,6 @@ The InStart and Software Update items are now visible under the Expert-button." _lgService.Config.ShowAdvancedActions = chkLgShowAdvancedActions.Checked; } - private void ToggleGameBar() - { - if (_gameBarForm == null || !_gameBarForm.Visible) - { - if (_gameBarForm == null || _gameBarForm.IsDisposed) - { - if (_lgService?.SelectedDevice == null) - { - return; - } - - _gameBarForm = new LgGameBar(_lgService); - } - - _gameBarForm.Show(); - _gameBarForm.Activate(); - } - else - { - _gameBarForm?.Hide(); - } - } - - private void btnLgGameBar_Click(object sender, EventArgs e) - { - ToggleGameBar(); - } - - private void edtLgGameBarShortcut_KeyDown(object sender, KeyEventArgs e) - { - ((TextBox)sender).Text = Utils.FormatKeyboardShortcut(e); - } - - private void edtLgGameBarShortcut_KeyUp(object sender, KeyEventArgs e) - { - Utils.HandleKeyboardShortcutUp(e); - } - - private void edtLgGameBarShortcut_TextChanged(object sender, EventArgs e) - { - var text = edtLgGameBarShortcut.Text; - - var blnOk = string.IsNullOrEmpty(text) || !ShortCutExists(text); - edtLgGameBarShortcut.ForeColor = blnOk ? Color.Red : SystemColors.WindowText; - - if (blnOk) - { - _lgService.Config.GameBarShortcut = text; - - if (string.IsNullOrEmpty(text)) - { - WinApi.UnregisterHotKey(Handle, SHORTCUTID_GAMEBAR); - } - else - { - Utils.RegisterShortcut(Handle, SHORTCUTID_GAMEBAR, text); - } - } - } - private void chkGdiScaling_CheckedChanged(object sender, EventArgs e) { _config.UseGdiScaling = chkGdiScaling.Checked; @@ -2426,100 +1329,6 @@ The InStart and Software Update items are now visible under the Expert-button." _lgService.Config.ShutdownDelay = (int)edtLgOptionShutdownDelay.Value; } - private void cbxLgPcHdmiPort_SelectedIndexChanged(object sender, EventArgs e) - { - if (_lgService?.SelectedDevice == null) - { - return; - } - - _lgService.SelectedDevice.HDMIPortNumber = cbxLgPcHdmiPort.SelectedIndex; - } - - private void lvLgPresets_ColumnClick(object sender, ColumnClickEventArgs e) - { - FormUtils.ListViewSort(sender, e); - } - - private void mnuLgProgram_Click(object sender, EventArgs e) - { - var file = Utils.SelectFile(); - - if (file != null) - { - FormUtils.AddStepToTextBox(edtStepsLg, $"StartProgram({file.FullName})"); - } - } - - private void btnLgSettings_Click(object sender, EventArgs e) - { - var shortcut = FormUtils.EditShortcut(_config.LgQuickAccessShortcut, "Quick Access shortcut", "LG controller settings"); - - if (shortcut == null) - { - return; - } - - var clear = !string.IsNullOrEmpty(_config.LgQuickAccessShortcut); - - _config.LgQuickAccessShortcut = shortcut; - - Utils.RegisterShortcut(Handle, SHORTCUTID_LGQA, _config.LgQuickAccessShortcut, clear); - } - - private void lvLgPresets_ItemChecked(object sender, ItemCheckedEventArgs e) - { - FormUtils.ListViewItemChecked(lvLgPresets, e); - } - - private void lvNvPresets_ItemCheck(object sender, ItemCheckEventArgs e) - { - var listView = sender as ListView; - - if (!listView.Focused) - { - return; - } - - - var point = listView.PointToClient(Cursor.Position); - - if (point.X >= 20) - { - return; - } - - var listItem = listView.Items[e.Index]; - - if (listItem.Tag == null) - { - MessageForms.WarningOk("Quick Access cannot be enabled for this item."); - e.NewValue = e.CurrentValue; - } - - if (e.NewValue == CheckState.Checked && string.IsNullOrEmpty(listItem.Text)) - { - MessageForms.WarningOk("A name must be entered before enabling Quick Access."); - e.NewValue = e.CurrentValue; - } - } - - private void btnAmdSettings_Click(object sender, EventArgs e) - { - var shortcut = FormUtils.EditShortcut(_config.AmdQuickAccessShortcut, "Quick Access shortcut", "AMD controller settings"); - - if (shortcut == null) - { - return; - } - - var clear = !string.IsNullOrEmpty(_config.AmdQuickAccessShortcut); - - _config.AmdQuickAccessShortcut = shortcut; - - Utils.RegisterShortcut(Handle, SHORTCUTID_AMDQA, _config.AmdQuickAccessShortcut, clear); - } - private void rbElevationNone_CheckedChanged(object sender, EventArgs e) { if (!_initialized) @@ -2680,16 +1489,6 @@ Currently ColorControl is {(Utils.IsAdministrator() ? "" : "not ")}running as ad } } - private void chkLgSetSelectedDeviceByWol_CheckedChanged(object sender, EventArgs e) - { - if (!_initialized) - { - return; - } - - _lgService.Config.SetSelectedDeviceByPowerOn = chkLgSetSelectedDeviceByPowerOn.Checked; - } - private void btnUpdate_Click(object sender, EventArgs e) { if (_downloadUrl != null) @@ -2717,5 +1516,68 @@ Currently ColorControl is {(Utils.IsAdministrator() ? "" : "not ")}running as ad UpdateDitherSettings(); } + + private void edtLgPowerOnAfterResumeDelay_ValueChanged(object sender, EventArgs e) + { + _lgService.Config.PowerOnRetries = (int)edtLgMaxPowerOnRetries.Value; + } + + private void chkFixChromeFonts_CheckedChanged(object sender, EventArgs e) + { + if (_initialized) + { + _config.FixChromeFonts = chkFixChromeFonts.Checked; + if (chkFixChromeFonts.Checked) + { + Utils.ExecuteElevated(StartUpParams.ActivateChromeFontFixParam); + } + else + { + Utils.ExecuteElevated(StartUpParams.DeactivateChromeFontFixParam); + } + } + } + + private void chkLgSetSelectedDeviceByWol_CheckedChanged(object sender, EventArgs e) + { + if (!_initialized) + { + return; + } + + _lgService.Config.SetSelectedDeviceByPowerOn = chkLgSetSelectedDeviceByPowerOn.Checked; + } + + private void edtLgGameBarShortcut_KeyDown(object sender, KeyEventArgs e) + { + ((TextBox)sender).Text = Utils.FormatKeyboardShortcut(e); + } + + private void edtLgGameBarShortcut_KeyUp(object sender, KeyEventArgs e) + { + Utils.HandleKeyboardShortcutUp(e); + } + + private void edtLgGameBarShortcut_TextChanged(object sender, EventArgs e) + { + var text = edtLgGameBarShortcut.Text; + + var blnOk = string.IsNullOrEmpty(text) || !ShortCutExists(text); + edtLgGameBarShortcut.ForeColor = blnOk ? Color.Red : SystemColors.WindowText; + + if (blnOk) + { + _lgService.Config.GameBarShortcut = text; + + if (string.IsNullOrEmpty(text)) + { + WinApi.UnregisterHotKey(Handle, SHORTCUTID_GAMEBAR); + } + else + { + Utils.RegisterShortcut(Handle, SHORTCUTID_GAMEBAR, text); + } + } + } } } \ No newline at end of file diff --git a/ColorControl/MainForm.resx b/ColorControl/MainForm.resx index 5d309ce..83c5e62 100644 --- a/ColorControl/MainForm.resx +++ b/ColorControl/MainForm.resx @@ -63,18 +63,6 @@ 147, 17 - - 705, 16 - - - 414, 15 - - - 416, 50 - - - 590, 47 - diff --git a/ColorControl/Services/GameLauncher/GamePanel.cs b/ColorControl/Services/GameLauncher/GamePanel.cs index c967968..40e9e6e 100644 --- a/ColorControl/Services/GameLauncher/GamePanel.cs +++ b/ColorControl/Services/GameLauncher/GamePanel.cs @@ -108,7 +108,7 @@ namespace ColorControl.Services.GameLauncher ApplyGamePreset(preset); } - private bool ApplyGamePreset(GamePreset preset) + internal bool ApplyGamePreset(GamePreset preset) { if (preset == null || _gameService == null) { diff --git a/ColorControl/Services/LG/LgPanel.Designer.cs b/ColorControl/Services/LG/LgPanel.Designer.cs new file mode 100644 index 0000000..3c71281 --- /dev/null +++ b/ColorControl/Services/LG/LgPanel.Designer.cs @@ -0,0 +1,899 @@ +namespace ColorControl.Services.LG +{ + partial class LgPanel + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.scLgController = new System.Windows.Forms.SplitContainer(); + this.btnLgSettings = new System.Windows.Forms.Button(); + this.chkLgQuickAccess = new System.Windows.Forms.CheckBox(); + this.cbxLgPcHdmiPort = new System.Windows.Forms.ComboBox(); + this.lblLgPcHdmiPort = new System.Windows.Forms.Label(); + this.edtLgPresetDescription = new System.Windows.Forms.TextBox(); + this.lblLgPresetDescription = new System.Windows.Forms.Label(); + this.btnLgDeviceOptionsHelp = new System.Windows.Forms.Button(); + this.btnLgGameBar = new System.Windows.Forms.Button(); + this.btnLgPresetEditTriggerConditions = new System.Windows.Forms.Button(); + this.edtLgPresetTriggerConditions = new System.Windows.Forms.TextBox(); + this.lblLgPresetExcludedProcesses = new System.Windows.Forms.Label(); + this.edtLgPresetExcludedProcesses = new System.Windows.Forms.TextBox(); + this.lblLgPresetIncludedProcesses = new System.Windows.Forms.Label(); + this.edtLgPresetIncludedProcesses = new System.Windows.Forms.TextBox(); + this.lblLgPresetTriggerCondition = new System.Windows.Forms.Label(); + this.cbxLgPresetTrigger = new System.Windows.Forms.ComboBox(); + this.lblLgPresetTrigger = new System.Windows.Forms.Label(); + this.btnLgExpert = new System.Windows.Forms.Button(); + this.mnuLgExpert = new System.Windows.Forms.ContextMenuStrip(this.components); + this.mnuLgOLEDMotionPro = new System.Windows.Forms.ToolStripMenuItem(); + this.miLgEnableMotionPro = new System.Windows.Forms.ToolStripMenuItem(); + this.miLgDisableMotionPro = new System.Windows.Forms.ToolStripMenuItem(); + this.miLgExpertSeparator1 = new System.Windows.Forms.ToolStripSeparator(); + this.chkLgRemoteControlShow = new System.Windows.Forms.CheckBox(); + this.label3 = new System.Windows.Forms.Label(); + this.cbxLgDevices = new System.Windows.Forms.ComboBox(); + this.btnLgDeviceConvertToCustom = new System.Windows.Forms.Button(); + this.cbxLgApps = new System.Windows.Forms.ComboBox(); + this.lvLgPresets = new System.Windows.Forms.ListView(); + this.label5 = new System.Windows.Forms.Label(); + this.cbxLgPresetDevice = new System.Windows.Forms.ComboBox(); + this.btnDeleteLg = new System.Windows.Forms.Button(); + this.btnApplyLg = new System.Windows.Forms.Button(); + this.lblDeviceFilter = new System.Windows.Forms.Label(); + this.lblLgPresetDevice = new System.Windows.Forms.Label(); + this.btnAddLg = new System.Windows.Forms.Button(); + this.edtShortcutLg = new System.Windows.Forms.TextBox(); + this.edtLgDeviceFilter = new System.Windows.Forms.TextBox(); + this.btnLgRemoveDevice = new System.Windows.Forms.Button(); + this.btnLgRefreshApps = new System.Windows.Forms.Button(); + this.label2 = new System.Windows.Forms.Label(); + this.label1 = new System.Windows.Forms.Label(); + this.btnLgAddDevice = new System.Windows.Forms.Button(); + this.edtNameLg = new System.Windows.Forms.TextBox(); + this.btnSetShortcutLg = new System.Windows.Forms.Button(); + this.edtStepsLg = new System.Windows.Forms.TextBox(); + this.btnLgAddButton = new System.Windows.Forms.Button(); + this.mnuLgButtons = new System.Windows.Forms.ContextMenuStrip(this.components); + this.mnuLgRcButtons = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuLgActions = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuLgNvPresets = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuLgAmdPresets = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuLgProgram = new System.Windows.Forms.ToolStripMenuItem(); + this.btnCloneLg = new System.Windows.Forms.Button(); + this.lblStepsLg = new System.Windows.Forms.Label(); + this.btnLgDeviceFilterRefresh = new System.Windows.Forms.Button(); + this.clbLgPower = new System.Windows.Forms.CheckedListBox(); + this.lblLgError = new System.Windows.Forms.Label(); + ((System.ComponentModel.ISupportInitialize)(this.scLgController)).BeginInit(); + this.scLgController.Panel1.SuspendLayout(); + this.scLgController.SuspendLayout(); + this.mnuLgExpert.SuspendLayout(); + this.mnuLgButtons.SuspendLayout(); + this.SuspendLayout(); + // + // scLgController + // + this.scLgController.Dock = System.Windows.Forms.DockStyle.Fill; + this.scLgController.Location = new System.Drawing.Point(0, 0); + this.scLgController.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + this.scLgController.Name = "scLgController"; + // + // scLgController.Panel1 + // + this.scLgController.Panel1.Controls.Add(this.btnLgSettings); + this.scLgController.Panel1.Controls.Add(this.chkLgQuickAccess); + this.scLgController.Panel1.Controls.Add(this.cbxLgPcHdmiPort); + this.scLgController.Panel1.Controls.Add(this.lblLgPcHdmiPort); + this.scLgController.Panel1.Controls.Add(this.edtLgPresetDescription); + this.scLgController.Panel1.Controls.Add(this.lblLgPresetDescription); + this.scLgController.Panel1.Controls.Add(this.btnLgDeviceOptionsHelp); + this.scLgController.Panel1.Controls.Add(this.btnLgGameBar); + this.scLgController.Panel1.Controls.Add(this.btnLgPresetEditTriggerConditions); + this.scLgController.Panel1.Controls.Add(this.edtLgPresetTriggerConditions); + this.scLgController.Panel1.Controls.Add(this.lblLgPresetExcludedProcesses); + this.scLgController.Panel1.Controls.Add(this.edtLgPresetExcludedProcesses); + this.scLgController.Panel1.Controls.Add(this.lblLgPresetIncludedProcesses); + this.scLgController.Panel1.Controls.Add(this.edtLgPresetIncludedProcesses); + this.scLgController.Panel1.Controls.Add(this.lblLgPresetTriggerCondition); + this.scLgController.Panel1.Controls.Add(this.cbxLgPresetTrigger); + this.scLgController.Panel1.Controls.Add(this.lblLgPresetTrigger); + this.scLgController.Panel1.Controls.Add(this.btnLgExpert); + this.scLgController.Panel1.Controls.Add(this.chkLgRemoteControlShow); + this.scLgController.Panel1.Controls.Add(this.label3); + this.scLgController.Panel1.Controls.Add(this.cbxLgDevices); + this.scLgController.Panel1.Controls.Add(this.btnLgDeviceConvertToCustom); + this.scLgController.Panel1.Controls.Add(this.cbxLgApps); + this.scLgController.Panel1.Controls.Add(this.lvLgPresets); + this.scLgController.Panel1.Controls.Add(this.label5); + this.scLgController.Panel1.Controls.Add(this.cbxLgPresetDevice); + this.scLgController.Panel1.Controls.Add(this.btnDeleteLg); + this.scLgController.Panel1.Controls.Add(this.btnApplyLg); + this.scLgController.Panel1.Controls.Add(this.lblDeviceFilter); + this.scLgController.Panel1.Controls.Add(this.lblLgPresetDevice); + this.scLgController.Panel1.Controls.Add(this.btnAddLg); + this.scLgController.Panel1.Controls.Add(this.edtShortcutLg); + this.scLgController.Panel1.Controls.Add(this.edtLgDeviceFilter); + this.scLgController.Panel1.Controls.Add(this.btnLgRemoveDevice); + this.scLgController.Panel1.Controls.Add(this.btnLgRefreshApps); + this.scLgController.Panel1.Controls.Add(this.label2); + this.scLgController.Panel1.Controls.Add(this.label1); + this.scLgController.Panel1.Controls.Add(this.btnLgAddDevice); + this.scLgController.Panel1.Controls.Add(this.edtNameLg); + this.scLgController.Panel1.Controls.Add(this.btnSetShortcutLg); + this.scLgController.Panel1.Controls.Add(this.edtStepsLg); + this.scLgController.Panel1.Controls.Add(this.btnLgAddButton); + this.scLgController.Panel1.Controls.Add(this.btnCloneLg); + this.scLgController.Panel1.Controls.Add(this.lblStepsLg); + this.scLgController.Panel1.Controls.Add(this.btnLgDeviceFilterRefresh); + this.scLgController.Panel1.Controls.Add(this.clbLgPower); + this.scLgController.Panel1.Controls.Add(this.lblLgError); + this.scLgController.Panel1MinSize = 750; + this.scLgController.Panel2MinSize = 150; + this.scLgController.Size = new System.Drawing.Size(1114, 539); + this.scLgController.SplitterDistance = 900; + this.scLgController.SplitterWidth = 5; + this.scLgController.TabIndex = 43; + // + // btnLgSettings + // + this.btnLgSettings.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.btnLgSettings.Location = new System.Drawing.Point(808, 284); + this.btnLgSettings.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + this.btnLgSettings.Name = "btnLgSettings"; + this.btnLgSettings.Size = new System.Drawing.Size(88, 27); + this.btnLgSettings.TabIndex = 64; + this.btnLgSettings.Text = "Settings..."; + this.btnLgSettings.UseVisualStyleBackColor = true; + this.btnLgSettings.Click += new System.EventHandler(this.btnLgSettings_Click); + // + // chkLgQuickAccess + // + this.chkLgQuickAccess.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.chkLgQuickAccess.AutoSize = true; + this.chkLgQuickAccess.Enabled = false; + this.chkLgQuickAccess.Location = new System.Drawing.Point(341, 320); + this.chkLgQuickAccess.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + this.chkLgQuickAccess.Name = "chkLgQuickAccess"; + this.chkLgQuickAccess.Size = new System.Drawing.Size(96, 19); + this.chkLgQuickAccess.TabIndex = 63; + this.chkLgQuickAccess.Text = "Quick Access"; + this.chkLgQuickAccess.UseVisualStyleBackColor = true; + // + // cbxLgPcHdmiPort + // + this.cbxLgPcHdmiPort.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cbxLgPcHdmiPort.FormattingEnabled = true; + this.cbxLgPcHdmiPort.Items.AddRange(new object[] { + "None", + "HDMI1", + "HDMI2", + "HDMI3", + "HDMI4"}); + this.cbxLgPcHdmiPort.Location = new System.Drawing.Point(667, 42); + this.cbxLgPcHdmiPort.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + this.cbxLgPcHdmiPort.Name = "cbxLgPcHdmiPort"; + this.cbxLgPcHdmiPort.Size = new System.Drawing.Size(86, 23); + this.cbxLgPcHdmiPort.TabIndex = 62; + this.cbxLgPcHdmiPort.SelectedIndexChanged += new System.EventHandler(this.cbxLgPcHdmiPort_SelectedIndexChanged); + // + // lblLgPcHdmiPort + // + this.lblLgPcHdmiPort.AutoSize = true; + this.lblLgPcHdmiPort.Location = new System.Drawing.Point(577, 45); + this.lblLgPcHdmiPort.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.lblLgPcHdmiPort.Name = "lblLgPcHdmiPort"; + this.lblLgPcHdmiPort.Size = new System.Drawing.Size(84, 15); + this.lblLgPcHdmiPort.TabIndex = 61; + this.lblLgPcHdmiPort.Text = "PC HDMI port:"; + // + // edtLgPresetDescription + // + this.edtLgPresetDescription.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.edtLgPresetDescription.Enabled = false; + this.edtLgPresetDescription.Location = new System.Drawing.Point(100, 489); + this.edtLgPresetDescription.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + this.edtLgPresetDescription.Multiline = true; + this.edtLgPresetDescription.Name = "edtLgPresetDescription"; + this.edtLgPresetDescription.Size = new System.Drawing.Size(700, 43); + this.edtLgPresetDescription.TabIndex = 60; + // + // lblLgPresetDescription + // + this.lblLgPresetDescription.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.lblLgPresetDescription.AutoSize = true; + this.lblLgPresetDescription.Location = new System.Drawing.Point(6, 494); + this.lblLgPresetDescription.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.lblLgPresetDescription.Name = "lblLgPresetDescription"; + this.lblLgPresetDescription.Size = new System.Drawing.Size(70, 15); + this.lblLgPresetDescription.TabIndex = 59; + this.lblLgPresetDescription.Text = "Description:"; + // + // btnLgDeviceOptionsHelp + // + this.btnLgDeviceOptionsHelp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnLgDeviceOptionsHelp.Location = new System.Drawing.Point(873, 70); + this.btnLgDeviceOptionsHelp.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + this.btnLgDeviceOptionsHelp.Name = "btnLgDeviceOptionsHelp"; + this.btnLgDeviceOptionsHelp.Size = new System.Drawing.Size(22, 27); + this.btnLgDeviceOptionsHelp.TabIndex = 58; + this.btnLgDeviceOptionsHelp.Text = "?"; + this.btnLgDeviceOptionsHelp.UseVisualStyleBackColor = true; + this.btnLgDeviceOptionsHelp.Click += new System.EventHandler(this.btnLgDeviceOptionsHelp_Click); + // + // btnLgGameBar + // + this.btnLgGameBar.Location = new System.Drawing.Point(478, 40); + this.btnLgGameBar.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + this.btnLgGameBar.Name = "btnLgGameBar"; + this.btnLgGameBar.Size = new System.Drawing.Size(88, 27); + this.btnLgGameBar.TabIndex = 55; + this.btnLgGameBar.Text = "Game Bar"; + this.btnLgGameBar.UseVisualStyleBackColor = true; + this.btnLgGameBar.Click += new System.EventHandler(this.btnLgGameBar_Click); + // + // btnLgPresetEditTriggerConditions + // + this.btnLgPresetEditTriggerConditions.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.btnLgPresetEditTriggerConditions.Enabled = false; + this.btnLgPresetEditTriggerConditions.Location = new System.Drawing.Point(804, 347); + this.btnLgPresetEditTriggerConditions.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + this.btnLgPresetEditTriggerConditions.Name = "btnLgPresetEditTriggerConditions"; + this.btnLgPresetEditTriggerConditions.Size = new System.Drawing.Size(88, 27); + this.btnLgPresetEditTriggerConditions.TabIndex = 54; + this.btnLgPresetEditTriggerConditions.Text = "Edit..."; + this.btnLgPresetEditTriggerConditions.UseVisualStyleBackColor = true; + this.btnLgPresetEditTriggerConditions.Click += new System.EventHandler(this.btnLgPresetEditTriggerConditions_Click); + // + // edtLgPresetTriggerConditions + // + this.edtLgPresetTriggerConditions.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.edtLgPresetTriggerConditions.Enabled = false; + this.edtLgPresetTriggerConditions.Location = new System.Drawing.Point(601, 349); + this.edtLgPresetTriggerConditions.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + this.edtLgPresetTriggerConditions.Name = "edtLgPresetTriggerConditions"; + this.edtLgPresetTriggerConditions.ReadOnly = true; + this.edtLgPresetTriggerConditions.Size = new System.Drawing.Size(194, 23); + this.edtLgPresetTriggerConditions.TabIndex = 53; + // + // lblLgPresetExcludedProcesses + // + this.lblLgPresetExcludedProcesses.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.lblLgPresetExcludedProcesses.AutoSize = true; + this.lblLgPresetExcludedProcesses.Location = new System.Drawing.Point(475, 414); + this.lblLgPresetExcludedProcesses.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.lblLgPresetExcludedProcesses.Name = "lblLgPresetExcludedProcesses"; + this.lblLgPresetExcludedProcesses.Size = new System.Drawing.Size(112, 15); + this.lblLgPresetExcludedProcesses.TabIndex = 52; + this.lblLgPresetExcludedProcesses.Text = "Excluded processes:"; + // + // edtLgPresetExcludedProcesses + // + this.edtLgPresetExcludedProcesses.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.edtLgPresetExcludedProcesses.Enabled = false; + this.edtLgPresetExcludedProcesses.Location = new System.Drawing.Point(601, 411); + this.edtLgPresetExcludedProcesses.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + this.edtLgPresetExcludedProcesses.Name = "edtLgPresetExcludedProcesses"; + this.edtLgPresetExcludedProcesses.Size = new System.Drawing.Size(289, 23); + this.edtLgPresetExcludedProcesses.TabIndex = 51; + // + // lblLgPresetIncludedProcesses + // + this.lblLgPresetIncludedProcesses.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.lblLgPresetIncludedProcesses.AutoSize = true; + this.lblLgPresetIncludedProcesses.Location = new System.Drawing.Point(475, 384); + this.lblLgPresetIncludedProcesses.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.lblLgPresetIncludedProcesses.Name = "lblLgPresetIncludedProcesses"; + this.lblLgPresetIncludedProcesses.Size = new System.Drawing.Size(110, 15); + this.lblLgPresetIncludedProcesses.TabIndex = 50; + this.lblLgPresetIncludedProcesses.Text = "Included processes:"; + // + // edtLgPresetIncludedProcesses + // + this.edtLgPresetIncludedProcesses.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.edtLgPresetIncludedProcesses.Enabled = false; + this.edtLgPresetIncludedProcesses.Location = new System.Drawing.Point(601, 381); + this.edtLgPresetIncludedProcesses.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + this.edtLgPresetIncludedProcesses.Name = "edtLgPresetIncludedProcesses"; + this.edtLgPresetIncludedProcesses.Size = new System.Drawing.Size(289, 23); + this.edtLgPresetIncludedProcesses.TabIndex = 49; + // + // lblLgPresetTriggerCondition + // + this.lblLgPresetTriggerCondition.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.lblLgPresetTriggerCondition.AutoSize = true; + this.lblLgPresetTriggerCondition.Location = new System.Drawing.Point(475, 353); + this.lblLgPresetTriggerCondition.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.lblLgPresetTriggerCondition.Name = "lblLgPresetTriggerCondition"; + this.lblLgPresetTriggerCondition.Size = new System.Drawing.Size(63, 15); + this.lblLgPresetTriggerCondition.TabIndex = 47; + this.lblLgPresetTriggerCondition.Text = "Condition:"; + // + // cbxLgPresetTrigger + // + this.cbxLgPresetTrigger.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.cbxLgPresetTrigger.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cbxLgPresetTrigger.Enabled = false; + this.cbxLgPresetTrigger.FormattingEnabled = true; + this.cbxLgPresetTrigger.Location = new System.Drawing.Point(601, 318); + this.cbxLgPresetTrigger.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + this.cbxLgPresetTrigger.Name = "cbxLgPresetTrigger"; + this.cbxLgPresetTrigger.Size = new System.Drawing.Size(289, 23); + this.cbxLgPresetTrigger.TabIndex = 46; + // + // lblLgPresetTrigger + // + this.lblLgPresetTrigger.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.lblLgPresetTrigger.AutoSize = true; + this.lblLgPresetTrigger.Location = new System.Drawing.Point(475, 321); + this.lblLgPresetTrigger.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.lblLgPresetTrigger.Name = "lblLgPresetTrigger"; + this.lblLgPresetTrigger.Size = new System.Drawing.Size(46, 15); + this.lblLgPresetTrigger.TabIndex = 45; + this.lblLgPresetTrigger.Text = "Trigger:"; + // + // btnLgExpert + // + this.btnLgExpert.ContextMenuStrip = this.mnuLgExpert; + this.btnLgExpert.Location = new System.Drawing.Point(368, 39); + this.btnLgExpert.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + this.btnLgExpert.Name = "btnLgExpert"; + this.btnLgExpert.Size = new System.Drawing.Size(88, 27); + this.btnLgExpert.TabIndex = 44; + this.btnLgExpert.Text = "Expert..."; + this.btnLgExpert.UseVisualStyleBackColor = true; + this.btnLgExpert.Click += new System.EventHandler(this.btnLgExpert_Click); + // + // mnuLgExpert + // + this.mnuLgExpert.ImageScalingSize = new System.Drawing.Size(20, 20); + this.mnuLgExpert.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.mnuLgOLEDMotionPro, + this.miLgExpertSeparator1}); + this.mnuLgExpert.Name = "mnuLgButtons"; + this.mnuLgExpert.Size = new System.Drawing.Size(359, 32); + this.mnuLgExpert.Opening += new System.ComponentModel.CancelEventHandler(this.mnuLgExpert_Opening); + // + // mnuLgOLEDMotionPro + // + this.mnuLgOLEDMotionPro.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.miLgEnableMotionPro, + this.miLgDisableMotionPro}); + this.mnuLgOLEDMotionPro.Name = "mnuLgOLEDMotionPro"; + this.mnuLgOLEDMotionPro.Size = new System.Drawing.Size(358, 22); + this.mnuLgOLEDMotionPro.Text = "Activate OLED Motion Pro (B9/C9/E9/W9/C2/G2 only)"; + // + // miLgEnableMotionPro + // + this.miLgEnableMotionPro.Name = "miLgEnableMotionPro"; + this.miLgEnableMotionPro.Size = new System.Drawing.Size(207, 22); + this.miLgEnableMotionPro.Text = "Enable OLED Motion Pro"; + this.miLgEnableMotionPro.Click += new System.EventHandler(this.miLgEnableMotionPro_Click); + // + // miLgDisableMotionPro + // + this.miLgDisableMotionPro.Name = "miLgDisableMotionPro"; + this.miLgDisableMotionPro.Size = new System.Drawing.Size(207, 22); + this.miLgDisableMotionPro.Text = "Disable OLED Motion Pro"; + this.miLgDisableMotionPro.Click += new System.EventHandler(this.miLgDisableMotionPro_Click); + // + // miLgExpertSeparator1 + // + this.miLgExpertSeparator1.Name = "miLgExpertSeparator1"; + this.miLgExpertSeparator1.Size = new System.Drawing.Size(355, 6); + // + // chkLgRemoteControlShow + // + this.chkLgRemoteControlShow.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.chkLgRemoteControlShow.Appearance = System.Windows.Forms.Appearance.Button; + this.chkLgRemoteControlShow.AutoSize = true; + this.chkLgRemoteControlShow.Location = new System.Drawing.Point(794, 8); + this.chkLgRemoteControlShow.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + this.chkLgRemoteControlShow.Name = "chkLgRemoteControlShow"; + this.chkLgRemoteControlShow.Size = new System.Drawing.Size(101, 25); + this.chkLgRemoteControlShow.TabIndex = 43; + this.chkLgRemoteControlShow.Text = "Remote Control"; + this.chkLgRemoteControlShow.UseVisualStyleBackColor = true; + this.chkLgRemoteControlShow.CheckedChanged += new System.EventHandler(this.chkLgRemoteControlShow_CheckedChanged); + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(6, 14); + this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(45, 15); + this.label3.TabIndex = 31; + this.label3.Text = "Device:"; + // + // cbxLgDevices + // + this.cbxLgDevices.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cbxLgDevices.DropDownWidth = 400; + this.cbxLgDevices.FormattingEnabled = true; + this.cbxLgDevices.Location = new System.Drawing.Point(100, 9); + this.cbxLgDevices.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + this.cbxLgDevices.Name = "cbxLgDevices"; + this.cbxLgDevices.Size = new System.Drawing.Size(370, 23); + this.cbxLgDevices.TabIndex = 30; + this.cbxLgDevices.SelectedIndexChanged += new System.EventHandler(this.cbxLgDevices_SelectedIndexChanged); + // + // btnLgDeviceConvertToCustom + // + this.btnLgDeviceConvertToCustom.Location = new System.Drawing.Point(667, 8); + this.btnLgDeviceConvertToCustom.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + this.btnLgDeviceConvertToCustom.Name = "btnLgDeviceConvertToCustom"; + this.btnLgDeviceConvertToCustom.Size = new System.Drawing.Size(88, 27); + this.btnLgDeviceConvertToCustom.TabIndex = 41; + this.btnLgDeviceConvertToCustom.Text = "To custom..."; + this.btnLgDeviceConvertToCustom.UseVisualStyleBackColor = true; + this.btnLgDeviceConvertToCustom.Click += new System.EventHandler(this.btnLgDeviceConvertToCustom_Click); + // + // cbxLgApps + // + this.cbxLgApps.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.cbxLgApps.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cbxLgApps.Enabled = false; + this.cbxLgApps.FormattingEnabled = true; + this.cbxLgApps.Location = new System.Drawing.Point(100, 380); + this.cbxLgApps.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + this.cbxLgApps.Name = "cbxLgApps"; + this.cbxLgApps.Size = new System.Drawing.Size(233, 23); + this.cbxLgApps.TabIndex = 26; + this.cbxLgApps.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.cbxLgApps_KeyPress); + // + // lvLgPresets + // + this.lvLgPresets.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.lvLgPresets.CheckBoxes = true; + this.lvLgPresets.FullRowSelect = true; + this.lvLgPresets.Location = new System.Drawing.Point(6, 152); + this.lvLgPresets.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + this.lvLgPresets.MultiSelect = false; + this.lvLgPresets.Name = "lvLgPresets"; + this.lvLgPresets.ShowItemToolTips = true; + this.lvLgPresets.Size = new System.Drawing.Size(889, 126); + this.lvLgPresets.TabIndex = 8; + this.lvLgPresets.UseCompatibleStateImageBehavior = false; + this.lvLgPresets.View = System.Windows.Forms.View.Details; + this.lvLgPresets.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.lvLgPresets_ColumnClick); + this.lvLgPresets.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(this.lvLgPresets_ItemChecked); + this.lvLgPresets.SelectedIndexChanged += new System.EventHandler(this.lvLgPresets_SelectedIndexChanged); + this.lvLgPresets.DoubleClick += new System.EventHandler(this.lvLgPresets_DoubleClick); + // + // label5 + // + this.label5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(6, 384); + this.label5.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(32, 15); + this.label5.TabIndex = 25; + this.label5.Text = "App:"; + // + // cbxLgPresetDevice + // + this.cbxLgPresetDevice.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.cbxLgPresetDevice.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cbxLgPresetDevice.Enabled = false; + this.cbxLgPresetDevice.FormattingEnabled = true; + this.cbxLgPresetDevice.Location = new System.Drawing.Point(100, 348); + this.cbxLgPresetDevice.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + this.cbxLgPresetDevice.Name = "cbxLgPresetDevice"; + this.cbxLgPresetDevice.Size = new System.Drawing.Size(370, 23); + this.cbxLgPresetDevice.TabIndex = 40; + // + // btnDeleteLg + // + this.btnDeleteLg.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.btnDeleteLg.Enabled = false; + this.btnDeleteLg.Location = new System.Drawing.Point(289, 284); + this.btnDeleteLg.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + this.btnDeleteLg.Name = "btnDeleteLg"; + this.btnDeleteLg.Size = new System.Drawing.Size(88, 27); + this.btnDeleteLg.TabIndex = 27; + this.btnDeleteLg.Text = "Delete"; + this.btnDeleteLg.UseVisualStyleBackColor = true; + this.btnDeleteLg.Click += new System.EventHandler(this.btnDeleteLg_Click); + // + // btnApplyLg + // + this.btnApplyLg.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.btnApplyLg.Enabled = false; + this.btnApplyLg.Location = new System.Drawing.Point(6, 284); + this.btnApplyLg.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + this.btnApplyLg.Name = "btnApplyLg"; + this.btnApplyLg.Size = new System.Drawing.Size(88, 27); + this.btnApplyLg.TabIndex = 9; + this.btnApplyLg.Text = "Apply"; + this.btnApplyLg.UseVisualStyleBackColor = true; + this.btnApplyLg.Click += new System.EventHandler(this.btnApplyLg_Click); + // + // lblDeviceFilter + // + this.lblDeviceFilter.AutoSize = true; + this.lblDeviceFilter.Location = new System.Drawing.Point(6, 45); + this.lblDeviceFilter.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.lblDeviceFilter.Name = "lblDeviceFilter"; + this.lblDeviceFilter.Size = new System.Drawing.Size(72, 15); + this.lblDeviceFilter.TabIndex = 24; + this.lblDeviceFilter.Text = "Device filter:"; + // + // lblLgPresetDevice + // + this.lblLgPresetDevice.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.lblLgPresetDevice.AutoSize = true; + this.lblLgPresetDevice.Location = new System.Drawing.Point(6, 351); + this.lblLgPresetDevice.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.lblLgPresetDevice.Name = "lblLgPresetDevice"; + this.lblLgPresetDevice.Size = new System.Drawing.Size(45, 15); + this.lblLgPresetDevice.TabIndex = 39; + this.lblLgPresetDevice.Text = "Device:"; + // + // btnAddLg + // + this.btnAddLg.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.btnAddLg.Location = new System.Drawing.Point(195, 284); + this.btnAddLg.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + this.btnAddLg.Name = "btnAddLg"; + this.btnAddLg.Size = new System.Drawing.Size(88, 27); + this.btnAddLg.TabIndex = 28; + this.btnAddLg.Text = "Add"; + this.btnAddLg.UseVisualStyleBackColor = true; + this.btnAddLg.Click += new System.EventHandler(this.btnAddLg_Click); + // + // edtShortcutLg + // + this.edtShortcutLg.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.edtShortcutLg.Enabled = false; + this.edtShortcutLg.Location = new System.Drawing.Point(100, 411); + this.edtShortcutLg.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + this.edtShortcutLg.Name = "edtShortcutLg"; + this.edtShortcutLg.ReadOnly = true; + this.edtShortcutLg.Size = new System.Drawing.Size(233, 23); + this.edtShortcutLg.TabIndex = 11; + this.edtShortcutLg.TextChanged += new System.EventHandler(this.edtShortcutLg_TextChanged); + this.edtShortcutLg.KeyDown += new System.Windows.Forms.KeyEventHandler(this.edtShortcut_KeyDown); + this.edtShortcutLg.KeyUp += new System.Windows.Forms.KeyEventHandler(this.edtShortcut_KeyUp); + // + // edtLgDeviceFilter + // + this.edtLgDeviceFilter.Location = new System.Drawing.Point(100, 40); + this.edtLgDeviceFilter.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + this.edtLgDeviceFilter.Name = "edtLgDeviceFilter"; + this.edtLgDeviceFilter.Size = new System.Drawing.Size(165, 23); + this.edtLgDeviceFilter.TabIndex = 23; + this.edtLgDeviceFilter.TextChanged += new System.EventHandler(this.edtLgDeviceFilter_TextChanged); + // + // btnLgRemoveDevice + // + this.btnLgRemoveDevice.Location = new System.Drawing.Point(573, 8); + this.btnLgRemoveDevice.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + this.btnLgRemoveDevice.Name = "btnLgRemoveDevice"; + this.btnLgRemoveDevice.Size = new System.Drawing.Size(88, 27); + this.btnLgRemoveDevice.TabIndex = 38; + this.btnLgRemoveDevice.Text = "Remove"; + this.btnLgRemoveDevice.UseVisualStyleBackColor = true; + this.btnLgRemoveDevice.Click += new System.EventHandler(this.btnLgRemoveDevice_Click); + // + // btnLgRefreshApps + // + this.btnLgRefreshApps.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.btnLgRefreshApps.Enabled = false; + this.btnLgRefreshApps.Location = new System.Drawing.Point(341, 378); + this.btnLgRefreshApps.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + this.btnLgRefreshApps.Name = "btnLgRefreshApps"; + this.btnLgRefreshApps.Size = new System.Drawing.Size(88, 27); + this.btnLgRefreshApps.TabIndex = 29; + this.btnLgRefreshApps.Text = "Refresh"; + this.btnLgRefreshApps.UseVisualStyleBackColor = true; + this.btnLgRefreshApps.Click += new System.EventHandler(this.btnLgRefreshApps_Click); + // + // label2 + // + this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(6, 415); + this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(55, 15); + this.label2.TabIndex = 12; + this.label2.Text = "Shortcut:"; + // + // label1 + // + this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(6, 321); + this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(42, 15); + this.label1.TabIndex = 20; + this.label1.Text = "Name:"; + // + // btnLgAddDevice + // + this.btnLgAddDevice.Location = new System.Drawing.Point(478, 8); + this.btnLgAddDevice.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + this.btnLgAddDevice.Name = "btnLgAddDevice"; + this.btnLgAddDevice.Size = new System.Drawing.Size(88, 27); + this.btnLgAddDevice.TabIndex = 37; + this.btnLgAddDevice.Text = "Add"; + this.btnLgAddDevice.UseVisualStyleBackColor = true; + this.btnLgAddDevice.Click += new System.EventHandler(this.btnLgAddDevice_Click); + // + // edtNameLg + // + this.edtNameLg.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.edtNameLg.Enabled = false; + this.edtNameLg.Location = new System.Drawing.Point(100, 318); + this.edtNameLg.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + this.edtNameLg.Name = "edtNameLg"; + this.edtNameLg.Size = new System.Drawing.Size(233, 23); + this.edtNameLg.TabIndex = 19; + // + // btnSetShortcutLg + // + this.btnSetShortcutLg.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.btnSetShortcutLg.Enabled = false; + this.btnSetShortcutLg.Location = new System.Drawing.Point(384, 284); + this.btnSetShortcutLg.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + this.btnSetShortcutLg.Name = "btnSetShortcutLg"; + this.btnSetShortcutLg.Size = new System.Drawing.Size(88, 27); + this.btnSetShortcutLg.TabIndex = 13; + this.btnSetShortcutLg.Text = "Save"; + this.btnSetShortcutLg.UseVisualStyleBackColor = true; + this.btnSetShortcutLg.Click += new System.EventHandler(this.btnSetShortcutLg_Click); + // + // edtStepsLg + // + this.edtStepsLg.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.edtStepsLg.Enabled = false; + this.edtStepsLg.Location = new System.Drawing.Point(100, 440); + this.edtStepsLg.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + this.edtStepsLg.Multiline = true; + this.edtStepsLg.Name = "edtStepsLg"; + this.edtStepsLg.Size = new System.Drawing.Size(700, 43); + this.edtStepsLg.TabIndex = 17; + // + // btnLgAddButton + // + this.btnLgAddButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.btnLgAddButton.ContextMenuStrip = this.mnuLgButtons; + this.btnLgAddButton.Enabled = false; + this.btnLgAddButton.Location = new System.Drawing.Point(808, 439); + this.btnLgAddButton.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + this.btnLgAddButton.Name = "btnLgAddButton"; + this.btnLgAddButton.Size = new System.Drawing.Size(88, 27); + this.btnLgAddButton.TabIndex = 32; + this.btnLgAddButton.Text = "Add step"; + this.btnLgAddButton.UseVisualStyleBackColor = true; + this.btnLgAddButton.Click += new System.EventHandler(this.btnLgAddButton_Click); + // + // mnuLgButtons + // + this.mnuLgButtons.ImageScalingSize = new System.Drawing.Size(20, 20); + this.mnuLgButtons.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.mnuLgRcButtons, + this.mnuLgActions, + this.mnuLgNvPresets, + this.mnuLgAmdPresets, + this.mnuLgProgram}); + this.mnuLgButtons.Name = "mnuLgButtons"; + this.mnuLgButtons.Size = new System.Drawing.Size(153, 114); + this.mnuLgButtons.Opening += new System.ComponentModel.CancelEventHandler(this.mnuLgButtons_Opening); + // + // mnuLgRcButtons + // + this.mnuLgRcButtons.Name = "mnuLgRcButtons"; + this.mnuLgRcButtons.Size = new System.Drawing.Size(152, 22); + this.mnuLgRcButtons.Text = "Buttons"; + // + // mnuLgActions + // + this.mnuLgActions.Name = "mnuLgActions"; + this.mnuLgActions.Size = new System.Drawing.Size(152, 22); + this.mnuLgActions.Text = "Actions"; + // + // mnuLgNvPresets + // + this.mnuLgNvPresets.Name = "mnuLgNvPresets"; + this.mnuLgNvPresets.Size = new System.Drawing.Size(152, 22); + this.mnuLgNvPresets.Text = "NVIDIA presets"; + // + // mnuLgAmdPresets + // + this.mnuLgAmdPresets.Name = "mnuLgAmdPresets"; + this.mnuLgAmdPresets.Size = new System.Drawing.Size(152, 22); + this.mnuLgAmdPresets.Text = "AMD presets"; + // + // mnuLgProgram + // + this.mnuLgProgram.Name = "mnuLgProgram"; + this.mnuLgProgram.Size = new System.Drawing.Size(152, 22); + this.mnuLgProgram.Text = "Start Program"; + this.mnuLgProgram.Click += new System.EventHandler(this.mnuLgProgram_Click); + // + // btnCloneLg + // + this.btnCloneLg.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.btnCloneLg.Enabled = false; + this.btnCloneLg.Location = new System.Drawing.Point(100, 284); + this.btnCloneLg.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + this.btnCloneLg.Name = "btnCloneLg"; + this.btnCloneLg.Size = new System.Drawing.Size(88, 27); + this.btnCloneLg.TabIndex = 14; + this.btnCloneLg.Text = "Clone"; + this.btnCloneLg.UseVisualStyleBackColor = true; + this.btnCloneLg.Click += new System.EventHandler(this.btnCloneLg_Click); + // + // lblStepsLg + // + this.lblStepsLg.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.lblStepsLg.AutoSize = true; + this.lblStepsLg.Location = new System.Drawing.Point(6, 445); + this.lblStepsLg.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.lblStepsLg.Name = "lblStepsLg"; + this.lblStepsLg.Size = new System.Drawing.Size(38, 15); + this.lblStepsLg.TabIndex = 16; + this.lblStepsLg.Text = "Steps:"; + // + // btnLgDeviceFilterRefresh + // + this.btnLgDeviceFilterRefresh.Location = new System.Drawing.Point(273, 39); + this.btnLgDeviceFilterRefresh.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + this.btnLgDeviceFilterRefresh.Name = "btnLgDeviceFilterRefresh"; + this.btnLgDeviceFilterRefresh.Size = new System.Drawing.Size(88, 27); + this.btnLgDeviceFilterRefresh.TabIndex = 35; + this.btnLgDeviceFilterRefresh.Text = "Refresh"; + this.btnLgDeviceFilterRefresh.UseVisualStyleBackColor = true; + this.btnLgDeviceFilterRefresh.Click += new System.EventHandler(this.btnLgDeviceFilterRefresh_Click); + // + // clbLgPower + // + this.clbLgPower.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.clbLgPower.CheckOnClick = true; + this.clbLgPower.ColumnWidth = 240; + this.clbLgPower.FormattingEnabled = true; + this.clbLgPower.Items.AddRange(new object[] { + "Power on after startup", + "Power on after resume from standby", + "Power off on shutdown", + "Power off on standby", + "Power off when screensaver activates", + "Power on when screensaver deactivates", + "Power on even after manual power off", + "Allow triggers to be fired for this device", + "Use Windows power settings to power on", + "Use Windows power settings to power off", + "Use secure connection"}); + this.clbLgPower.Location = new System.Drawing.Point(6, 70); + this.clbLgPower.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + this.clbLgPower.MultiColumn = true; + this.clbLgPower.Name = "clbLgPower"; + this.clbLgPower.Size = new System.Drawing.Size(862, 76); + this.clbLgPower.TabIndex = 34; + this.clbLgPower.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.clbLgPower_ItemCheck); + // + // lblLgError + // + this.lblLgError.AutoSize = true; + this.lblLgError.Location = new System.Drawing.Point(6, 9); + this.lblLgError.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.lblLgError.Name = "lblLgError"; + this.lblLgError.Size = new System.Drawing.Size(53, 15); + this.lblLgError.TabIndex = 15; + this.lblLgError.Text = "ErrorText"; + this.lblLgError.Visible = false; + // + // LgPanel + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.scLgController); + this.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); + this.Name = "LgPanel"; + this.Size = new System.Drawing.Size(1114, 539); + this.scLgController.Panel1.ResumeLayout(false); + this.scLgController.Panel1.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.scLgController)).EndInit(); + this.scLgController.ResumeLayout(false); + this.mnuLgExpert.ResumeLayout(false); + this.mnuLgButtons.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.ToolStripMenuItem mnuLgRcButtons; + private System.Windows.Forms.ToolStripMenuItem mnuLgActions; + private System.Windows.Forms.ContextMenuStrip mnuLgButtons; + private System.Windows.Forms.SplitContainer scLgController; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.ComboBox cbxLgDevices; + private System.Windows.Forms.Button btnLgDeviceConvertToCustom; + private System.Windows.Forms.ComboBox cbxLgApps; + private System.Windows.Forms.ListView lvLgPresets; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.ComboBox cbxLgPresetDevice; + private System.Windows.Forms.Button btnDeleteLg; + private System.Windows.Forms.Button btnApplyLg; + private System.Windows.Forms.Label lblDeviceFilter; + private System.Windows.Forms.Label lblLgPresetDevice; + private System.Windows.Forms.Button btnAddLg; + private System.Windows.Forms.TextBox edtShortcutLg; + private System.Windows.Forms.TextBox edtLgDeviceFilter; + private System.Windows.Forms.Button btnLgRemoveDevice; + private System.Windows.Forms.Button btnLgRefreshApps; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Button btnLgAddDevice; + private System.Windows.Forms.TextBox edtNameLg; + private System.Windows.Forms.Button btnSetShortcutLg; + private System.Windows.Forms.TextBox edtStepsLg; + private System.Windows.Forms.Button btnLgAddButton; + private System.Windows.Forms.Button btnCloneLg; + private System.Windows.Forms.Label lblStepsLg; + private System.Windows.Forms.Button btnLgDeviceFilterRefresh; + private System.Windows.Forms.CheckedListBox clbLgPower; + private System.Windows.Forms.Label lblLgError; + private System.Windows.Forms.CheckBox chkLgRemoteControlShow; + private System.Windows.Forms.Button btnLgExpert; + private System.Windows.Forms.ContextMenuStrip mnuLgExpert; + private System.Windows.Forms.ToolStripMenuItem mnuLgOLEDMotionPro; + private System.Windows.Forms.ToolStripMenuItem miLgEnableMotionPro; + private System.Windows.Forms.ToolStripMenuItem miLgDisableMotionPro; + private System.Windows.Forms.ToolStripSeparator miLgExpertSeparator1; + private System.Windows.Forms.ToolStripMenuItem mnuLgNvPresets; + private System.Windows.Forms.ToolStripMenuItem mnuLgAmdPresets; + private System.Windows.Forms.ComboBox cbxLgPresetTrigger; + private System.Windows.Forms.Label lblLgPresetTrigger; + private System.Windows.Forms.Label lblLgPresetTriggerCondition; + private System.Windows.Forms.Label lblLgPresetExcludedProcesses; + private System.Windows.Forms.TextBox edtLgPresetExcludedProcesses; + private System.Windows.Forms.Label lblLgPresetIncludedProcesses; + private System.Windows.Forms.TextBox edtLgPresetIncludedProcesses; + private System.Windows.Forms.Button btnLgPresetEditTriggerConditions; + private System.Windows.Forms.TextBox edtLgPresetTriggerConditions; + private System.Windows.Forms.Button btnLgGameBar; + private System.Windows.Forms.Button btnLgDeviceOptionsHelp; + private System.Windows.Forms.TextBox edtLgPresetDescription; + private System.Windows.Forms.Label lblLgPresetDescription; + private System.Windows.Forms.ComboBox cbxLgPcHdmiPort; + private System.Windows.Forms.Label lblLgPcHdmiPort; + private System.Windows.Forms.ToolStripMenuItem mnuLgProgram; + private System.Windows.Forms.CheckBox chkLgQuickAccess; + private System.Windows.Forms.Button btnLgSettings; + + } +} diff --git a/ColorControl/Services/LG/LgPanel.cs b/ColorControl/Services/LG/LgPanel.cs new file mode 100644 index 0000000..de688bc --- /dev/null +++ b/ColorControl/Services/LG/LgPanel.cs @@ -0,0 +1,1199 @@ +using ColorControl.Common; +using ColorControl.Forms; +using ColorControl.Native; +using ColorControl.Services.AMD; +using ColorControl.Services.Common; +using ColorControl.Services.NVIDIA; +using LgTv; +using NLog; +using NStandard; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace ColorControl.Services.LG +{ + public partial class LgPanel : UserControl + { + private static int SHORTCUTID_LGQA = -202; + private static int SHORTCUTID_GAMEBAR = -101; + + private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); + + private Config _config; + private LgService _lgService; + private NvService _nvService; + private AmdService _amdService; + private IntPtr _mainHandle; + private NotifyIcon _trayIcon; + + private string _lgTabMessage; + private bool _initialized = false; + private bool _disableEvents = false; + private LgGameBar _gameBarForm; + + internal LgPanel(LgService lgService, NvService nvService, AmdService amdService, NotifyIcon trayIcon, IntPtr handle) + { + _lgService = lgService; + _nvService = nvService; + _amdService = amdService; + _trayIcon = trayIcon; + _mainHandle = handle; + + _config = AppContext.CurrentContext.Config; + + InitializeComponent(); + + FillLgPresets(); + + FormUtils.InitSortState(lvLgPresets, _config.LgPresetsSortState); + + //_lgService.AfterApplyPreset += LgServiceAfterApplyPreset; + _lgService.SelectedDeviceChangedEvent += _lgService_SelectedDeviceChangedEvent; + + edtLgDeviceFilter.Text = _lgService.Config.DeviceSearchKey; + + var values = Enum.GetValues(typeof(ButtonType)); + foreach (var button in values) + { + var text = button.ToString(); + if (text[0] == '_') + { + text = text.Substring(1); + } + + var item = mnuLgRcButtons.DropDownItems.Add(text); + item.Click += miLgAddButton_Click; + } + + Load += LgPanel_Load; + } + + private void LgPanel_Load(object sender, EventArgs e) + { + _lgService.RefreshDevices(afterStartUp: true).ContinueWith((_) => BeginInvoke(() => AfterLgServiceRefreshDevices())); + + _lgService.InstallEventHandlers(); + } + + private void _lgService_SelectedDeviceChangedEvent(object sender, EventArgs e) + { + BeginInvoke(() => SetLgDevicesSelectedIndex(sender)); + } + + private void SetLgDevicesSelectedIndex(object sender) + { + if (sender == null) + { + cbxLgDevices.SelectedIndex = -1; + return; + } + + cbxLgDevices.SelectedIndex = cbxLgDevices.Items.IndexOf(sender); + } + + private void AfterLgServiceRefreshDevices() + { + FillLgDevices(); + + var startUpParams = AppContext.CurrentContext.StartUpParams; + + if (startUpParams.ExecuteLgPreset) + { + var _ = _lgService.ApplyPreset(startUpParams.LgPresetName); + } + } + + internal void Save() + { + FormUtils.SaveSortState(lvLgPresets.ListViewItemSorter, _config.LgPresetsSortState); + } + + private void edtShortcut_KeyDown(object sender, KeyEventArgs e) + { + ((TextBox)sender).Text = Utils.FormatKeyboardShortcut(e); + } + + private void edtShortcut_KeyUp(object sender, KeyEventArgs e) + { + Utils.HandleKeyboardShortcutUp(e); + } + + private void FillLgPresets() + { + FormUtils.InitListView(lvLgPresets, LgPreset.GetColumnNames()); + + foreach (var preset in _lgService.GetPresets()) + { + AddOrUpdateItemLg(preset); + Utils.RegisterShortcut(_mainHandle, preset.id, preset.shortcut); + } + } + + private void AddOrUpdateItemLg(LgPreset preset = null, ListViewItem specItem = null) + { + FormUtils.AddOrUpdateListItem(lvLgPresets, _lgService.GetPresets(), _config, preset, specItem); + } + + private void btnCloneLg_Click(object sender, EventArgs e) + { + var preset = GetSelectedLgPreset(); + + var newPreset = preset.Clone(); + AddOrUpdateItemLg(newPreset); + } + + private LgPreset GetSelectedLgPreset() + { + if (lvLgPresets.SelectedItems.Count > 0) + { + var item = lvLgPresets.SelectedItems[0]; + return (LgPreset)item.Tag; + } + else + { + return null; + } + } + + private void lvLgPresets_SelectedIndexChanged(object sender, EventArgs e) + { + var enabled = lvLgPresets.SelectedItems.Count > 0; + btnApplyLg.Enabled = enabled; + btnCloneLg.Enabled = enabled; + edtNameLg.Enabled = enabled; + chkLgQuickAccess.Enabled = enabled; + edtLgPresetDescription.Enabled = enabled; + cbxLgPresetDevice.Enabled = enabled; + edtShortcutLg.Enabled = enabled; + btnSetShortcutLg.Enabled = enabled; + edtStepsLg.Enabled = enabled; + btnLgAddButton.Enabled = enabled; + cbxLgApps.Enabled = enabled; + btnLgRefreshApps.Enabled = enabled; + btnDeleteLg.Enabled = enabled; + cbxLgPresetTrigger.Enabled = enabled; + edtLgPresetTriggerConditions.Enabled = enabled; + btnLgPresetEditTriggerConditions.Enabled = enabled; + edtLgPresetIncludedProcesses.Enabled = enabled; + edtLgPresetExcludedProcesses.Enabled = enabled; + + var preset = GetSelectedLgPreset(); + + if (preset != null) + { + edtNameLg.Text = preset.name; + chkLgQuickAccess.Checked = preset.ShowInQuickAccess; + edtLgPresetDescription.Text = preset.Description; + var lgApps = _lgService?.GetApps(); + cbxLgApps.SelectedIndex = lgApps == null ? -1 : lgApps.FindIndex(x => x.appId.Equals(preset.appId)); + edtShortcutLg.Text = preset.shortcut; + edtStepsLg.Text = preset.steps.Aggregate("", (a, b) => (string.IsNullOrEmpty(a) ? "" : a + ", ") + b); + + var index = -1; + + for (var i = 0; i < cbxLgPresetDevice.Items.Count; i++) + { + var pnpDev = (LgDevice)cbxLgPresetDevice.Items[i]; + if ((string.IsNullOrEmpty(preset.DeviceMacAddress) && string.IsNullOrEmpty(pnpDev.MacAddress)) || pnpDev.MacAddress.Equals(preset.DeviceMacAddress, StringComparison.OrdinalIgnoreCase)) + { + index = i; + break; + } + } + + cbxLgPresetDevice.SelectedIndex = index; + + var trigger = preset.Triggers.FirstOrDefault(); + + FormUtils.SetComboBoxEnumIndex(cbxLgPresetTrigger, (int)(trigger?.Trigger ?? PresetTriggerType.None)); + + edtLgPresetTriggerConditions.Text = Utils.GetDescriptions(trigger != null ? (int)trigger.Conditions : 0).Join(", "); + edtLgPresetTriggerConditions.Tag = trigger != null ? (int)trigger.Conditions : 0; + + edtLgPresetIncludedProcesses.Text = trigger?.IncludedProcesses?.Join(", ") ?? string.Empty; + edtLgPresetExcludedProcesses.Text = trigger?.ExcludedProcesses?.Join(", ") ?? string.Empty; + } + else + { + edtNameLg.Text = string.Empty; + chkLgQuickAccess.Checked = false; + edtLgPresetDescription.Text = string.Empty; + cbxLgApps.SelectedIndex = -1; + edtShortcutLg.Text = string.Empty; + edtStepsLg.Text = string.Empty; + cbxLgPresetDevice.SelectedIndex = -1; + cbxLgPresetTrigger.SelectedIndex = -1; + edtLgPresetTriggerConditions.Text = string.Empty; + edtLgPresetTriggerConditions.Tag = 0; + edtLgPresetIncludedProcesses.Text = string.Empty; + edtLgPresetExcludedProcesses.Text = string.Empty; + } + } + + private void btnApplyLg_Click(object sender, EventArgs e) + { + var preset = GetSelectedLgPreset(); + + ApplyLgPreset(preset); + } + + private void btnSetShortcutLg_Click(object sender, EventArgs e) + { + var shortcut = edtShortcutLg.Text.Trim(); + if (!Utils.ValidateShortcut(shortcut)) + { + return; + } + + var preset = GetSelectedLgPreset(); + + var name = edtNameLg.Text.Trim(); + + if (name.Length == 0 || _lgService.GetPresets().Any(x => x.id != preset.id && x.name.Equals(name, StringComparison.OrdinalIgnoreCase))) + { + MessageForms.WarningOk("The name can not be empty and must be unique."); + return; + } + + var clear = !string.IsNullOrEmpty(preset.shortcut); + + preset.name = name; + preset.ShowInQuickAccess = chkLgQuickAccess.Checked; + preset.Description = edtLgPresetDescription.Text.Trim(); + + if (cbxLgPresetDevice.SelectedIndex == -1) + { + preset.DeviceMacAddress = string.Empty; + } + else + { + var device = (LgDevice)cbxLgPresetDevice.SelectedItem; + preset.DeviceMacAddress = device.MacAddress; + } + + if (cbxLgApps.SelectedIndex == -1) + { + preset.appId = string.Empty; + } + else + { + var lgApp = (LgApp)cbxLgApps.SelectedItem; + preset.appId = lgApp.appId; + } + + var triggerType = FormUtils.GetComboBoxEnumItem(cbxLgPresetTrigger); + preset.UpdateTrigger(triggerType, + (PresetConditionType)edtLgPresetTriggerConditions.Tag, + edtLgPresetIncludedProcesses.Text, + edtLgPresetExcludedProcesses.Text); + + if (triggerType != PresetTriggerType.None) + { + _lgService.InstallEventHandlers(); + } + + var shortcutChanged = !shortcut.Equals(preset.shortcut); + if (shortcutChanged) + { + preset.shortcut = shortcut; + } + + var text = edtStepsLg.Text; + + Utils.ParseWords(preset.steps, text); + + AddOrUpdateItemLg(); + + if (shortcutChanged) + { + Utils.RegisterShortcut(_mainHandle, preset.id, preset.shortcut, clear); + } + } + + public void UpdateInfo() + { + if (_lgService == null) + { + return; + } + + if (scLgController.Panel2.Controls.Count == 0) + { + var rcPanel = new RemoteControlPanel(_lgService, _lgService.GetRemoteControlButtons()); + rcPanel.Parent = scLgController.Panel2; + rcPanel.Dock = DockStyle.Fill; + } + chkLgRemoteControlShow.Checked = _lgService.Config.ShowRemoteControl; + scLgController.Panel2Collapsed = !_lgService.Config.ShowRemoteControl; + + FormUtils.BuildComboBox(cbxLgPresetTrigger, PresetTriggerType.Resume, PresetTriggerType.Shutdown, PresetTriggerType.Standby, PresetTriggerType.Startup, PresetTriggerType.Reserved5, PresetTriggerType.ScreensaverStart, PresetTriggerType.ScreensaverStop); + + if (!string.IsNullOrEmpty(_lgTabMessage)) + { + MessageForms.WarningOk(_lgTabMessage); + _lgTabMessage = null; + } + } + + private void FillLgDevices() + { + var devices = _lgService.Devices; + + cbxLgDevices.Items.Clear(); + cbxLgDevices.Items.AddRange(devices.ToArray()); + + cbxLgPresetDevice.Items.Clear(); + cbxLgPresetDevice.Items.AddRange(devices.ToArray()); + var globalDevice = new LgDevice("Globally selected device", string.Empty, string.Empty, true, true); + cbxLgPresetDevice.Items.Insert(0, globalDevice); + + var device = _lgService.SelectedDevice; + + if (device != null) + { + cbxLgDevices.SelectedIndex = cbxLgDevices.Items.IndexOf(device); + } + + if (!devices.Any()) + { + var message = "It seems there's no LG TV available! Please make sure it's connected to the same network as this PC."; + + if (Visible /*tcMain.SelectedTab == tabLG*/) + { + MessageForms.WarningOk(message); + } + else + { + _lgTabMessage = message; + } + } + + if (cbxLgApps.Items.Count == 0 && device != null) + { + _lgService.RefreshApps().ContinueWith((task) => BeginInvoke(() => FillLgApps(false))); + } + + btnLgDeviceConvertToCustom.Enabled = devices.Any(); + btnLgExpert.Enabled = devices.Any(); + btnLgGameBar.Enabled = devices.Any(); + + cbxLgDevices_SelectedIndexChanged(cbxLgDevices, null); + + SetLgDevicePowerOptions(); + } + + private void SetLgDevicePowerOptions() + { + var device = _lgService.SelectedDevice; + clbLgPower.Enabled = device != null; + + _disableEvents = true; + try + { + clbLgPower.SetItemChecked(0, device?.PowerOnAfterStartup ?? false); + clbLgPower.SetItemChecked(1, device?.PowerOnAfterResume ?? false); + clbLgPower.SetItemChecked(2, device?.PowerOffOnShutdown ?? false); + clbLgPower.SetItemChecked(3, device?.PowerOffOnStandby ?? false); + clbLgPower.SetItemChecked(4, device?.PowerOffOnScreenSaver ?? false); + clbLgPower.SetItemChecked(5, device?.PowerOnAfterScreenSaver ?? false); + clbLgPower.SetItemChecked(6, device?.PowerOnAfterManualPowerOff ?? false); + clbLgPower.SetItemChecked(7, device?.TriggersEnabled ?? true); + clbLgPower.SetItemChecked(8, device?.PowerOffByWindows ?? false); + clbLgPower.SetItemChecked(9, device?.PowerOnByWindows ?? false); + clbLgPower.SetItemChecked(10, device?.UseSecureConnection ?? false); + } + finally + { + _disableEvents = false; + } + } + + private void FillLgApps(bool forced) + { + var lgApps = _lgService?.GetApps(); + if (forced && (lgApps == null || !lgApps.Any())) + { + MessageForms.WarningOk("Could not refresh the apps. Check the log for details."); + return; + } + InitLgApps(); + } + + private void InitLgApps() + { + var lgApps = _lgService?.GetApps(); + + cbxLgApps.Items.Clear(); + if (lgApps != null) + { + cbxLgApps.Items.AddRange(lgApps.ToArray()); + } + + for (var i = 0; i < lvLgPresets.Items.Count; i++) + { + var item = lvLgPresets.Items[i]; + AddOrUpdateItemLg((LgPreset)item.Tag, item); + } + + var preset = GetSelectedLgPreset(); + if (preset != null) + { + cbxLgApps.SelectedIndex = lgApps == null ? -1 : lgApps.FindIndex(x => x.appId.Equals(preset.appId)); + } + } + + private void btnDeleteLg_Click(object sender, EventArgs e) + { + var preset = GetSelectedLgPreset(); + + if (preset == null) + { + return; + } + + if (!string.IsNullOrEmpty(preset.shortcut)) + { + WinApi.UnregisterHotKey(_mainHandle, preset.id); + } + + _lgService.GetPresets().Remove(preset); + + var item = lvLgPresets.SelectedItems[0]; + lvLgPresets.Items.Remove(item); + } + + private void btnAddLg_Click(object sender, EventArgs e) + { + AddOrUpdateItemLg(_lgService.CreateNewPreset()); + } + + internal void ApplyLgPreset(LgPreset preset, bool reconnect = false, bool wait = false) + { + if (preset == null) + { + return; + } + + var applyTask = _lgService.ApplyPreset(preset, reconnect).ContinueWith((task) => BeginInvoke(() => LgPresetApplied(task))); + if (wait) + { + Utils.WaitForTask(applyTask); + } + } + + private void LgPresetApplied(Task task) + { + var result = task.Result; + if (!result) + { + MessageForms.WarningOk("Could not apply the preset (entirely). Check the log for details."); + } + } + + private void btnLgRefreshApps_Click(object sender, EventArgs e) + { + _lgService.RefreshApps(true).ContinueWith((task) => BeginInvoke(() => FillLgApps(true))); + } + + private void cbxLgDevices_SelectedIndexChanged(object sender, EventArgs e) + { + cbxLgPcHdmiPort.Enabled = cbxLgDevices.SelectedIndex > -1; + if (cbxLgDevices.SelectedIndex == -1) + { + _lgService.SelectedDevice = null; + cbxLgPcHdmiPort.SelectedIndex = 0; + } + else + { + _lgService.SelectedDevice = (LgDevice)cbxLgDevices.SelectedItem; + cbxLgPcHdmiPort.SelectedIndex = _lgService.SelectedDevice.HDMIPortNumber; + } + chkLgRemoteControlShow.Enabled = _lgService.SelectedDevice != null; + btnLgRemoveDevice.Enabled = _lgService.SelectedDevice != null && _lgService.SelectedDevice.IsCustom; + btnLgDeviceConvertToCustom.Enabled = _lgService.SelectedDevice != null && !_lgService.SelectedDevice.IsCustom; + + SetLgDevicePowerOptions(); + } + + private void lvLgPresets_DoubleClick(object sender, EventArgs e) + { + ApplySelectedLgPreset(); + } + + private void ApplySelectedLgPreset() + { + var preset = GetSelectedLgPreset(); + ApplyLgPreset(preset); + } + + private void btnLgAddButton_Click(object sender, EventArgs e) + { + mnuLgButtons.Show(btnLgAddButton, btnLgAddButton.PointToClient(Cursor.Position)); + } + + private void miLgAddButton_Click(object sender, EventArgs e) + { + var item = sender as ToolStripItem; + + FormUtils.AddStepToTextBox(edtStepsLg, item.Text); + } + + private void miLgAddAction_Click(object sender, EventArgs e) + { + var item = sender as ToolStripItem; + var action = item.Tag as LgDevice.InvokableAction; + + var value = ShowLgActionForm(action); + + if (!string.IsNullOrEmpty(value)) + { + var text = $"{action.Name}({value})"; + + FormUtils.AddStepToTextBox(edtStepsLg, text); + } + } + + private string ShowLgActionForm(LgDevice.InvokableAction action) + { + var text = action.Name; + var title = action.Title ?? action.Name; + + var value = string.Empty; + + if (action.EnumType == null) + { + if (action.MinValue != action.MaxValue) + { + List fields = new(); + + if (action.NumberOfValues == 1) + { + fields.Add(new MessageForms.FieldDefinition + { + Label = "Enter desired " + title, + FieldType = MessageForms.FieldType.Numeric, + MinValue = action.MinValue, + MaxValue = action.MaxValue, + }); + } + else + { + var array = Enumerable.Range(0, action.NumberOfValues); + + fields.AddRange(array.Select(i => new MessageForms.FieldDefinition + { + Label = "Value for " + i, + FieldType = MessageForms.FieldType.Numeric, + MinValue = action.MinValue, + MaxValue = action.MaxValue, + })); + } + + var values = MessageForms.ShowDialog($"Enter value for {title}", fields); + + if (!values.Any()) + { + return null; + } + + if (values.Count > 1) + { + value = string.Join("; ", values.Select(v => v.Value)); + } + else + { + value = values.First().Value.ToString(); + } + } + } + else + { + var dropDownValues = new List(); + foreach (var enumValue in Enum.GetValues(action.EnumType)) + { + var description = Utils.GetDescription(action.EnumType, enumValue as IConvertible) ?? enumValue.ToString().Replace("_", ""); + dropDownValues.Add(description); + } + + var values = MessageForms.ShowDialog("Choose value", new[] { + new MessageForms.FieldDefinition + { + Label = "Choose desired " + title, + FieldType = MessageForms.FieldType.DropDown, + Values = dropDownValues + } + }); + + if (!values.Any()) + { + return null; + } + + value = values.First().Value.ToString(); + var enumName = Utils.GetEnumNameByDescription(action.EnumType, value); + if (enumName != null) + { + value = enumName; + } + } + + return value; + } + + private void miLgAddNvPreset_Click(object sender, EventArgs e) + { + var item = sender as ToolStripItem; + var preset = item.Tag as NvPreset; + + var text = $"NvPreset({preset.name})"; + + FormUtils.AddStepToTextBox(edtStepsLg, text); + } + + private void miLgAddAmdPreset_Click(object sender, EventArgs e) + { + var item = sender as ToolStripItem; + var preset = item.Tag as AmdPreset; + + var text = $"AmdPreset({preset.name})"; + + FormUtils.AddStepToTextBox(edtStepsLg, text); + } + + private void clbLgPower_ItemCheck(object sender, ItemCheckEventArgs e) + { + if (!_initialized || _disableEvents) + { + return; + } + + var device = _lgService?.SelectedDevice; + if (device == null) + { + return; + } + + if (e.Index is 0 or 1 or 4 or 7 && !(device.PowerOnAfterResume || device.PowerOnAfterStartup || device.PowerOnAfterScreenSaver || device.PowerOnByWindows)) + { + MessageForms.InfoOk( +@"Be sure to activate the following setting on the TV, or the app will not be able to wake the TV: + +Connection > Mobile TV On > Turn on via Wi-Fi (Networked Standby Mode) + +See Options to test this functionality. +You can also activate this option by using the Expert-button and selecting Wake-On-LAN > Enabled." + ); + } + + BeginInvoke(() => + { + device.PowerOnAfterStartup = clbLgPower.GetItemChecked(0); + device.PowerOnAfterResume = clbLgPower.GetItemChecked(1); + device.PowerOffOnShutdown = clbLgPower.GetItemChecked(2); + device.PowerOffOnStandby = clbLgPower.GetItemChecked(3); + device.PowerOffOnScreenSaver = clbLgPower.GetItemChecked(4); + device.PowerOnAfterScreenSaver = clbLgPower.GetItemChecked(5); + device.PowerOnAfterManualPowerOff = clbLgPower.GetItemChecked(6); + device.TriggersEnabled = clbLgPower.GetItemChecked(7); + device.PowerOffByWindows = clbLgPower.GetItemChecked(8); + device.PowerOnByWindows = clbLgPower.GetItemChecked(9); + device.UseSecureConnection = clbLgPower.GetItemChecked(10); + + _lgService.InstallEventHandlers(); + + if (e.Index == 10) + { + _lgService.RefreshDevices().ContinueWith((_) => BeginInvoke(() => FillLgDevices())); + } + }); + } + + 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(() => FillLgDevices())); + } + + private void edtShortcutLg_TextChanged(object sender, EventArgs e) + { + var text = edtShortcutLg.Text; + + var preset = GetSelectedLgPreset(); + + if (preset == null || string.IsNullOrEmpty(text)) + { + edtShortcutLg.ForeColor = SystemColors.WindowText; + } + else + { + //edtShortcutLg.ForeColor = ShortCutExists(text, preset.id) ? Color.Red : SystemColors.WindowText; + } + } + + private void btnLgAddDevice_Click(object sender, EventArgs e) + { + var values = MessageForms.ShowDialog("Add tv", new[] { "Name", "Ip-address", "MAC-address" }, ValidateAddDevice); + if (values.Any()) + { + var device = new LgDevice(values[0].Value.ToString(), values[1].Value.ToString(), values[2].Value.ToString()); + + var form = MessageForms.ShowProgress("Connecting to device..."); + + var result = false; + Enabled = false; + try + { + var task = device.TestConnection(); + + result = Utils.WaitForTask(task); + } + finally + { + form.Close(); + Enabled = true; + } + + if (!result && MessageForms.QuestionYesNo("Unable to connect to the device. Are you sure you want to add it?") != DialogResult.Yes) + { + return; + } + + _lgService.AddCustomDevice(device); + + FillLgDevices(); + } + } + + private string ValidateAddDevice(IEnumerable values) + { + if (values.Any(v => string.IsNullOrEmpty(v.Value?.ToString()))) + { + return "Please fill in all the fields"; + } + + return null; + } + + private void btnLgRemoveDevice_Click(object sender, EventArgs e) + { + if (MessageForms.QuestionYesNo("Are you sure you want to remove this device?") != DialogResult.Yes) + { + return; + } + + var device = _lgService.SelectedDevice; + + if (device != null) + { + _lgService.RemoveCustomDevice(device); + + FillLgDevices(); + } + } + + private void mnuLgButtons_Opening(object sender, CancelEventArgs e) + { + mnuLgActions.DropDownItems.Clear(); + + var preset = GetSelectedLgPreset(); + + if (preset == null) + { + return; + } + + var device = _lgService.GetPresetDevice(preset); + + BuildLgActionMenu(device, mnuLgActions.DropDownItems, mnuLgActions.Name, miLgAddAction_Click); + FormUtils.BuildServicePresetsMenu(mnuLgNvPresets, _nvService, "NVIDIA", miLgAddNvPreset_Click); + FormUtils.BuildServicePresetsMenu(mnuLgAmdPresets, _amdService, "AMD", miLgAddAmdPreset_Click); + } + + private void btnLgDeviceConvertToCustom_Click(object sender, EventArgs e) + { + if (MessageForms.QuestionYesNo( +@"This will convert the automatically detected device to a custom variant. +This means that the device will remain here even if it is not detected anymore. +Do you want to continue?" + ) != DialogResult.Yes) + { + return; + } + + _lgService.SelectedDevice.ConvertToCustom(); + + FillLgDevices(); + } + + private void chkLgRemoteControlShow_CheckedChanged(object sender, EventArgs e) + { + scLgController.Panel2Collapsed = !chkLgRemoteControlShow.Checked; + _lgService.Config.ShowRemoteControl = chkLgRemoteControlShow.Checked; + } + + private void mnuLgExpert_Opening(object sender, CancelEventArgs e) + { + var device = _lgService.SelectedDevice; + + var eligibleModels = new[] { "B9", "C9", "E9", "W9", "C2", "G2" }; + var eligibleModelsEnable = new[] { "B9", "C9", "E9", "W9" }; + + var visible = eligibleModels.Any(m => device?.ModelName?.Contains(m) == true); + var enableVisible = eligibleModelsEnable.Any(m => device?.ModelName?.Contains(m) == true); + mnuLgOLEDMotionPro.Visible = visible; + miLgEnableMotionPro.Visible = enableVisible; + miLgExpertSeparator1.Visible = visible; + + BuildLgActionMenu(device, mnuLgExpert.Items, mnuLgExpert.Name, btnLgExpertColorGamut_Click, _lgService.Config.ShowAdvancedActions, true); + } + + private void BuildLgActionMenu(LgDevice device, ToolStripItemCollection parent, string parentName, EventHandler clickEvent, bool showAdvanced = false, bool showGameBar = false) + { + if (device == null) + { + return; + } + + var actions = device.GetInvokableActions(showAdvanced); + var gameBarActions = device.GetInvokableActionsForGameBar(); + var activatedGameBarActions = device.GetActionsForGameBar(); + + const string gameBarName = "miGameBar"; + + var expertActions = actions.Where(a => a.EnumType != null || a.MaxValue > a.MinValue).ToList(); + + var categories = expertActions.Select(a => a.Category ?? "misc").Where(c => !string.IsNullOrEmpty(c)).Distinct(); + + foreach (var category in categories) + { + var catMenuItem = FormUtils.BuildDropDownMenuEx(parent, parentName, Utils.FirstCharUpperCase(category), null, null, category); + + foreach (var action in expertActions.Where(a => (a.Category ?? "misc") == category)) + { + if (!showGameBar) + { + var text = action.Title ?? action.Name; + + var item = catMenuItem.DropDownItems.Add(text); + item.Tag = action; + item.Click += clickEvent; + continue; + } + + var menu = FormUtils.BuildDropDownMenuEx(catMenuItem.DropDownItems, catMenuItem.Name, action.Title, action.EnumType, clickEvent, action, (int)action.MinValue, (int)action.MaxValue, action.NumberOfValues > 1); + + if (!gameBarActions.Contains(action)) + { + continue; + } + + var itemName = $"{menu.Name}_{gameBarName}"; + var gameBarItem = (ToolStripMenuItem)menu.DropDownItems.Find(itemName, false).FirstOrDefault(); + + if (gameBarItem == null) + { + var separator = new ToolStripSeparator(); + menu.DropDownItems.Add(separator); + + gameBarItem = (ToolStripMenuItem)menu.DropDownItems.Add("Show in Game Bar", null, miLgGameBarToggle_Click); + gameBarItem.CheckOnClick = true; + gameBarItem.Checked = activatedGameBarActions.Contains(action); + gameBarItem.Name = itemName; + gameBarItem.Tag = action.Name; + } + } + } + + if (!showAdvanced) + { + return; + } + + var presetActions = actions.Where(a => a.Preset != null); + + if (presetActions.Any() && parent.Find("miLgExpertActionsSeparator", false).Length == 0) + { + parent.Add(new ToolStripSeparator + { + Name = "miLgExpertActionsSeparator" + }); + } + + foreach (var presetAction in presetActions) + { + var menu = FormUtils.BuildDropDownMenuEx(parent, parentName, presetAction.Name, null, btnLgExpertPresetAction_Click, presetAction.Preset); + } + } + + private void miLgGameBarToggle_Click(object sender, EventArgs e) + { + var device = _lgService.SelectedDevice; + + if (device == null) + { + return; + } + + var item = sender as ToolStripMenuItem; + if (item.Checked) + { + device.AddGameBarAction((string)item.Tag); + } + else + { + device.RemoveGameBarAction((string)item.Tag); + } + } + + private void btnLgExpert_Click(object sender, EventArgs e) + { + mnuLgExpert.Show(btnLgExpert, btnLgExpert.PointToClient(Cursor.Position)); + } + + private void btnLgExpertColorGamut_Click(object sender, EventArgs e) + { + var item = sender as ToolStripItem; + var action = item.Tag as LgDevice.InvokableAction; + var value = item.AccessibleName ?? item.Text; + + if (action.NumberOfValues > 1) + { + ApplyLgExpertValueRange(action); + return; + } + + try + { + _lgService.SelectedDevice?.ExecuteAction(action, new[] { value }); + } + catch (InvalidOperationException ex) + { + Logger.Error(ex); + + MessageForms.ErrorOk("Error exectuting action: " + ex.Message); + } + } + + private void ApplyLgExpertValueRange(LgDevice.InvokableAction action) + { + var value = ShowLgActionForm(action); + + if (value == null) + { + return; + } + + var values = value.Split(";"); + + _lgService.SelectedDevice?.ExecuteAction(action, values); + } + + private void btnLgExpertPresetAction_Click(object sender, EventArgs e) + { + var item = sender as ToolStripItem; + var preset = (LgPreset)item.Tag; + + _lgService.ApplyPreset(preset).ConfigureAwait(false); + } + + private void miLgEnableMotionPro_Click(object sender, EventArgs e) + { + if (MessageForms.QuestionYesNo("Are you sure you want to enable OLED Motion Pro? This app and its creator are in no way accountable for any damages it may cause to your tv.") == DialogResult.Yes) + { + _lgService.SelectedDevice?.SetOLEDMotionPro("OLED Motion Pro"); + + MessageForms.InfoOk("Setting applied."); + } + } + + private void miLgDisableMotionPro_Click(object sender, EventArgs e) + { + _lgService.SelectedDevice?.SetOLEDMotionPro("OLED Motion"); + + MessageForms.InfoOk("Setting applied."); + } + + private void cbxLgApps_KeyPress(object sender, KeyPressEventArgs e) + { + if (e.KeyChar == ((char)Keys.Back)) + { + cbxLgApps.SelectedIndex = -1; + } + } + + private void btnLgPresetEditTriggerConditions_Click(object sender, EventArgs e) + { + var preset = GetSelectedLgPreset(); + + if (preset == null) + { + return; + } + + var dropDownValues = Utils.GetDescriptions(fromValue: 1); + + var values = MessageForms.ShowDialog("Set trigger conditions", new[] { + new MessageForms.FieldDefinition + { + Label = "Set desired trigger conditions", + FieldType = MessageForms.FieldType.Flags, + Values = dropDownValues, + Value = edtLgPresetTriggerConditions.Tag ?? 0 + } + }); + + if (!values.Any()) + { + return; + } + + var value = (PresetConditionType)values.First().Value; + edtLgPresetTriggerConditions.Tag = (PresetConditionType)values.First().Value; + edtLgPresetTriggerConditions.Text = Utils.GetDescriptions((int)value).Join(", "); + } + + public void ToggleGameBar() + { + if (_gameBarForm == null || !_gameBarForm.Visible) + { + if (_gameBarForm == null || _gameBarForm.IsDisposed) + { + if (_lgService?.SelectedDevice == null) + { + return; + } + + _gameBarForm = new LgGameBar(_lgService); + } + + _gameBarForm.Show(); + _gameBarForm.Activate(); + } + else + { + _gameBarForm?.Hide(); + } + } + + private void btnLgGameBar_Click(object sender, EventArgs e) + { + ToggleGameBar(); + } + + private void edtLgGameBarShortcut_KeyDown(object sender, KeyEventArgs e) + { + ((TextBox)sender).Text = Utils.FormatKeyboardShortcut(e); + } + + private void edtLgGameBarShortcut_KeyUp(object sender, KeyEventArgs e) + { + Utils.HandleKeyboardShortcutUp(e); + } + + private void btnLgDeviceOptionsHelp_Click(object sender, EventArgs e) + { + MessageForms.InfoOk( +@"Notes: +- power on after startup requires ""Automatically start after login"" - see Options +- power on after resume from standby may need some retries for waking TV - see Options +- power off on shutdown: because this app cannot detect a restart, restarting could also trigger this. Hold down Ctrl on restart to prevent power off. +- Use Windows power settings: powering on/off of TV will follow Windows settings. If activated, it's better to disable all other power options except power off on shutdown. +"); + } + + private void cbxLgPcHdmiPort_SelectedIndexChanged(object sender, EventArgs e) + { + if (_lgService?.SelectedDevice == null) + { + return; + } + + _lgService.SelectedDevice.HDMIPortNumber = cbxLgPcHdmiPort.SelectedIndex; + } + + private void lvLgPresets_ColumnClick(object sender, ColumnClickEventArgs e) + { + FormUtils.ListViewSort(sender, e); + } + + private void mnuLgProgram_Click(object sender, EventArgs e) + { + var file = Utils.SelectFile(); + + if (file != null) + { + FormUtils.AddStepToTextBox(edtStepsLg, $"StartProgram({file.FullName})"); + } + } + + private void btnLgSettings_Click(object sender, EventArgs e) + { + var shortcut = FormUtils.EditShortcut(_config.LgQuickAccessShortcut, "Quick Access shortcut", "LG controller settings"); + + if (shortcut == null) + { + return; + } + + var clear = !string.IsNullOrEmpty(_config.LgQuickAccessShortcut); + + _config.LgQuickAccessShortcut = shortcut; + + Utils.RegisterShortcut(_mainHandle, SHORTCUTID_LGQA, _config.LgQuickAccessShortcut, clear); + } + + private void lvLgPresets_ItemChecked(object sender, ItemCheckedEventArgs e) + { + FormUtils.ListViewItemChecked(lvLgPresets, e); + } + + private void lvNvPresets_ItemCheck(object sender, ItemCheckEventArgs e) + { + var listView = sender as System.Windows.Forms.ListView; + + if (!listView.Focused) + { + return; + } + + + var point = listView.PointToClient(Cursor.Position); + + if (point.X >= 20) + { + return; + } + + var listItem = listView.Items[e.Index]; + + if (listItem.Tag == null) + { + MessageForms.WarningOk("Quick Access cannot be enabled for this item."); + e.NewValue = e.CurrentValue; + } + + if (e.NewValue == CheckState.Checked && string.IsNullOrEmpty(listItem.Text)) + { + MessageForms.WarningOk("A name must be entered before enabling Quick Access."); + e.NewValue = e.CurrentValue; + } + } + } +} diff --git a/ColorControl/Services/LG/LgPanel.resx b/ColorControl/Services/LG/LgPanel.resx new file mode 100644 index 0000000..444659f --- /dev/null +++ b/ColorControl/Services/LG/LgPanel.resx @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + + 140, 17 + + \ No newline at end of file diff --git a/ColorControl/Services/LG/LgService.cs b/ColorControl/Services/LG/LgService.cs index 3e08be6..76ef641 100644 --- a/ColorControl/Services/LG/LgService.cs +++ b/ColorControl/Services/LG/LgService.cs @@ -831,6 +831,10 @@ namespace ColorControl.Services.LG public void PowerSettingChanged(WindowsPowerSetting setting) { + if (Devices == null) + { + return; + } if (setting == WindowsPowerSetting.Off) {