public static void ApplyUpdateIfAvailable(bool showUpdateUserinterface = true, int maximumSearchTimeout = 5) { using (var updateManager = new UpdateManager(maximumSearchTimeout)) if (showUpdateUserinterface) { try { var userInterfaceFactory = new UpdateUserInterfaceFactory(updateManager); var updateInterfaceWindow = userInterfaceFactory.CreateUpdateWindow(); updateInterfaceWindow.ShowDialog(); } catch (Exception ex) { Debug.WriteLine(ex); } } else { ApplyUpdateIfAvailableAsync(updateManager).Wait(); } }
public static Task ApplyUpdateIfAvailableAsync(UpdateManager updateManager) { var updateTask = updateManager.CheckForUpdatesAsync(); return updateTask; }