From 4cf8f369590c1604b183776b1ecd4a3d514b7258 Mon Sep 17 00:00:00 2001 From: Mahdi Hosseini Date: Tue, 24 Dec 2024 15:23:16 +0330 Subject: [PATCH] Update GeneralHelper.cs --- dev/DevWinUI/Helpers/GeneralHelper.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/dev/DevWinUI/Helpers/GeneralHelper.cs b/dev/DevWinUI/Helpers/GeneralHelper.cs index 8b774ab..38275b1 100644 --- a/dev/DevWinUI/Helpers/GeneralHelper.cs +++ b/dev/DevWinUI/Helpers/GeneralHelper.cs @@ -1,10 +1,18 @@ using System.Globalization; +using System.Security.Principal; using System.Web; using Microsoft.UI.Input; namespace DevWinUI; public partial class GeneralHelper { + public static bool IsAppRunningAsAdmin() + { + var identity = WindowsIdentity.GetCurrent(); + var principal = new WindowsPrincipal(identity); + return principal.IsInRole(WindowsBuiltInRole.Administrator); + } + public static void ChangeCursor(UIElement uiElement, InputCursor cursor) { Type type = typeof(UIElement);