[Awake]Refactor and update version - DAISY023_04102024 (#32378)

Improves the following:

- Consolidates different code paths for easier maintenance.
- Removes the dependency on Windows Forms and creates the system tray
icon and handling through native Win32 APIs (massive thank you to
@BrianPeek for helping write the window creation logic and diagnosing
threading issues).
- Changing modes in Awake now triggers icon changes in the tray
(#11996). Massive thank you to @niels9001 for creating the icons.

Fixes the following:

- When in the UI and you select `0` as hours and `0` as minutes in
`TIMED` awake mode, the UI becomes non-responsive whenever you try to
get back to timed after it rolls back to `PASSIVE`. (#33630)
- Adds the option to keep track of Awake state through tray tooltip.
(#12714)

---------

Co-authored-by: Clint Rutkas <clint@rutkas.com>
Co-authored-by: Jaime Bernardo <jaime@janeasystems.com>
This commit is contained in:
Den Delimarsky
2024-07-25 09:09:17 -07:00
committed by GitHub
parent 63625a1cee
commit 1be3b6c087
35 changed files with 1054 additions and 640 deletions

View File

@@ -60,24 +60,6 @@ namespace Awake.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to 1 hour.
/// </summary>
internal static string AWAKE_1_HOUR {
get {
return ResourceManager.GetString("AWAKE_1_HOUR", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to 1 minute.
/// </summary>
internal static string AWAKE_1_MINUTE {
get {
return ResourceManager.GetString("AWAKE_1_MINUTE", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Checked.
/// </summary>
@@ -87,6 +69,51 @@ namespace Awake.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to Specifies whether Awake will be using the PowerToys configuration file for managing the state..
/// </summary>
internal static string AWAKE_CMD_HELP_CONFIG_OPTION {
get {
return ResourceManager.GetString("AWAKE_CMD_HELP_CONFIG_OPTION", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Determines whether the display should be kept awake..
/// </summary>
internal static string AWAKE_CMD_HELP_DISPLAY_OPTION {
get {
return ResourceManager.GetString("AWAKE_CMD_HELP_DISPLAY_OPTION", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Determines the end date and time when Awake will back off and let the system manage the current sleep and display state..
/// </summary>
internal static string AWAKE_CMD_HELP_EXPIRE_AT_OPTION {
get {
return ResourceManager.GetString("AWAKE_CMD_HELP_EXPIRE_AT_OPTION", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Bind the execution of Awake to another process. When the process ends, the system will resume managing the current sleep and display state..
/// </summary>
internal static string AWAKE_CMD_HELP_PID_OPTION {
get {
return ResourceManager.GetString("AWAKE_CMD_HELP_PID_OPTION", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Determines the interval (in seconds) during which the computer is kept awake..
/// </summary>
internal static string AWAKE_CMD_HELP_TIME_OPTION {
get {
return ResourceManager.GetString("AWAKE_CMD_HELP_TIME_OPTION", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Exit.
/// </summary>
@@ -96,6 +123,33 @@ namespace Awake.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to Terminating from process binding hook..
/// </summary>
internal static string AWAKE_EXIT_BINDING_HOOK_MESSAGE {
get {
return ResourceManager.GetString("AWAKE_EXIT_BINDING_HOOK_MESSAGE", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Exiting from the internal termination handler..
/// </summary>
internal static string AWAKE_EXIT_MESSAGE {
get {
return ResourceManager.GetString("AWAKE_EXIT_MESSAGE", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Received a signal to end the process. Making sure we quit....
/// </summary>
internal static string AWAKE_EXIT_SIGNAL_MESSAGE {
get {
return ResourceManager.GetString("AWAKE_EXIT_SIGNAL_MESSAGE", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to {0} hours.
/// </summary>
@@ -159,6 +213,42 @@ namespace Awake.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to Expiring.
/// </summary>
internal static string AWAKE_TRAY_TEXT_EXPIRATION {
get {
return ResourceManager.GetString("AWAKE_TRAY_TEXT_EXPIRATION", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Indefinite.
/// </summary>
internal static string AWAKE_TRAY_TEXT_INDEFINITE {
get {
return ResourceManager.GetString("AWAKE_TRAY_TEXT_INDEFINITE", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Passive.
/// </summary>
internal static string AWAKE_TRAY_TEXT_OFF {
get {
return ResourceManager.GetString("AWAKE_TRAY_TEXT_OFF", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Timed.
/// </summary>
internal static string AWAKE_TRAY_TEXT_TIMED {
get {
return ResourceManager.GetString("AWAKE_TRAY_TEXT_TIMED", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Unchecked.
/// </summary>

View File

@@ -123,9 +123,6 @@
<data name="AWAKE_EXIT" xml:space="preserve">
<value>Exit</value>
</data>
<data name="AWAKE_1_HOUR" xml:space="preserve">
<value>1 hour</value>
</data>
<data name="AWAKE_HOURS" xml:space="preserve">
<value>{0} hours</value>
<comment>{0} shouldn't be removed. It will be replaced by a number greater than 1 at runtime by the application. Used for defining a period to keep the PC awake.</comment>
@@ -145,9 +142,6 @@
<value>Keep awake until expiration date and time</value>
<comment>Keep the system awake until expiration date and time</comment>
</data>
<data name="AWAKE_1_MINUTE" xml:space="preserve">
<value>1 minute</value>
</data>
<data name="AWAKE_MINUTES" xml:space="preserve">
<value>{0} minutes</value>
<comment>{0} shouldn't be removed. It will be replaced by a number greater than 1 at runtime by the application. Used for defining a period to keep the PC awake.</comment>
@@ -159,4 +153,40 @@
<data name="AWAKE_UNCHECKED" xml:space="preserve">
<value>Unchecked</value>
</data>
<data name="AWAKE_CMD_HELP_CONFIG_OPTION" xml:space="preserve">
<value>Specifies whether Awake will be using the PowerToys configuration file for managing the state.</value>
</data>
<data name="AWAKE_CMD_HELP_DISPLAY_OPTION" xml:space="preserve">
<value>Determines whether the display should be kept awake.</value>
</data>
<data name="AWAKE_CMD_HELP_EXPIRE_AT_OPTION" xml:space="preserve">
<value>Determines the end date and time when Awake will back off and let the system manage the current sleep and display state.</value>
</data>
<data name="AWAKE_CMD_HELP_PID_OPTION" xml:space="preserve">
<value>Bind the execution of Awake to another process. When the process ends, the system will resume managing the current sleep and display state.</value>
</data>
<data name="AWAKE_CMD_HELP_TIME_OPTION" xml:space="preserve">
<value>Determines the interval (in seconds) during which the computer is kept awake.</value>
</data>
<data name="AWAKE_EXIT_BINDING_HOOK_MESSAGE" xml:space="preserve">
<value>Terminating from process binding hook.</value>
</data>
<data name="AWAKE_EXIT_MESSAGE" xml:space="preserve">
<value>Exiting from the internal termination handler.</value>
</data>
<data name="AWAKE_EXIT_SIGNAL_MESSAGE" xml:space="preserve">
<value>Received a signal to end the process. Making sure we quit...</value>
</data>
<data name="AWAKE_TRAY_TEXT_EXPIRATION" xml:space="preserve">
<value>Expiring</value>
</data>
<data name="AWAKE_TRAY_TEXT_INDEFINITE" xml:space="preserve">
<value>Indefinite</value>
</data>
<data name="AWAKE_TRAY_TEXT_OFF" xml:space="preserve">
<value>Passive</value>
</data>
<data name="AWAKE_TRAY_TEXT_TIMED" xml:space="preserve">
<value>Timed</value>
</data>
</root>