updated readme, and slightly improved resilance of window closing, changed relegation of duty for disabling paret window from manager to countdown window.

This commit is contained in:
Kamil118 committed 2026-08-27 22:25:42 +02:00
1 parent a95ec8e22f
commit 1ce52c801d
5 files changed
+12 -13

No files matched your search

+1
View File
@@ -160,6 +160,7 @@
MinimumSize = new Size(500, 135); MinimumSize = new Size(500, 135);
Name = "CountdownForm"; Name = "CountdownForm";
Text = "CountdownForm"; Text = "CountdownForm";
Shown += CountdownForm_Shown;
Resize += onResize; Resize += onResize;
tableLayoutPanel1.ResumeLayout(false); tableLayoutPanel1.ResumeLayout(false);
tableLayoutPanel1.PerformLayout(); tableLayoutPanel1.PerformLayout();
+8 -8
View File
@@ -13,7 +13,7 @@ namespace GoToSleep
{ {
public partial class CountdownForm : Form public partial class CountdownForm : Form
{ {
public bool active = true; public volatile bool active = true;
private PowerDownData task; private PowerDownData task;
private Thread taskThread; private Thread taskThread;
@@ -50,6 +50,7 @@ namespace GoToSleep
trayIcon.Text = task.actionType.ToString() + "\n" + countdown.Text; trayIcon.Text = task.actionType.ToString() + "\n" + countdown.Text;
} }
string getTimerText() string getTimerText()
{ {
var timeRemaining = task.when - DateTime.Now; var timeRemaining = task.when - DateTime.Now;
@@ -116,16 +117,10 @@ namespace GoToSleep
protected override void OnFormClosing(FormClosingEventArgs e) protected override void OnFormClosing(FormClosingEventArgs e)
{ {
if (e.CloseReason == CloseReason.None && this.Visible == false)
{
// the window has been minimzed to tray, do not destroy it
e.Cancel = true;
return;
}
parent.Enabled = true; parent.Enabled = true;
trayIcon.Visible = false; trayIcon.Visible = false;
base.OnFormClosing(e);
active = false; active = false;
base.OnFormClosing(e);
} }
private void countdown_Click(object sender, EventArgs e) private void countdown_Click(object sender, EventArgs e)
@@ -175,5 +170,10 @@ namespace GoToSleep
trayIcon.Visible = false; trayIcon.Visible = false;
cancel_Click(sender, e); cancel_Click(sender, e);
} }
private void CountdownForm_Shown(object sender, EventArgs e)
{
parent.Enabled = false;
}
} }
} }
-4
View File
@@ -143,7 +143,6 @@ namespace GoToSleep
progressPopup = new CountdownForm(PowerDownData.Shutdown(target), parentForm); progressPopup = new CountdownForm(PowerDownData.Shutdown(target), parentForm);
progressPopup.Show(); progressPopup.Show();
parentForm.Enabled = false;
} }
public void suspend(string timeString) public void suspend(string timeString)
@@ -165,7 +164,6 @@ namespace GoToSleep
progressPopup = new CountdownForm(PowerDownData.Suspend(target), parentForm); progressPopup = new CountdownForm(PowerDownData.Suspend(target), parentForm);
progressPopup.Show(); progressPopup.Show();
parentForm.Enabled = false;
} }
public void hibernate(string timeString) public void hibernate(string timeString)
@@ -187,7 +185,6 @@ namespace GoToSleep
progressPopup = new CountdownForm(PowerDownData.Hibernate(target), parentForm); progressPopup = new CountdownForm(PowerDownData.Hibernate(target), parentForm);
progressPopup.Show(); progressPopup.Show();
parentForm.Enabled = false;
} }
public void restart(string timeString) public void restart(string timeString)
@@ -209,7 +206,6 @@ namespace GoToSleep
progressPopup = new CountdownForm(PowerDownData.Restart(target), parentForm); progressPopup = new CountdownForm(PowerDownData.Restart(target), parentForm);
progressPopup.Show(); progressPopup.Show();
parentForm.Enabled = false;
} }
} }
} }
+3 -1
View File
@@ -1,9 +1,11 @@
# GoToSleep # GoToSleep
![Screenshot of working application](./img/program.png)
Simple utility to schedule automatic system suspension/shutdown using natural language Simple utility to schedule automatic system suspension/shutdown using natural language
Utilizes Microsoft.Recognizers.Text to process the natural text input and generate user-friendly countdown popup. Utilizes Microsoft.Recognizers.Text to process the natural text input and generate user-friendly countdown popup.
* [Download Latest x64 Standalone Release (50 MB)](https://github.com/Kamil118/GoToSleep/releases/latest/download/GoToSleep-x64_STANDALONE.exe) (Probably what you are looking for) * [Download Latest x64 Standalone Release (50 MB)](https://github.com/Kamil118/GoToSleep/releases/latest/download/GoToSleep-x64_STANDALONE.exe) (Probably what you are looking for)
* [Download Latest x64 trimmed release (4.5 MB)](https://github.com/Kamil118/GoToSleep/releases/latest/download/GoToSleep-x64_dotnet.exe) (Requires .NET 10 runtime installed) * [Download Latest x64 trimmed release (4.5 MB)](https://github.com/Kamil118/GoToSleep/releases/download/v1.0.9/GoToSleep-x64-dotnet.exe) (Requires .NET 10 runtime installed)
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB