| 2270 | } |
| 2271 | |
| 2272 | void AppWindow::RestartApp() |
| 2273 | { |
| 2274 | // Use the reference to the web view before we close the app window |
| 2275 | UINT webviewProcessId = 0; |
| 2276 | m_webView->get_BrowserProcessId(&webviewProcessId); |
| 2277 | |
| 2278 | // To restart the app completely, first we close the current App Window |
| 2279 | CloseAppWindow(); |
| 2280 | |
| 2281 | // Make sure the browser process inside webview is closed |
| 2282 | ProcessComponent::EnsureProcessIsClosed(webviewProcessId, 2000); |
| 2283 | |
| 2284 | // Get the command line arguments used to start this app |
| 2285 | // so we can re-create the process with them |
| 2286 | LPWSTR args = GetCommandLineW(); |
| 2287 | |
| 2288 | STARTUPINFOW startup_info = {0}; |
| 2289 | startup_info.cb = sizeof(startup_info); |
| 2290 | PROCESS_INFORMATION temp_process_info = {}; |
| 2291 | // Start a new process |
| 2292 | if (!::CreateProcess( |
| 2293 | nullptr, args, |
| 2294 | nullptr, // default process attributes |
| 2295 | nullptr, // default thread attributes |
| 2296 | FALSE, // do not inherit handles |
| 2297 | 0, |
| 2298 | nullptr, // no environment |
| 2299 | nullptr, // default current directory |
| 2300 | &startup_info, &temp_process_info)) |
| 2301 | { |
| 2302 | // Log some error information if desired |
| 2303 | } |
| 2304 | |
| 2305 | // Terminate this current process |
| 2306 | ::exit(0); |
| 2307 | } |
| 2308 | |
| 2309 | void AppWindow::RegisterEventHandlers() |
| 2310 | { |
nothing calls this directly
no outgoing calls
no test coverage detected