Skip to content

Commit ff4a8dd

Browse files
fix: App showing "already running" when app is running on different user
1 parent 87c60c8 commit ff4a8dd

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

DigitalWellbeingWPF/App.xaml.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,11 @@ private void CheckAndShowCurrentApp()
3737
{
3838
Process thisProcess = Process.GetCurrentProcess();
3939

40-
IEnumerable<Process> similarAppProcesses = Process.GetProcesses().Where(p => p.ProcessName == thisProcess.ProcessName);
40+
IEnumerable<Process> similarAppProcesses = Process.GetProcesses().Where(
41+
p => p.ProcessName == thisProcess.ProcessName && p.SessionId == thisProcess.SessionId);
4142

4243
if (similarAppProcesses.Count() > 1)
4344
{
44-
//ShowMessage_AlreadyRunning();
45-
4645
try
4746
{
4847
IntPtr existingProcessHWnd = similarAppProcesses.Single(p => thisProcess.Id != p.Id).MainWindowHandle;

0 commit comments

Comments
 (0)