mirror of
https://github.com/Maassoft/ColorControl.git
synced 2026-10-22 08:32:18 -05:00
improve message dialogs
This commit is contained in:
1 parent
4b6d687e4c
commit
dd083a5e9f
8 files changed
+238
-156
No files matched your search
@@ -97,6 +97,7 @@
|
||||
<PackageReference Include="NLog" Version="5.0.4" />
|
||||
<PackageReference Include="NStandard" Version="0.15.2" />
|
||||
<PackageReference Include="NWin32" Version="1.2.3" />
|
||||
<PackageReference Include="System.Management" Version="7.0.0" />
|
||||
<PackageReference Include="TaskScheduler" Version="2.10.1" />
|
||||
<PackageReference Include="Vanara.PInvoke.IpHlpApi" Version="3.4.9" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using ColorControl.Common;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
@@ -28,6 +30,7 @@ namespace ColorControl.Forms
|
||||
public decimal MinValue { get; set; }
|
||||
public decimal MaxValue { get; set; }
|
||||
public int NumberOfValues { get; set; }
|
||||
public int StepSize { get; set; }
|
||||
public object Value { get; set; }
|
||||
|
||||
public int ValueAsInt => int.Parse(Value.ToString());
|
||||
@@ -54,6 +57,15 @@ namespace ColorControl.Forms
|
||||
var trackBar = sender as TrackBar;
|
||||
var edit = (NumericUpDown)_controls[trackBar];
|
||||
|
||||
var indexDbl = (trackBar.Value * 1.0) / trackBar.TickFrequency;
|
||||
var index = Convert.ToInt32(Math.Round(indexDbl));
|
||||
|
||||
var newValue = trackBar.Value < trackBar.Maximum ? trackBar.TickFrequency * index : trackBar.Value;
|
||||
newValue = Math.Max(newValue, trackBar.Minimum);
|
||||
newValue = Math.Min(newValue, trackBar.Maximum);
|
||||
|
||||
trackBar.Value = newValue;
|
||||
|
||||
edit.Value = trackBar.Value;
|
||||
|
||||
_toolTip ??= new ToolTip();
|
||||
@@ -114,30 +126,42 @@ namespace ColorControl.Forms
|
||||
|
||||
var prompt = new MessageForm()
|
||||
{
|
||||
Width = 500,
|
||||
Height = 90 + (fields.Count() * 55),
|
||||
Width = 460,
|
||||
Height = 106 + (fields.Count() * 50),
|
||||
FormBorderStyle = FormBorderStyle.FixedDialog,
|
||||
Text = caption,
|
||||
StartPosition = FormStartPosition.CenterScreen
|
||||
};
|
||||
|
||||
var groupBox = new Panel();
|
||||
groupBox.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom;
|
||||
groupBox.Top = 0;
|
||||
groupBox.Left = 0;
|
||||
groupBox.Width = prompt.Width;
|
||||
groupBox.Height = prompt.Height - 80;
|
||||
groupBox.BackColor = SystemColors.Window;
|
||||
//groupBox.Margin = new Padding(20);
|
||||
|
||||
prompt.Controls.Add(groupBox);
|
||||
|
||||
var top = 10;
|
||||
var boxes = new List<Control>();
|
||||
var counter = 1;
|
||||
const int DefaultLeft = 20;
|
||||
|
||||
foreach (var field in fields)
|
||||
{
|
||||
var label = field.Label;
|
||||
var textLabel = new Label() { Left = 40, Top = top, Text = label, AutoSize = true };
|
||||
top += 25;
|
||||
prompt.Controls.Add(textLabel);
|
||||
var textLabel = new Label() { Left = DefaultLeft, Top = top, Text = label, AutoSize = true };
|
||||
top += 20;
|
||||
groupBox.Controls.Add(textLabel);
|
||||
|
||||
Control control;
|
||||
|
||||
switch (field.FieldType)
|
||||
{
|
||||
case FieldType.Text:
|
||||
var textBox = new MaskedTextBox() { Left = 40, Top = top, Width = 400 };
|
||||
var textBox = new MaskedTextBox() { Left = DefaultLeft, Top = top, Width = 400 };
|
||||
|
||||
if (label.Contains("Ip-address"))
|
||||
{
|
||||
@@ -157,7 +181,7 @@ namespace ColorControl.Forms
|
||||
case FieldType.Shortcut:
|
||||
var shortcutTextBox = new TextBox()
|
||||
{
|
||||
Left = 40,
|
||||
Left = DefaultLeft,
|
||||
Top = top,
|
||||
Width = 200,
|
||||
Name = $"edtShortcut_{counter}",
|
||||
@@ -176,7 +200,7 @@ namespace ColorControl.Forms
|
||||
break;
|
||||
|
||||
case FieldType.Numeric:
|
||||
var numericEdit = new NumericUpDown() { Left = 40, Top = top, Width = 400 };
|
||||
var numericEdit = new NumericUpDown() { Left = DefaultLeft, Top = top, Width = 400 };
|
||||
|
||||
if (field.MinValue != field.MaxValue)
|
||||
{
|
||||
@@ -195,7 +219,7 @@ namespace ColorControl.Forms
|
||||
case FieldType.DropDown:
|
||||
var comboBox = new ComboBox
|
||||
{
|
||||
Left = 40,
|
||||
Left = DefaultLeft,
|
||||
Top = top,
|
||||
Width = 400,
|
||||
DropDownStyle = ComboBoxStyle.DropDownList
|
||||
@@ -218,7 +242,7 @@ namespace ColorControl.Forms
|
||||
case FieldType.CheckBox:
|
||||
var checkBox = new CheckBox
|
||||
{
|
||||
Left = 40,
|
||||
Left = DefaultLeft,
|
||||
Top = top,
|
||||
Width = 24,
|
||||
};
|
||||
@@ -231,7 +255,7 @@ namespace ColorControl.Forms
|
||||
case FieldType.Flags:
|
||||
var checkedListBox = new CheckedListBox
|
||||
{
|
||||
Left = 40,
|
||||
Left = DefaultLeft,
|
||||
Top = top,
|
||||
Width = 400,
|
||||
Height = 100,
|
||||
@@ -259,7 +283,7 @@ namespace ColorControl.Forms
|
||||
break;
|
||||
|
||||
case FieldType.TrackBar:
|
||||
var trackBar = new TrackBar { Left = 40, Top = top, Width = 300 };
|
||||
var trackBar = new TrackBar { Left = DefaultLeft, Top = top, Width = 300 };
|
||||
var trackBarEdit = new NumericUpDown() { Left = trackBar.Left + trackBar.Width + 10, Top = top + 10, Width = 90 };
|
||||
|
||||
trackBarEdit.ValueChanged += prompt.TrackBarEdit_ValueChanged;
|
||||
@@ -274,7 +298,16 @@ namespace ColorControl.Forms
|
||||
{
|
||||
trackBar.Minimum = (int)field.MinValue;
|
||||
trackBar.Maximum = (int)field.MaxValue;
|
||||
trackBar.TickFrequency = (trackBar.Maximum - trackBar.Minimum) / 100;
|
||||
|
||||
if (field.StepSize > 0)
|
||||
{
|
||||
trackBar.TickFrequency = field.StepSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
var tick = (trackBar.Maximum - trackBar.Minimum);
|
||||
trackBar.TickFrequency = tick >= 100000 ? 5000 : 1;
|
||||
}
|
||||
|
||||
trackBarEdit.Minimum = field.MinValue;
|
||||
trackBarEdit.Maximum = field.MaxValue;
|
||||
@@ -289,7 +322,7 @@ namespace ColorControl.Forms
|
||||
top += trackBar.Height - 25;
|
||||
prompt.Height += trackBar.Height - 25;
|
||||
|
||||
prompt.Controls.Add(trackBarEdit);
|
||||
groupBox.Controls.Add(trackBarEdit);
|
||||
|
||||
control = trackBar;
|
||||
break;
|
||||
@@ -300,13 +333,13 @@ namespace ColorControl.Forms
|
||||
}
|
||||
|
||||
top += 30;
|
||||
prompt.Controls.Add(control);
|
||||
groupBox.Controls.Add(control);
|
||||
boxes.Add(control);
|
||||
control.Tag = field;
|
||||
counter++;
|
||||
}
|
||||
|
||||
var confirmation = new Button() { Text = "OK", Left = 365, Width = 75, Top = prompt.ClientRectangle.Height - 30 };
|
||||
var confirmation = new Button() { Text = "OK", Left = DefaultLeft + 400 - 75, Width = 75, Top = prompt.ClientRectangle.Height - 30 };
|
||||
confirmation.Click += (sender, e) =>
|
||||
{
|
||||
foreach (var box in boxes)
|
||||
|
||||
@@ -12,6 +12,7 @@ using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Management;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
@@ -542,6 +543,10 @@ namespace ColorControl.Services.LG
|
||||
|
||||
await Task.Delay(2000);
|
||||
|
||||
//var startWatch = new ManagementEventWatcher("SELECT * FROM Win32_ProcessStartTrace");
|
||||
//startWatch.EventArrived += startWatch_EventArrived;
|
||||
//startWatch.Start();
|
||||
|
||||
MonitorContext ??= new ProcessMonitorContext();
|
||||
//Process[] lastProcesses = null;
|
||||
|
||||
@@ -634,6 +639,11 @@ namespace ColorControl.Services.LG
|
||||
}
|
||||
}
|
||||
|
||||
private void startWatch_EventArrived(object sender, EventArrivedEventArgs e)
|
||||
{
|
||||
//Logger.Debug("Process started: " + e.NewEvent.Properties["ProcessName"].Value);
|
||||
}
|
||||
|
||||
private async Task<int> HandleScreenSaverProcessAsync(int lastProcessId, Process[] processes, List<LgDevice> connectedDevices)
|
||||
{
|
||||
var process = processes.FirstOrDefault(p => p.ProcessName.ToLowerInvariant().EndsWith(".scr"));
|
||||
|
||||
@@ -18,24 +18,18 @@ namespace ColorControl.Services.NVIDIA
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
if (cbxDitheringBitDepth.Items.Count == 0)
|
||||
{
|
||||
cbxDitheringBitDepth.Items.AddRange(Utils.GetDescriptions<NvDitherBits>().ToArray());
|
||||
cbxDitheringMode.Items.AddRange(Utils.GetDescriptions<NvDitherMode>().ToArray());
|
||||
FillGradient();
|
||||
}
|
||||
cbxDitheringBitDepth.Items.AddRange(Utils.GetDescriptions<NvDitherBits>().ToArray());
|
||||
cbxDitheringMode.Items.AddRange(Utils.GetDescriptions<NvDitherMode>().ToArray());
|
||||
FillGradient();
|
||||
|
||||
if (cbxDitheringDisplay.Items.Count == 0)
|
||||
{
|
||||
var displays = _nvService.GetDisplayInfos();
|
||||
var primaryDisplay = _nvService.GetPrimaryDisplay();
|
||||
var primaryDisplayInfo = displays.FirstOrDefault(d => d.Display == primaryDisplay);
|
||||
var index = primaryDisplayInfo != null ? displays.IndexOf(primaryDisplayInfo) : 0;
|
||||
var displays = _nvService.GetDisplayInfos();
|
||||
var primaryDisplay = _nvService.GetPrimaryDisplay();
|
||||
var primaryDisplayInfo = displays.FirstOrDefault(d => d.Display == primaryDisplay);
|
||||
var index = primaryDisplayInfo != null ? displays.IndexOf(primaryDisplayInfo) : 0;
|
||||
|
||||
cbxDitheringDisplay.Items.AddRange(displays.ToArray());
|
||||
cbxDitheringDisplay.Items.AddRange(displays.ToArray());
|
||||
|
||||
cbxDitheringDisplay.SelectedIndex = index;
|
||||
}
|
||||
cbxDitheringDisplay.SelectedIndex = index;
|
||||
|
||||
UpdateDitherSettings();
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using ColorControl.Common;
|
||||
using ColorControl.Forms;
|
||||
using NvAPIWrapper.GPU;
|
||||
using NvAPIWrapper.Native;
|
||||
using NvAPIWrapper.Native.GPU;
|
||||
@@ -22,6 +23,8 @@ namespace ColorControl.Services.NVIDIA
|
||||
|
||||
public class NvGpuOcSettings
|
||||
{
|
||||
public static readonly uint DefaultPowerPCM = 100000;
|
||||
|
||||
public string PCIIdentifier { get; set; }
|
||||
public int MemoryOffsetKHz { get; set; }
|
||||
public NvGpuOcType Type { get; set; }
|
||||
@@ -29,7 +32,7 @@ namespace ColorControl.Services.NVIDIA
|
||||
public uint MaximumFrequencyKHz { get; set; }
|
||||
public uint MaximumVoltageUv { get; set; }
|
||||
public uint VoltageBoostPercent { get; set; }
|
||||
public uint PowerPCM { get; set; }
|
||||
public uint PowerPCM { get; set; } = DefaultPowerPCM;
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
@@ -73,6 +76,16 @@ namespace ColorControl.Services.NVIDIA
|
||||
value += $"Power: {PowerPCM / 1000}%";
|
||||
}
|
||||
|
||||
if (VoltageBoostPercent > 0)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(value))
|
||||
{
|
||||
value += ", ";
|
||||
}
|
||||
|
||||
value += $"Voltage: {VoltageBoostPercent}%";
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(value))
|
||||
{
|
||||
value = "None";
|
||||
@@ -96,6 +109,7 @@ namespace ColorControl.Services.NVIDIA
|
||||
public int? DefaultPowerInMilliWatts { get; private set; }
|
||||
public int MinPowerInMilliWatts { get; private set; }
|
||||
public int MaxPowerInMilliWatts { get; private set; }
|
||||
public int MinCoreStepInMHz { get; private set; } = 15;
|
||||
|
||||
|
||||
public static readonly PublicClockDomain[] Domains = new[] { PublicClockDomain.Graphics, PublicClockDomain.Memory };
|
||||
@@ -210,6 +224,8 @@ namespace ColorControl.Services.NVIDIA
|
||||
{
|
||||
Logger.Debug(ex);
|
||||
|
||||
MinCoreStepInMHz = 12;
|
||||
|
||||
var bla = GPUApi.GetClockBoostMask(GPU.Handle);
|
||||
|
||||
var masks = bla._Masks;
|
||||
@@ -369,6 +385,10 @@ namespace ColorControl.Services.NVIDIA
|
||||
|
||||
ocSettings.PowerPCM = power.PowerPolicyStatusEntries.FirstOrDefault(e => e.PerformanceStateId == PerformanceStateId.P0_3DPerformance).PowerTargetInPCM;
|
||||
|
||||
var voltageBoost = GPUApi.GetCoreVoltageBoostPercent(GPU.Handle);
|
||||
|
||||
ocSettings.VoltageBoostPercent = voltageBoost.Percent;
|
||||
|
||||
foreach (var domain in Domains)
|
||||
{
|
||||
var locked = GetLockedBoost(domain);
|
||||
@@ -662,5 +682,106 @@ namespace ColorControl.Services.NVIDIA
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
internal MessageForms.FieldDefinition GetCoreOffsetField(NvGpuOcSettings settings)
|
||||
{
|
||||
var graphicsDelta = GetDeltaClockMinMax(PublicClockDomain.Graphics);
|
||||
|
||||
//var field = new MessageForms.FieldDefinition
|
||||
//{
|
||||
// Label = $"Core offset in MHz ({graphicsDelta.Item1.ToUnitString()} to {graphicsDelta.Item2.ToUnitString()})",
|
||||
// FieldType = MessageForms.FieldType.Numeric,
|
||||
// MinValue = graphicsDelta.Item1 / 1000,
|
||||
// MaxValue = graphicsDelta.Item2 / 1000,
|
||||
// Value = settings.GraphicsOffsetKHz / 1000
|
||||
//};
|
||||
|
||||
var field = new MessageForms.FieldDefinition
|
||||
{
|
||||
Label = $"Core offset in MHz ({graphicsDelta.Item1.ToUnitString()} to {graphicsDelta.Item2.ToUnitString()})",
|
||||
FieldType = MessageForms.FieldType.TrackBar,
|
||||
MinValue = graphicsDelta.Item1 / 1000,
|
||||
MaxValue = graphicsDelta.Item2 / 1000,
|
||||
Value = settings.GraphicsOffsetKHz / 1000,
|
||||
StepSize = MinCoreStepInMHz
|
||||
};
|
||||
|
||||
return field;
|
||||
}
|
||||
|
||||
internal MessageForms.FieldDefinition GetMemoryOffsetField(NvGpuOcSettings settings)
|
||||
{
|
||||
var memoryDelta = GetDeltaClockMinMax(PublicClockDomain.Memory);
|
||||
|
||||
//var field = new MessageForms.FieldDefinition
|
||||
//{
|
||||
// Label = $"Memory offset in MHz ({memoryDelta.Item1.ToUnitString()} to {memoryDelta.Item2.ToUnitString()})",
|
||||
// FieldType = MessageForms.FieldType.Numeric,
|
||||
// MinValue = memoryDelta.Item1 / 1000,
|
||||
// MaxValue = memoryDelta.Item2 / 1000,
|
||||
// Value = settings.MemoryOffsetKHz / 1000
|
||||
//};
|
||||
|
||||
var field = new MessageForms.FieldDefinition
|
||||
{
|
||||
Label = $"Memory offset in MHz ({memoryDelta.Item1.ToUnitString()} to {memoryDelta.Item2.ToUnitString()})",
|
||||
FieldType = MessageForms.FieldType.TrackBar,
|
||||
MinValue = memoryDelta.Item1 / 1000,
|
||||
MaxValue = memoryDelta.Item2 / 1000,
|
||||
Value = settings.MemoryOffsetKHz / 1000,
|
||||
StepSize = 25
|
||||
};
|
||||
|
||||
return field;
|
||||
}
|
||||
|
||||
internal MessageForms.FieldDefinition GetPowerField(NvGpuOcSettings settings)
|
||||
{
|
||||
var powerLimits = GetPowerLimits();
|
||||
|
||||
var defaultPowerLimitMw = DefaultPowerInMilliWatts;
|
||||
|
||||
if (settings.PowerPCM == 0)
|
||||
{
|
||||
settings.PowerPCM = NvGpuOcSettings.DefaultPowerPCM;
|
||||
}
|
||||
else if (settings.PowerPCM < powerLimits.Item1)
|
||||
{
|
||||
settings.PowerPCM = powerLimits.Item1;
|
||||
}
|
||||
|
||||
var powerField = defaultPowerLimitMw > 0 ?
|
||||
new MessageForms.FieldDefinition
|
||||
{
|
||||
Label = $"Power limit in milli watts. Min: {MinPowerInMilliWatts}, max: {MaxPowerInMilliWatts}",
|
||||
FieldType = MessageForms.FieldType.TrackBar,
|
||||
Value = (int)((decimal)defaultPowerLimitMw / 100000 * settings.PowerPCM),
|
||||
MinValue = MinPowerInMilliWatts,
|
||||
MaxValue = MaxPowerInMilliWatts
|
||||
}
|
||||
: new MessageForms.FieldDefinition
|
||||
{
|
||||
Label = $"Power limit in PCM (per cent mille). Min: {powerLimits.Item1}, max: {powerLimits.Item2}",
|
||||
FieldType = MessageForms.FieldType.TrackBar,
|
||||
Value = settings.PowerPCM,
|
||||
MinValue = powerLimits.Item1,
|
||||
MaxValue = powerLimits.Item2
|
||||
};
|
||||
|
||||
return powerField;
|
||||
}
|
||||
|
||||
internal MessageForms.FieldDefinition GetVoltageBoostField(NvGpuOcSettings settings)
|
||||
{
|
||||
var field = new MessageForms.FieldDefinition
|
||||
{
|
||||
Label = "Voltage boost in %",
|
||||
FieldType = MessageForms.FieldType.TrackBar,
|
||||
Value = settings.VoltageBoostPercent,
|
||||
MinValue = 0,
|
||||
MaxValue = 100
|
||||
};
|
||||
|
||||
return field;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -116,8 +116,6 @@ namespace ColorControl.Services.NVIDIA
|
||||
return;
|
||||
}
|
||||
|
||||
var gpus = new List<PhysicalGPU>();
|
||||
|
||||
var text = Program.TS_TASKNAME;
|
||||
foreach (var displayInfo in displays)
|
||||
{
|
||||
@@ -161,14 +159,9 @@ namespace ColorControl.Services.NVIDIA
|
||||
}
|
||||
|
||||
text += "\n" + displayInfo.InfoLine;
|
||||
|
||||
if (!gpus.Contains(displayInfo.Display.DisplayDevice.PhysicalGPU))
|
||||
{
|
||||
gpus.Add(displayInfo.Display.DisplayDevice.PhysicalGPU);
|
||||
}
|
||||
}
|
||||
|
||||
UpdateNvGpuInfo(gpus);
|
||||
UpdateNvGpuInfo();
|
||||
|
||||
FormUtils.SetNotifyIconText(_trayIcon, text);
|
||||
}
|
||||
@@ -547,7 +540,7 @@ namespace ColorControl.Services.NVIDIA
|
||||
private void BuildNvidiaDriverSettingsMenu(ToolStripDropDownItem parent, Dictionary<uint, uint> settings = null, ContextMenuStrip contextMenuStrip = null)
|
||||
{
|
||||
var driverSettings = _nvService.GetVisibleSettings().OrderBy(s => s.GroupName);
|
||||
var handledGroupItems = new List<ToolStripMenuItem>();
|
||||
var handledGroupItems = new Dictionary<ToolStripMenuItem, bool>();
|
||||
var showUnchanged = settings != null;
|
||||
var defaultValue = SettingMeta.UnsetDwordValue;
|
||||
|
||||
@@ -574,14 +567,14 @@ namespace ColorControl.Services.NVIDIA
|
||||
|
||||
item.Font = _menuItemFonts[!isDefault];
|
||||
|
||||
if (!handledGroupItems.Contains(groupItem))
|
||||
if (!handledGroupItems.ContainsKey(groupItem))
|
||||
{
|
||||
groupItem.Tag = null;
|
||||
handledGroupItems.Add(groupItem);
|
||||
handledGroupItems.Add(groupItem, !isDefault);
|
||||
}
|
||||
if (!isDefault)
|
||||
else if (!isDefault)
|
||||
{
|
||||
groupItem.Tag = true;
|
||||
handledGroupItems[groupItem] = true;
|
||||
}
|
||||
|
||||
var subItemUnchangedName = $"mnuNvDriverSettingItem_{driverSetting.SettingId}_Unchanged";
|
||||
@@ -650,9 +643,9 @@ namespace ColorControl.Services.NVIDIA
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var groupItem in handledGroupItems)
|
||||
foreach (var groupItemKeyValue in handledGroupItems)
|
||||
{
|
||||
groupItem.Font = _menuItemFonts[groupItem.Tag != null];
|
||||
groupItemKeyValue.Key.Font = _menuItemFonts[groupItemKeyValue.Value];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1192,7 +1185,7 @@ namespace ColorControl.Services.NVIDIA
|
||||
{
|
||||
var overclockTypes = Utils.GetDescriptions<NvGpuOcType>();
|
||||
|
||||
var values = MessageForms.ShowDialog("Choose desired overclock settings", new[] {
|
||||
var values = MessageForms.ShowDialog($"Overclock settings - {gpuInfo.GPU.FullName}", new[] {
|
||||
new MessageForms.FieldDefinition
|
||||
{
|
||||
Label = "Overclock method",
|
||||
@@ -1247,7 +1240,7 @@ namespace ColorControl.Services.NVIDIA
|
||||
.OrderBy(x => x)
|
||||
.ToList();
|
||||
var voltValues = curveEntries
|
||||
.Where(e => e.DefaultVoltageInMicroV == 0 || e.DefaultFrequencyInkHz >= minCurveFreq)
|
||||
.Where(e => (e.DefaultVoltageInMicroV == 0 || e.DefaultFrequencyInkHz >= minCurveFreq) && e.DefaultVoltageInMicroV <= 1100000)
|
||||
.OrderBy(e => e.DefaultVoltageInMicroV)
|
||||
.Select(e => (e.DefaultVoltageInMicroV / 1000).ToString())
|
||||
.Distinct()
|
||||
@@ -1258,39 +1251,14 @@ namespace ColorControl.Services.NVIDIA
|
||||
var curveEntry = curveEntries.FirstOrDefault(e => e.VoltageInMicroV == currentGraphicsVoltage);
|
||||
var currentGpuFreq = curveEntry.FrequencyInkHz;
|
||||
|
||||
var memoryDelta = gpuInfo.GetDeltaClockMinMax(NvAPIWrapper.Native.GPU.PublicClockDomain.Memory);
|
||||
var coreOffsetField = gpuInfo.GetCoreOffsetField(currentSettings);
|
||||
var memoryOffsetField = gpuInfo.GetMemoryOffsetField(currentSettings);
|
||||
|
||||
var powerLimits = gpuInfo.GetPowerLimits();
|
||||
var voltageBoostField = gpuInfo.GetVoltageBoostField(currentSettings);
|
||||
var powerField = gpuInfo.GetPowerField(currentSettings);
|
||||
|
||||
var defaultPowerLimitMw = gpuInfo.DefaultPowerInMilliWatts;
|
||||
|
||||
var powerField = defaultPowerLimitMw > 0 ?
|
||||
new MessageForms.FieldDefinition
|
||||
{
|
||||
Label = $"Power limit in milli watts. Min: {gpuInfo.MinPowerInMilliWatts}, max: {gpuInfo.MaxPowerInMilliWatts}",
|
||||
FieldType = MessageForms.FieldType.TrackBar,
|
||||
Value = (int)((decimal)defaultPowerLimitMw / 100000 * currentSettings.PowerPCM),
|
||||
MinValue = gpuInfo.MinPowerInMilliWatts,
|
||||
MaxValue = gpuInfo.MaxPowerInMilliWatts
|
||||
}
|
||||
: new MessageForms.FieldDefinition
|
||||
{
|
||||
Label = $"Power limit in PCM (per cent mille). Min: {powerLimits.Item1}, max: {powerLimits.Item2}",
|
||||
FieldType = MessageForms.FieldType.TrackBar,
|
||||
Value = currentSettings.PowerPCM,
|
||||
MinValue = powerLimits.Item1,
|
||||
MaxValue = powerLimits.Item2
|
||||
};
|
||||
|
||||
var values = MessageForms.ShowDialog("Set desired clock speeds and voltage", new[] {
|
||||
new MessageForms.FieldDefinition
|
||||
{
|
||||
Label = $"Core offset in MHz ({graphicsDelta.Item1.ToUnitString()} to {graphicsDelta.Item2.ToUnitString()})",
|
||||
FieldType = MessageForms.FieldType.Numeric,
|
||||
MinValue = graphicsDelta.Item1 / 1000,
|
||||
MaxValue = graphicsDelta.Item2 / 1000,
|
||||
Value = currentSettings.GraphicsOffsetKHz / 1000
|
||||
},
|
||||
var values = MessageForms.ShowDialog($"Overclock settings - {gpuInfo.GPU.FullName}", new[] {
|
||||
coreOffsetField,
|
||||
new MessageForms.FieldDefinition
|
||||
{
|
||||
Label = "Optional undervolt: maximum voltage in milli volt",
|
||||
@@ -1305,22 +1273,8 @@ namespace ColorControl.Services.NVIDIA
|
||||
Value = currentSettings.MaximumFrequencyKHz / 1000,
|
||||
Values = freqValues,
|
||||
},
|
||||
new MessageForms.FieldDefinition
|
||||
{
|
||||
Label = $"Memory offset in MHz ({memoryDelta.Item1.ToUnitString()} to {memoryDelta.Item2.ToUnitString()})",
|
||||
FieldType = MessageForms.FieldType.Numeric,
|
||||
MinValue = memoryDelta.Item1 / 1000,
|
||||
MaxValue = memoryDelta.Item2 / 1000,
|
||||
Value = currentSettings.MemoryOffsetKHz / 1000
|
||||
},
|
||||
new MessageForms.FieldDefinition
|
||||
{
|
||||
Label = "Voltage boost in %",
|
||||
FieldType = MessageForms.FieldType.Numeric,
|
||||
Value = currentSettings.VoltageBoostPercent,
|
||||
MinValue = 0,
|
||||
MaxValue = 100
|
||||
},
|
||||
memoryOffsetField,
|
||||
voltageBoostField,
|
||||
powerField,
|
||||
});
|
||||
if (!values.Any())
|
||||
@@ -1335,8 +1289,7 @@ namespace ColorControl.Services.NVIDIA
|
||||
nvOverclockSettings.VoltageBoostPercent = values[4].ValueAsUInt;
|
||||
|
||||
var power = values[5].ValueAsUInt;
|
||||
|
||||
nvOverclockSettings.PowerPCM = defaultPowerLimitMw > 0 ? (uint)((decimal)power / defaultPowerLimitMw * 100000) : power;
|
||||
nvOverclockSettings.PowerPCM = powerField.FieldType == MessageForms.FieldType.TrackBar ? (uint)((decimal)power / gpuInfo.DefaultPowerInMilliWatts * 100000) : power;
|
||||
|
||||
return nvOverclockSettings;
|
||||
}
|
||||
@@ -1349,54 +1302,17 @@ namespace ColorControl.Services.NVIDIA
|
||||
PCIIdentifier = gpuInfo.GPU.BusInformation.PCIIdentifiers.ToString()
|
||||
};
|
||||
|
||||
var curveEntries = gpuInfo.CurveV3.GPUCurveEntries;
|
||||
var coreOffsetField = gpuInfo.GetCoreOffsetField(currentSettings);
|
||||
var memoryOffsetField = gpuInfo.GetMemoryOffsetField(currentSettings);
|
||||
|
||||
var freqValues = curveEntries.Select(e => (e.DefaultFrequencyInkHz / 1000).ToString()).Distinct().ToList();
|
||||
var voltValues = curveEntries.Select(e => (e.DefaultVoltageInMicroV / 1000).ToString()).Distinct().ToList();
|
||||
var voltageBoostField = gpuInfo.GetVoltageBoostField(currentSettings);
|
||||
var powerField = gpuInfo.GetPowerField(currentSettings);
|
||||
|
||||
var currentGraphicsVoltage = currentSettings.MaximumVoltageUv > 0 ? currentSettings.MaximumVoltageUv : 1050000;
|
||||
|
||||
var curveEntry = curveEntries.FirstOrDefault(e => e.VoltageInMicroV == currentGraphicsVoltage);
|
||||
var currentGpuFreq = curveEntry.FrequencyInkHz;
|
||||
|
||||
var graphicsDelta = gpuInfo.GetDeltaClockMinMax(NvAPIWrapper.Native.GPU.PublicClockDomain.Graphics);
|
||||
var memoryDelta = gpuInfo.GetDeltaClockMinMax(NvAPIWrapper.Native.GPU.PublicClockDomain.Memory);
|
||||
|
||||
var powerLimits = gpuInfo.GetPowerLimits();
|
||||
|
||||
var values = MessageForms.ShowDialog("Set desired clock speeds and voltage", new[] {
|
||||
new MessageForms.FieldDefinition
|
||||
{
|
||||
Label = $"Core offset in MHz ({graphicsDelta.Item1.ToUnitString()} to {graphicsDelta.Item2.ToUnitString()})",
|
||||
FieldType = MessageForms.FieldType.Numeric,
|
||||
MinValue = graphicsDelta.Item1 / 1000,
|
||||
MaxValue = graphicsDelta.Item2 / 1000,
|
||||
Value = currentSettings.GraphicsOffsetKHz / 1000
|
||||
},
|
||||
new MessageForms.FieldDefinition
|
||||
{
|
||||
Label = $"Memory offset in MHz ({memoryDelta.Item1.ToUnitString()} to {memoryDelta.Item2.ToUnitString()})",
|
||||
FieldType = MessageForms.FieldType.Numeric,
|
||||
MinValue = memoryDelta.Item1 / 1000,
|
||||
MaxValue = memoryDelta.Item2 / 1000,
|
||||
Value = currentSettings.MemoryOffsetKHz / 1000
|
||||
},
|
||||
new MessageForms.FieldDefinition
|
||||
{
|
||||
Label = "Voltage boost in %",
|
||||
FieldType = MessageForms.FieldType.Numeric,
|
||||
Value = currentSettings.VoltageBoostPercent,
|
||||
MinValue = 0,
|
||||
MaxValue = 100
|
||||
},
|
||||
new MessageForms.FieldDefinition
|
||||
{
|
||||
Label = $"Power limit in PCM (per cent mille). Min: {powerLimits.Item1}, max: {powerLimits.Item2}",
|
||||
FieldType = MessageForms.FieldType.Numeric,
|
||||
Value = currentSettings.PowerPCM,
|
||||
MinValue = powerLimits.Item1,
|
||||
MaxValue = powerLimits.Item2
|
||||
},
|
||||
var values = MessageForms.ShowDialog($"Overclock settings - {gpuInfo.GPU.FullName}", new[] {
|
||||
coreOffsetField,
|
||||
memoryOffsetField,
|
||||
voltageBoostField,
|
||||
powerField,
|
||||
});
|
||||
if (!values.Any())
|
||||
{
|
||||
@@ -1406,7 +1322,9 @@ namespace ColorControl.Services.NVIDIA
|
||||
nvOverclockSettings.GraphicsOffsetKHz = values[0].ValueAsInt * 1000;
|
||||
nvOverclockSettings.MemoryOffsetKHz = values[1].ValueAsInt * 1000;
|
||||
nvOverclockSettings.VoltageBoostPercent = values[2].ValueAsUInt;
|
||||
nvOverclockSettings.PowerPCM = values[3].ValueAsUInt;
|
||||
|
||||
var power = values[3].ValueAsUInt;
|
||||
nvOverclockSettings.PowerPCM = powerField.FieldType == MessageForms.FieldType.TrackBar ? (uint)((decimal)power / gpuInfo.DefaultPowerInMilliWatts * 100000) : power;
|
||||
|
||||
return nvOverclockSettings;
|
||||
}
|
||||
@@ -1440,7 +1358,7 @@ namespace ColorControl.Services.NVIDIA
|
||||
var currentGraphicsOffset = gpuInfo.GetOffset(NvAPIWrapper.Native.GPU.PublicClockDomain.Graphics);
|
||||
var currentMemoryOffset = gpuInfo.GetOffset(NvAPIWrapper.Native.GPU.PublicClockDomain.Memory);
|
||||
|
||||
var values = MessageForms.ShowDialog("Set desired clock speeds and voltage", new[] {
|
||||
var values = MessageForms.ShowDialog($"Overclock settings - {gpuInfo.GPU.FullName}", new[] {
|
||||
new MessageForms.FieldDefinition
|
||||
{
|
||||
Label = $"Core offset in MHz ({graphicsMinValue}KHz to {graphicsMaxValue}KHz)",
|
||||
@@ -1454,20 +1372,12 @@ namespace ColorControl.Services.NVIDIA
|
||||
Label = "Voltage in micro volt",
|
||||
FieldType = MessageForms.FieldType.DropDown,
|
||||
Values = voltValues,
|
||||
//FieldType = MessageForms.FieldType.Numeric,
|
||||
//MinValue = 650000,
|
||||
//MaxValue = 1100000,
|
||||
//Value = currentGraphicsVoltage
|
||||
},
|
||||
new MessageForms.FieldDefinition
|
||||
{
|
||||
Label = "Core frequency in KHz",
|
||||
FieldType = MessageForms.FieldType.DropDown,
|
||||
Values = freqValues,
|
||||
//FieldType = MessageForms.FieldType.Numeric,
|
||||
//MinValue = 2000000,
|
||||
//MaxValue = 3200000,
|
||||
//Value = currentGpuFreq
|
||||
},
|
||||
new MessageForms.FieldDefinition
|
||||
{
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace LgTv
|
||||
public void SaveClientKey(string key)
|
||||
{
|
||||
var filename = Path.Combine(Utils.GetDataPath(), ip + "_ClientKey.txt");
|
||||
File.WriteAllText(filename, key);
|
||||
Utils.WriteText(filename, key);
|
||||
}
|
||||
|
||||
public bool HasValidHandShake(string expectedHandShake)
|
||||
@@ -48,7 +48,7 @@ namespace LgTv
|
||||
public void SaveHandShake(string data)
|
||||
{
|
||||
var filename = Path.Combine(Utils.GetDataPath(), ip + "_HandShake.txt");
|
||||
File.WriteAllText(filename, data);
|
||||
Utils.WriteText(filename, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -531,6 +531,19 @@ namespace nspector.Common
|
||||
return result.OrderBy(x => x.SettingText).ThenBy(x => x.GroupName).ToList();
|
||||
}
|
||||
|
||||
public async Task<List<SettingItem>> GetSettingsForProfileAsync(string profileName, SettingViewMode viewMode)
|
||||
{
|
||||
var result = default(List<SettingItem>);
|
||||
|
||||
await Task.Run(() =>
|
||||
{
|
||||
var applications = default(Dictionary<string, string>);
|
||||
result = GetSettingsForProfile(profileName, viewMode, ref applications, true);
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public void AddApplication(string profileName, string applicationName)
|
||||
{
|
||||
DrsSession((hSession) =>
|
||||
|
||||
Reference in new issue
Block a user