Example #1
0
        protected override void OnStartup(StartupEventArgs e)
        {
            _mutex = new Mutex(true, "Argon", out bool createdNew);

            if (createdNew)
            {
                base.OnStartup(e);
            }
            else
            {
                PInvokes.PostMessage(
                    (IntPtr)PInvokes.HWND_BROADCAST,
                    PInvokes.WM_SHOWME,
                    IntPtr.Zero,
                    IntPtr.Zero);
                Current.Shutdown(); //app is already running! exit the application
            }
        }
Example #2
0
        public static bool ResumeProcess(int PID)
        {
            bool success = false;

            Application.Current.Dispatcher.BeginInvoke(new Action(() =>
            {
                try {
                    success = PInvokes.DebugActiveProcessStop(Convert.ToUInt32(PID));
                    if (success)
                    {
                        SuspendedProcessList.RemoveAll(x => x.ID == PID);
                        ((MainWindow)Application.Current.MainWindow).SuspendedProcesses.UpdateViewSource();
                    }
                }
                catch { }
            })).Wait();

            return(success);
        }
Example #3
0
        public static bool SuspendProcess(int PID)
        {
            if (ProcessDataList.First(x => x.ID == PID).IsProtected)
            {
                return(false);
            }

            bool success = false;

            Application.Current.Dispatcher.BeginInvoke(new Action(() =>
            {
                try {
                    success = PInvokes.DebugActiveProcess(Convert.ToUInt32(PID));
                    if (success)
                    {
                        SuspendedProcessList.Add(ProcessDataList.First(x => x.ID == PID));
                        ((MainWindow)Application.Current.MainWindow).SuspendedProcesses.UpdateViewSource();
                    }
                }
                catch { }
            })).Wait();

            return(success);
        }