Better startup sequence

This commit is contained in:
Kamil Trzciński 2022-11-11 20:01:44 +01:00
parent b8333064e2
commit d073ab0ff6
3 changed files with 35 additions and 24 deletions

View file

@ -30,8 +30,8 @@
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FanControlForm));
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);
this.updateTimer = new System.Windows.Forms.Timer(this.components);
this.notifyIcon = new System.Windows.Forms.NotifyIcon(this.components);
this.contextMenu = new System.Windows.Forms.ContextMenuStrip(this.components);
this.fanModeSelectNotifyMenu = new System.Windows.Forms.ToolStripComboBox();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
@ -45,21 +45,21 @@
this.menuStrip1.SuspendLayout();
this.SuspendLayout();
//
// timer1
// updateTimer
//
this.timer1.Enabled = true;
this.timer1.Interval = 200;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
this.updateTimer.Enabled = true;
this.updateTimer.Interval = 250;
this.updateTimer.Tick += new System.EventHandler(this.updateTimer_Tick);
//
// notifyIcon1
// notifyIcon
//
this.notifyIcon1.BalloonTipIcon = System.Windows.Forms.ToolTipIcon.Info;
this.notifyIcon1.BalloonTipText = "Test";
this.notifyIcon1.ContextMenuStrip = this.contextMenu;
this.notifyIcon1.Icon = ((System.Drawing.Icon)(resources.GetObject("notifyIcon1.Icon")));
this.notifyIcon1.Text = "notifyIcon1";
this.notifyIcon1.Visible = true;
this.notifyIcon1.DoubleClick += new System.EventHandler(this.formShow_Event);
this.notifyIcon.BalloonTipIcon = System.Windows.Forms.ToolTipIcon.Info;
this.notifyIcon.BalloonTipText = "Test";
this.notifyIcon.ContextMenuStrip = this.contextMenu;
this.notifyIcon.Icon = ((System.Drawing.Icon)(resources.GetObject("notifyIcon.Icon")));
this.notifyIcon.Text = "Steam Deck Fan Control";
this.notifyIcon.Visible = true;
this.notifyIcon.DoubleClick += new System.EventHandler(this.formShow_Event);
//
// contextMenu
//
@ -148,7 +148,9 @@
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MainMenuStrip = this.menuStrip1;
this.Name = "FanControlForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Steam Deck Fan Control";
this.WindowState = System.Windows.Forms.FormWindowState.Minimized;
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FanControlForm_FormClosing);
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.FanControlForm_FormClosed);
this.contextMenu.ResumeLayout(false);
@ -161,8 +163,8 @@
#endregion
private System.Windows.Forms.Timer timer1;
private NotifyIcon notifyIcon1;
private System.Windows.Forms.Timer updateTimer;
private NotifyIcon notifyIcon;
private PropertyGrid propertyGrid1;
private ContextMenuStrip contextMenu;
private MenuStrip menuStrip1;

View file

@ -29,12 +29,9 @@ namespace FanControl
}
fanModeSelectMenu.SelectedIndex = 0;
}
fanModeSelectNotifyMenu.SelectedIndex = 0;
private void timer1_Tick(object sender, EventArgs e)
{
fanControl.Update();
propertyGrid1.Refresh();
notifyIcon.ShowBalloonTip(3000, "Steam Deck Fan Control", "Fan Control Started", ToolTipIcon.Info);
}
private void fanModeSelect_SelectedValueChanged(object sender, EventArgs e)
@ -71,5 +68,17 @@ namespace FanControl
// Always revert to default on closing
fanControl.SetMode(FanControl.FanMode.Default);
}
private void updateTimer_Tick(object sender, EventArgs e)
{
fanControl.Update();
if (Visible)
{
propertyGrid1.Refresh();
}
notifyIcon.Text = String.Format("Fan: {0} RPM Mode: {1}", fanControl.CurrentRPM, fanControl.Mode);
}
}
}

View file

@ -57,17 +57,17 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<metadata name="updateTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="notifyIcon1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<metadata name="notifyIcon.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>159, 17</value>
</metadata>
<metadata name="contextMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>353, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="notifyIcon1.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<data name="notifyIcon.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAEAAAAAAAEAIAB5CAAAFgAAAIlQTkcNChoKAAAADUlIRFIAAABAAAAAQAgGAAAAqmlx3gAAAAFz
UkdCAK7OHOkAAAgzSURBVHhe5VtvbFPXFf+9Z2zlOQ8nIRG0E0RJGhQEW0kBW0QiJVoZAy2ZNiSDsvQD