Skip to content

Commit da77396

Browse files
committed
Remove some hosts references and fix close button
1 parent 46df486 commit da77396

15 files changed

Lines changed: 46 additions & 78 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

src/modules/ShortcutGuideV2/ShortcutGuide.Ui/Models/ShortcutEntry.cs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,19 @@ public static implicit operator ShortcutTemplateDataObject(ShortcutEntry shortcu
6262

6363
async void AnimateTextBlock(TextBlock animatedTextBlock, string text, int delay = 500)
6464
{
65-
int index = 0;
65+
try
66+
{
67+
int index = 0;
6668

67-
while (true)
69+
while (!ShortcutView.AnimationCancellationTokenSource.Token.IsCancellationRequested)
70+
{
71+
animatedTextBlock.Text = text[index].ToString();
72+
index = (index + 1) % text.Length;
73+
await Task.Delay(delay);
74+
}
75+
}
76+
catch
6877
{
69-
animatedTextBlock.Text = text[index].ToString();
70-
index = (index + 1) % text.Length;
71-
await Task.Delay(delay);
7278
}
7379
}
7480

@@ -254,7 +260,7 @@ void AddNewTextToStackPanel(string text)
254260
async void AnimateStackPanels(StackPanel[] panels, int delay = 2000)
255261
{
256262
int index = 0;
257-
while (true)
263+
while (!ShortcutView.AnimationCancellationTokenSource.Token.IsCancellationRequested)
258264
{
259265
foreach (StackPanel panel in panels)
260266
{

src/modules/ShortcutGuideV2/ShortcutGuide.Ui/Package.appxmanifest

Lines changed: 0 additions & 51 deletions
This file was deleted.

src/modules/ShortcutGuideV2/ShortcutGuide.Ui/Program.cs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using System.Threading;
99
using ManagedCommon;
1010
using Microsoft.UI.Dispatching;
11+
using Microsoft.UI.Xaml;
1112
using Microsoft.Windows.AppLifecycle;
1213
using ShortcutGuide.Helpers;
1314

@@ -25,6 +26,12 @@ public sealed class Program
2526
[STAThread]
2627
public static void Main()
2728
{
29+
if (PowerToys.GPOWrapper.GPOWrapper.GetConfiguredShortcutGuideEnabledValue() == PowerToys.GPOWrapper.GpoRuleConfigured.Disabled)
30+
{
31+
Logger.LogWarning("Tried to start with a GPO policy setting the utility to always be disabled. Please contact your systems administrator.");
32+
return;
33+
}
34+
2835
if (!Directory.Exists(ManifestInterpreter.GetPathOfIntepretations()))
2936
{
3037
Directory.CreateDirectory(ManifestInterpreter.GetPathOfIntepretations());
@@ -43,17 +50,11 @@ public static void Main()
4350
Logger.InitializeLogger("\\ShortcutGuide\\Logs");
4451
WinRT.ComWrappersSupport.InitializeComWrappers();
4552

46-
if (PowerToys.GPOWrapper.GPOWrapper.GetConfiguredShortcutGuideEnabledValue() == PowerToys.GPOWrapper.GpoRuleConfigured.Disabled)
47-
{
48-
Logger.LogWarning("Tried to start with a GPO policy setting the utility to always be disabled. Please contact your systems administrator.");
49-
return;
50-
}
51-
5253
var instanceKey = AppInstance.FindOrRegisterForKey("PowerToys_ShortcutGuide_Instance");
5354

5455
if (instanceKey.IsCurrent)
5556
{
56-
Microsoft.UI.Xaml.Application.Start((p) =>
57+
Application.Start((p) =>
5758
{
5859
var context = new DispatcherQueueSynchronizationContext(DispatcherQueue.GetForCurrentThread());
5960
SynchronizationContext.SetSynchronizationContext(context);
@@ -65,6 +66,9 @@ public static void Main()
6566
Logger.LogWarning("Another instance of ShortcutGuide is running. Exiting ShortcutGuide");
6667
}
6768

69+
// Something prevents the process from exiting, so we need to kill it manually.
70+
Process.GetCurrentProcess().Kill();
71+
6872
return;
6973
}
7074
}

0 commit comments

Comments
 (0)