private void Window_Loaded(object sender, RoutedEventArgs e) { _labtool = new Labtool(); try { MemoryAccessor.AttachToProcess(); } catch (Exception exception) { MessageBox.Show($"{exception.Message}"); Application.Current.Shutdown(); return; } Thread t1 = new Thread(refreshInfo); t1.IsBackground = true; t1.Start(); checkbox.IsChecked = true; SetForegroundWindow(MemoryAccessor.process.MainWindowHandle); }