Browse Source

add start menu success notifications and progress

pull/55/head
Ionite 1 year ago
parent
commit
19568f1824
No known key found for this signature in database
  1. 1
      StabilityMatrix.Avalonia/Helpers/WindowsElevated.cs
  2. 7
      StabilityMatrix.Avalonia/ViewModels/SettingsViewModel.cs
  3. 40
      StabilityMatrix.Avalonia/Views/SettingsPage.axaml

1
StabilityMatrix.Avalonia/Helpers/WindowsElevated.cs

@ -21,6 +21,7 @@ public static class WindowsElevated
process.StartInfo.FileName = "cmd.exe";
process.StartInfo.Arguments = $"/c {args}";
process.StartInfo.UseShellExecute = true;
process.StartInfo.CreateNoWindow = true;
process.StartInfo.Verb = "runas";
process.Start();

7
StabilityMatrix.Avalonia/ViewModels/SettingsViewModel.cs

@ -167,6 +167,9 @@ public partial class SettingsViewModel : PageViewModelBase
WindowsShortcuts.CreateShortcut(
shortcutLink, appPath, iconPath, "Stability Matrix");
notificationService.Show("Added to Start Menu",
"Stability Matrix has been added to the Start Menu.", NotificationType.Success);
}
/// <summary>
@ -233,7 +236,11 @@ public partial class SettingsViewModel : PageViewModelBase
// We'll get this exception if user cancels UAC
Logger.Warn(e, "Could not create shortcut");
notificationService.Show("Could not create shortcut", "", NotificationType.Warning);
return;
}
notificationService.Show("Added to Start Menu",
"Stability Matrix has been added to the Start Menu for all users.", NotificationType.Success);
}
#endregion

40
StabilityMatrix.Avalonia/Views/SettingsPage.axaml

@ -99,19 +99,33 @@
IconSource="StarAdd"
Margin="8">
<ui:SettingsExpander.Footer>
<SplitButton
Command="{Binding AddToStartMenuCommand}"
IsEnabled="{OnPlatform Default=False, Windows=True}"
Content="Add for Current User">
<SplitButton.Flyout>
<ui:FAMenuFlyout Placement="Bottom">
<ui:MenuFlyoutItem
Command="{Binding AddToGlobalStartMenuCommand}"
IconSource="Admin"
Text="Add for All Users"/>
</ui:FAMenuFlyout>
</SplitButton.Flyout>
</SplitButton>
<StackPanel Orientation="Horizontal" Spacing="8">
<controls:ProgressRing
IsIndeterminate="True"
IsEnabled="{Binding IsVisible, RelativeSource={RelativeSource Self}}"
BorderThickness="3">
<controls:ProgressRing.IsVisible>
<MultiBinding Converter="{x:Static BoolConverters.Or}">
<Binding Path="AddToStartMenuCommand.IsRunning"/>
<Binding Path="AddToGlobalStartMenuCommand.IsRunning"/>
</MultiBinding>
</controls:ProgressRing.IsVisible>
</controls:ProgressRing>
<SplitButton
Command="{Binding AddToStartMenuCommand}"
IsEnabled="{OnPlatform Default=False, Windows=True}"
Content="Add for Current User">
<SplitButton.Flyout>
<ui:FAMenuFlyout Placement="Bottom">
<ui:MenuFlyoutItem
Command="{Binding AddToGlobalStartMenuCommand}"
IconSource="Admin"
Text="Add for All Users"/>
</ui:FAMenuFlyout>
</SplitButton.Flyout>
</SplitButton>
</StackPanel>
</ui:SettingsExpander.Footer>
</ui:SettingsExpander>
</Grid>

Loading…
Cancel
Save