示例#1
0
        private static void ExitApp()
        {
            FileExplorer.SetOpacity(true);

            Taskbar.SetOpacity(true);

            Process current = Process.GetCurrentProcess();

            foreach (Process process in Process.GetProcessesByName(current.ProcessName))
            {
                try
                {
                    if (process.Id != current.Id)
                    {
                        foreach (ProcessThread processThread in process.Threads)
                        {
                            NativeMethods.CriticalHandle.PostThreadMessage(processThread.Id, NativeMethods.CriticalHandle.WM_QUIT, IntPtr.Zero, IntPtr.Zero);
                        }
                    }
                }
                catch
                {
                    continue;
                }
            }

            Environment.Exit(0);
        }
示例#2
0
        private void Startup()
        {
            Thread _initializeTaskbar = new Thread(() => Taskbar.SetOpacity())
            {
                IsBackground = true
            };

            _initializeTaskbar.Start();

            Thread _initializeExplorer = new Thread(() => FileExplorer.SetOpacity())
            {
                IsBackground = true
            };

            _initializeExplorer.Start();
        }