public void Invoke(ISearchJob searchJob, ISearchCompletedCallbackArgs callbackArgs) { WindowsUpdateFrame.sResult = WindowsUpdateFrame.uSearcher.EndSearch(WindowsUpdateFrame.searchJob); WindowsUpdateFrame.Dispatcher.BeginInvoke(new Action(() => WindowsUpdateFrame.textBox1.Text = "Found " + WindowsUpdateFrame.sResult.Updates.Count + " updates" + Environment.NewLine)); foreach (IUpdate update in WindowsUpdateFrame.sResult.Updates) { WindowsUpdateFrame.Dispatcher.BeginInvoke(new Action(() => WindowsUpdateFrame.textBox1.AppendText(update.Title + Environment.NewLine))); } WindowsUpdateFrame.downloadJob = null; if (WindowsUpdateFrame.sResult.Updates.Count != 0) { WindowsUpdateFrame.Dispatcher.BeginInvoke(new Action(() => WindowsUpdateFrame.InstallButton.IsEnabled = true)); } else { SetWinServices.DisableWinService("wuauserv"); SetWinServices.Disable("wuauserv"); } }
public void Invoke(IInstallationJob installationJob, IInstallationCompletedCallbackArgs callbackArgs) { WindowsUpdateFrame.installationResult = WindowsUpdateFrame.installer.EndInstall(WindowsUpdateFrame.installationJob); WindowsUpdateFrame.progressWindow.Dispatcher.BeginInvoke(new Action(() => WindowsUpdateFrame.textBox1.Clear())); SetWinServices.DisableWinService("wuauserv"); SetWinServices.Disable("wuauserv"); for (int i = 0; i < WindowsUpdateFrame.installCollection.Count; i++) { if (WindowsUpdateFrame.installationResult.GetUpdateResult(i).HResult == 0) { try { WindowsUpdateFrame.textBox1.Dispatcher.BeginInvoke(new Action(() => WindowsUpdateFrame.textBox1.AppendText("Installed : " + WindowsUpdateFrame.installCollection[i].Title + "\r\n"))); } catch (Exception e) { LogWriter.LogWrite(e.ToString()); } } else { try { WindowsUpdateFrame.textBox1.Dispatcher.BeginInvoke(new Action(() => WindowsUpdateFrame.textBox1.AppendText("Failed : " + WindowsUpdateFrame.installCollection[i].Title + "\r\n"))); } catch (Exception e) { LogWriter.LogWrite(e.ToString()); } } } if (WindowsUpdateFrame.installationResult.RebootRequired) { Process.Start("shutdown", "/r /f /t 30"); } WindowsUpdateFrame.installationJob = null; WindowsUpdateFrame.progressWindow.Dispatcher.BeginInvoke(new Action(() => WindowsUpdateFrame.progressWindow.Close())); }
private void Close_Window(object sender, System.ComponentModel.CancelEventArgs e) { SetWinServices.DisableWinService("wuauserv"); SetWinServices.Disable("wuauserv"); }