Awake vNext - NOBLE_SIX_02162023 (#24183)

* Initial scaffolding for expiration configuration

* Simplifying the code and adding support for expiration events

* Bit more cleanup

* Initial support for expirable keep-awake

* Update some of the threading logic

* Logging and timing consistency

* Initial UI scaffolding

* Fix pathing issue for the icon when using config file

* Add missing definitions

* Update with basic interface

* Cleanup redundant calls

* Update name per convention

* Simplify declaration

* Proper binding to secondary Time property

* Cleanup the terminology use

* Standardize naming conventions.

* More Awake cleanup

* Ability to update the UI when the tray icon updates

* Small tweaks before ViewModel refactor

* Refactor the view model logic

* Some consistency fixes

* Remove the build props change

* Add settings scaffolding when a file does not exist

* Update expect.txt

* Fix typos

* Update build in logs

* Updating based on discussion in #24183.
This specifically addresses the fact that the `ExpirationDateTime` property was incorrectly auto-initialized to `DateTime.MinValue` when it should've been set to `DateTimeOffset.MinValue` to be consistent with the underlying type and assumptions around date/time.

---------

Co-authored-by: Clint Rutkas <clint@rutkas.com>
This commit is contained in:
Den
2023-03-15 01:42:47 -07:00
committed by GitHub
parent 13cb52763d
commit 466252745d
20 changed files with 664 additions and 323 deletions

View File

@@ -2,6 +2,7 @@
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Text.Json.Serialization;
@@ -13,25 +14,29 @@ namespace Microsoft.PowerToys.Settings.UI.Library
{
KeepDisplayOn = false;
Mode = AwakeMode.PASSIVE;
Hours = 0;
Minutes = 0;
TrayTimeShortcuts = new Dictionary<string, int>();
IntervalHours = 0;
IntervalMinutes = 0;
ExpirationDateTime = DateTimeOffset.MinValue;
CustomTrayTimes = new Dictionary<string, int>();
}
[JsonPropertyName("awake_keep_display_on")]
[JsonPropertyName("keepDisplayOn")]
public bool KeepDisplayOn { get; set; }
[JsonPropertyName("awake_mode")]
[JsonPropertyName("mode")]
public AwakeMode Mode { get; set; }
[JsonPropertyName("awake_hours")]
public uint Hours { get; set; }
[JsonPropertyName("intervalHours")]
public uint IntervalHours { get; set; }
[JsonPropertyName("awake_minutes")]
public uint Minutes { get; set; }
[JsonPropertyName("intervalMinutes")]
public uint IntervalMinutes { get; set; }
[JsonPropertyName("tray_times")]
public Dictionary<string, int> TrayTimeShortcuts { get; set; }
[JsonPropertyName("expirationDateTime")]
public DateTimeOffset ExpirationDateTime { get; set; }
[JsonPropertyName("customTrayTimes")]
public Dictionary<string, int> CustomTrayTimes { get; set; }
}
public enum AwakeMode
@@ -39,5 +44,6 @@ namespace Microsoft.PowerToys.Settings.UI.Library
PASSIVE = 0,
INDEFINITE = 1,
TIMED = 2,
EXPIRABLE = 3,
}
}