mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 03:48:56 +00:00
Auto-update - Don't check for updates until after core init finished
Tray - Attempt to more reliably hide icon on application close Auto-run - Implemented dropping of permissions
This commit is contained in:
1 parent
097a5275e2
commit
ca7af1d142
12 files changed
+150
-54
No files matched your search
@@ -39,9 +39,30 @@
|
||||
<TextBlock>Stay on top</TextBlock>
|
||||
</StackPanel>
|
||||
</Button>
|
||||
<Button Content="Force garbage collection" Command="{s:Action ForceGarbageCollection}" />
|
||||
<Button Content="Elevate permissions" Command="{s:Action Elevate}" />
|
||||
<Button Content="Restart" Command="{s:Action Restart}" />
|
||||
<Button Command="{s:Action ForceGarbageCollection}">
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch">
|
||||
<materialDesign:PackIcon Kind="DeleteEmpty"/>
|
||||
<TextBlock Margin="10 0">Force garbage collection</TextBlock>
|
||||
</StackPanel>
|
||||
</Button>
|
||||
<Button Command="{s:Action Elevate}">
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch">
|
||||
<materialDesign:PackIcon Kind="ShieldHalfFull" />
|
||||
<TextBlock Margin="10 0">Elevate permissions</TextBlock>
|
||||
</StackPanel>
|
||||
</Button>
|
||||
<Button Command="{s:Action Drop}">
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch">
|
||||
<materialDesign:PackIcon Kind="ChevronDoubleDown" />
|
||||
<TextBlock Margin="10 0">Drop permissions</TextBlock>
|
||||
</StackPanel>
|
||||
</Button>
|
||||
<Button Command="{s:Action Restart}">
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch">
|
||||
<materialDesign:PackIcon Kind="Restart" />
|
||||
<TextBlock Margin="10 0">Restart</TextBlock>
|
||||
</StackPanel>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</materialDesign:PopupBox>
|
||||
</mde:AppBar>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Artemis.Core;
|
||||
using Artemis.Core.Services;
|
||||
using Artemis.UI.Screens.Settings.Debug.Tabs;
|
||||
@@ -29,6 +30,8 @@ namespace Artemis.UI.Screens.Settings.Debug
|
||||
public PluginSetting<bool> StayOnTopSetting { get; }
|
||||
|
||||
public string Title => "Debugger";
|
||||
public bool CanElevate => !_coreService.IsElevated;
|
||||
public bool CanDrop => _coreService.IsElevated;
|
||||
|
||||
public void ToggleStayOnTop()
|
||||
{
|
||||
@@ -50,7 +53,12 @@ namespace Artemis.UI.Screens.Settings.Debug
|
||||
|
||||
public void Elevate()
|
||||
{
|
||||
Core.Utilities.Restart(true, TimeSpan.FromMilliseconds(500));
|
||||
Core.Utilities.Restart(true, TimeSpan.FromMilliseconds(500), "--force-elevation");
|
||||
}
|
||||
|
||||
public void Drop()
|
||||
{
|
||||
Core.Utilities.Restart(false, TimeSpan.Zero);
|
||||
}
|
||||
|
||||
public void Restart()
|
||||
|
||||
@@ -46,6 +46,9 @@ namespace Artemis.UI.Screens
|
||||
_debugService = debugService;
|
||||
CanShowRootViewModel = true;
|
||||
|
||||
Core.Utilities.ShutdownRequested += UtilitiesOnShutdownRequested;
|
||||
Core.Utilities.RestartRequested += UtilitiesOnShutdownRequested;
|
||||
|
||||
windowService.ConfigureMainWindowProvider(this);
|
||||
messageService.ConfigureNotificationProvider(this);
|
||||
bool autoRunning = Bootstrapper.StartupArguments.Contains("--autorun");
|
||||
@@ -56,7 +59,9 @@ namespace Artemis.UI.Screens
|
||||
coreService.Initialized += (_, _) => TrayBringToForeground();
|
||||
}
|
||||
else
|
||||
updateService.AutoUpdate();
|
||||
{
|
||||
coreService.Initialized += (_, _) => updateService.AutoUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
public bool CanShowRootViewModel
|
||||
@@ -111,12 +116,14 @@ namespace Artemis.UI.Screens
|
||||
public void OnTrayBalloonTipClicked(object sender, EventArgs e)
|
||||
{
|
||||
if (CanShowRootViewModel)
|
||||
{
|
||||
TrayBringToForeground();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Wrestle the main window to the front
|
||||
Window mainWindow = ((Window) _rootViewModel.View);
|
||||
if (mainWindow.WindowState == WindowState.Minimized)
|
||||
Window mainWindow = (Window) _rootViewModel.View;
|
||||
if (mainWindow.WindowState == WindowState.Minimized)
|
||||
mainWindow.WindowState = WindowState.Normal;
|
||||
mainWindow.Activate();
|
||||
mainWindow.Topmost = true;
|
||||
@@ -125,6 +132,11 @@ namespace Artemis.UI.Screens
|
||||
}
|
||||
}
|
||||
|
||||
private void UtilitiesOnShutdownRequested(object? sender, EventArgs e)
|
||||
{
|
||||
Execute.OnUIThread(() => _taskBarIcon?.Dispose());
|
||||
}
|
||||
|
||||
private void ShowSplashScreen()
|
||||
{
|
||||
Execute.OnUIThread(() =>
|
||||
@@ -156,7 +168,7 @@ namespace Artemis.UI.Screens
|
||||
|
||||
PackIcon packIcon = new() {Kind = icon};
|
||||
Geometry geometry = Geometry.Parse(packIcon.Data);
|
||||
|
||||
|
||||
// Scale the icon up to fit a 256x256 image and draw it
|
||||
geometry = Geometry.Combine(geometry, Geometry.Empty, GeometryCombineMode.Union, new ScaleTransform(256 / geometry.Bounds.Right, 256 / geometry.Bounds.Bottom));
|
||||
drawingContext.DrawGeometry(new SolidColorBrush(Colors.White), null, geometry);
|
||||
|
||||
Reference in new issue
Block a user