Clickable help and other changes

This commit is contained in:
Kamil Trzciński 2022-11-12 13:56:15 +01:00
parent d56d123e61
commit 52d68d4b7f
6 changed files with 24 additions and 105 deletions

View file

@ -8,7 +8,7 @@
<UseWindowsForms>True</UseWindowsForms>
<StartupObject>FanControl.Program</StartupObject>
<ApplicationManifest>app.manifest</ApplicationManifest>
<AssemblyVersion>0.1.0</AssemblyVersion>
<Version>0.1.0</Version>
</PropertyGroup>
<ItemGroup>

View file

@ -46,7 +46,7 @@
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.sensorWarningLabel = new System.Windows.Forms.Label();
this.propertyGrid1 = new System.Windows.Forms.PropertyGrid();
this.label1 = new System.Windows.Forms.Label();
this.helpLabel = new System.Windows.Forms.Label();
this.contextMenu.SuspendLayout();
this.menuStrip1.SuspendLayout();
this.tableLayoutPanel1.SuspendLayout();
@ -160,7 +160,7 @@
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.Controls.Add(this.sensorWarningLabel, 0, 1);
this.tableLayoutPanel1.Controls.Add(this.propertyGrid1, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.label1, 0, 2);
this.tableLayoutPanel1.Controls.Add(this.helpLabel, 0, 2);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 44);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
@ -198,20 +198,21 @@
this.propertyGrid1.TabIndex = 1;
this.propertyGrid1.ToolbarVisible = false;
//
// label1
// helpLabel
//
this.label1.AutoSize = true;
this.label1.Dock = System.Windows.Forms.DockStyle.Fill;
this.label1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.label1.Font = new System.Drawing.Font("Segoe UI", 9F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Underline))), System.Drawing.GraphicsUnit.Point);
this.label1.ForeColor = System.Drawing.SystemColors.HotTrack;
this.label1.Location = new System.Drawing.Point(3, 853);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(706, 32);
this.label1.TabIndex = 7;
this.label1.Text = "https://github.com/ayufan-research/SteamDeckTools";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.label1.DoubleClick += new System.EventHandler(this.label1_DoubleClick);
this.helpLabel.AutoSize = true;
this.helpLabel.Cursor = System.Windows.Forms.Cursors.Hand;
this.helpLabel.Dock = System.Windows.Forms.DockStyle.Fill;
this.helpLabel.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.helpLabel.Font = new System.Drawing.Font("Segoe UI", 9F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Underline))), System.Drawing.GraphicsUnit.Point);
this.helpLabel.ForeColor = System.Drawing.SystemColors.HotTrack;
this.helpLabel.Location = new System.Drawing.Point(3, 853);
this.helpLabel.Name = "helpLabel";
this.helpLabel.Size = new System.Drawing.Size(706, 32);
this.helpLabel.TabIndex = 7;
this.helpLabel.Text = "https://github.com/ayufan-research/SteamDeckTools";
this.helpLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.helpLabel.DoubleClick += new System.EventHandler(this.help_DoubleClick);
//
// FanControlForm
//
@ -258,6 +259,6 @@
private PropertyGrid propertyGrid1;
private ToolStripMenuItem toolStripMenuItemStartupOnBoot;
private ToolStripSeparator toolStripSeparator2;
private Label label1;
private Label helpLabel;
}
}

View file

@ -72,13 +72,14 @@ namespace FanControl
if (e.CloseReason == CloseReason.UserClosing && Visible)
{
e.Cancel = true;
WindowState = FormWindowState.Minimized;
Hide();
}
}
private void formShow_Event(object sender, EventArgs e)
{
WindowState = FormWindowState.Normal;
Show();
propertyGrid1.Refresh();
}
@ -117,9 +118,9 @@ namespace FanControl
toolStripMenuItemStartupOnBoot.Checked = startupManager.Startup;
}
private void label1_DoubleClick(object sender, EventArgs e)
private void help_DoubleClick(object sender, EventArgs e)
{
System.Diagnostics.Process.Start("http://github.com/ayufan-research/SteamDeckTools");
System.Diagnostics.Process.Start("explorer.exe", "http://github.com/ayufan-research/SteamDeckTools");
}
}
}

View file

@ -206,11 +206,6 @@ namespace FanControl
return value;
}
public override string ToString()
{
return Name;
}
public ushort? CalculateRPM(FanController.FanMode mode)
{
if (!Profiles.ContainsKey(mode) || !Value.HasValue)

View file

@ -9,87 +9,9 @@ namespace FanControl
{
internal class Program
{
public class UpdateVisitor : IVisitor
{
public void VisitComputer(IComputer computer)
{
computer.Traverse(this);
}
public void VisitHardware(IHardware hardware)
{
hardware.Update();
foreach (IHardware subHardware in hardware.SubHardware) subHardware.Accept(this);
}
public void VisitSensor(ISensor sensor) { }
public void VisitParameter(IParameter parameter) { }
}
public static void Monitor()
{
Computer computer = new Computer
{
IsCpuEnabled = true,
IsGpuEnabled = true,
IsMemoryEnabled = true,
IsMotherboardEnabled = true,
IsControllerEnabled = true,
IsNetworkEnabled = true,
IsStorageEnabled = true,
IsPsuEnabled = true,
IsBatteryEnabled = true
};
computer.Open();
//computer.Accept(new UpdateVisitor());
foreach (IHardware hardware in computer.Hardware)
{
Console.WriteLine("Hardware: {0}. Type: {1}", hardware.Name, hardware.HardwareType);
foreach (IHardware subhardware in hardware.SubHardware)
{
Console.WriteLine("\tSubhardware: {0}", subhardware.Name);
foreach (ISensor sensor in subhardware.Sensors)
{
Console.WriteLine("\t\tSensor: {0}, value: {1}, type: {2}", sensor.Name, sensor.Value, sensor.SensorType);
}
}
foreach (ISensor sensor in hardware.Sensors)
{
Console.WriteLine("\tSensor: {0}, value: {1}, type: {2}", sensor.Name, sensor.Value, sensor.SensorType);
}
}
computer.Close();
}
static void ConsoleMain(string[] args)
{
Monitor();
while (true)
{
Thread.Sleep(300);
Vlv0100.SetFanControl(false);
Vlv0100.SetFanDesiredRPM(6000);
Console.WriteLine("Fan RPM: {0}", Vlv0100.GetFanRPM());
Console.WriteLine("Fan Desired RPM: {0}", Vlv0100.GetFanDesiredRPM());
}
}
static void Main(string[] args)
{
if (Environment.UserInteractive && !Console.IsInputRedirected)
{
ConsoleMain(args);
}
else
{
Application.Run(new FanControlForm());
}
Application.Run(new FanControlForm());
}
}
}

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
<assemblyIdentity version="0.1.0.0" name="FanControl.app"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">