예제 #1
0
파일: App.xaml.cs 프로젝트: exct/Argon
        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
            }
        }
예제 #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);
        }
예제 #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);
        }