private void SetupApplication_ExecuteFilesInUse(object sender, ExecuteFilesInUseEventArgs e) { string logName = "Engine hook SetupApplication_ExecuteFilesInUse: "; try { this.filesInUseActive = !this.filesInUseActive; // It seems that MSI has some weird behavior. Only every 2nd call does really have // valuable information. The calls in between can even contain processes that do actually // NOT use any of the files to be changed by the installer. So you get false information. // In order to prevent this, we're scipping every odd call (1st, 3rd, 5th, ...) and calling // "Retry" again. if (this.filesInUseActive) { this.Log(logName + "Scipping unnecessary MSI callback 'ExecuteFilesInUse'"); e.Result = Result.Retry; return; } IList <string> files = e.Files; if (files == null || files.Count == 0) { e.Result = Result.Retry; return; } IList <string> filesFormated = this.FormatFileInUseList(files); Func <bool?> showFilesInUseWindow = () => { FilesInUseWindow filesInUseWindow = new FilesInUseWindow() { DataContext = new FilesInUseWindowVM(filesFormated) }; return(filesInUseWindow.ShowDialog()); }; bool?dlgRes = this.InvokeOnUiThread <bool?>(showFilesInUseWindow); if (dlgRes == true) { e.Result = Result.Retry; } else { this.SetCancelledByUser(); e.Result = Result.Cancel; } } catch { e.Result = Result.Cancel; throw; } }
protected override void OnExecuteFilesInUse(ExecuteFilesInUseEventArgs args) { this.Log("OnExecuteFilesInUse() - package: {0}, retries remaining: {1}, data: {2}", args.PackageId, this.retryExecuteFilesInUse, String.Join(", ", args.Files.ToArray())); if (this.retryExecuteFilesInUse > 0) { --this.retryExecuteFilesInUse; args.Result = Result.Retry; } else { args.Result = Result.Abort; } }
/// Fired when Windows Installer sends a files in use installation message. static void OnExecuteFilesInUse(object sender, ExecuteFilesInUseEventArgs e) { Logger.Instance.Trace(""); }
private void ExecuteFilesInUse(ExecuteFilesInUseEventArgs eventArgs) { // Handle files in use messages? }