Exemple #1
0
        public void StartWatch()
        {
            WindowsReStyle();

            if (!UiFoundProcess)
            {
                MessageBox.Show("Could not find the process " + ConfigData.ProcessName,
                                "Windows Frameless Terminal", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            WindowPointer = CoreWindow.FindWindow(ConfigData.ProcessName, null);

            CoreWindow.GetWindowRect(WindowPointer, out CurrentWindowRectangle);

            CoreWindow.SetWindowPos(WindowPointer, 0, CurrentWindowRectangle.X, CurrentWindowRectangle.Y,
                                    CurrentWindowRectangle.Width, CurrentWindowRectangle.Height - 1, 0);

            if (windowManagerThread.IsAlive)
            {
                windowManagerThread.Abort();
            }

            if (WindowPointer != IntPtr.Zero)
            {
                windowManagerThread.Start();
            }

            StartWatchBtn.Content = "Stop Watch";

            uint processId;

            CoreWindow.GetWindowThreadProcessId(WindowPointer, out processId);
            InfoLbl.Content = "Info: PID: " + Convert.ToString(processId);

            SystemSounds.Beep.Play();
        }