public bool UpdateApp( VersionManifest currentManifest, string appName, string displayAppName, string appPath, string[] executePaths, string[] lockProcesses, string defaultUpdateUri) { VersionManifest latestManifest = null; try { _UpdateRunning = true; //if update alredy running quit if (!CheckOtherProccesses(appName)) { return(false); } //if there is now cuurent version info supose we have first version if (currentManifest == null && !String.IsNullOrEmpty(defaultUpdateUri)) { currentManifest = new VersionManifest() { VersionNumberString = "1.0.0.0", UpdateUri = defaultUpdateUri } } ; //clean up older install CleanUp(appName, currentManifest); var lastVersion = GetVersionData(new List <Uri>() { currentManifest.GetUpdateUriLocal(), currentManifest.GetUpdateUriAltLocal() }); if (lastVersion != null && lastVersion.VersionData.VersionNumber > currentManifest.VersionNumber) { if (AskUserForDownload(displayAppName, lastVersion.VersionData, lastVersion.SourceUri.Authority)) { var manifestUri = currentManifest.GetManifestUri(lastVersion.SourceUri); latestManifest = lastVersion.VNP.GetLatestVersionManifest(manifestUri); //failed to download latest version manifest if (latestManifest == null) { return(false); } VersionManifest updateManifest = latestManifest.GetUpdateManifest(currentManifest); var tempPath = DownloadVersion(updateManifest, appName, lastVersion.VersionData.VersionNumber, lastVersion.SourceUri.AbsoluteUri); VersionDownloadCompleted( displayAppName, updateManifest, latestManifest, lastVersion.VersionData, new InstallInfo() { AppName = appName, ExecutePaths = executePaths, InstallPath = appPath, LockProcess = lockProcesses, TempPath = tempPath }); } else // there is new version but user dont wont to download it { InvokeUpdateCompleted(true, true, null); } } else if (lastVersion == null) //failed to get new version { InvokeUpdateCompleted(false, false, null); } //DispatcherHelper.Invoke(new UpdateCompletedResult(OnUpdateCompleted), false, false, null); else //there is no new version { InvokeUpdateCompleted(true, false, null); } //DispatcherHelper.Invoke(new UpdateCompletedResult(OnUpdateCompleted), true, false, null); } catch (UpdateException exc) { CleanUp(appName, latestManifest); InvokeUpdateCompleted(false, false, exc.Message); return(false); } catch (Exception exc) { CleanUp(appName, latestManifest); InvokeUpdateCompleted(false, false, exc.ToString()); return(false); } finally { if (_UpdatingFlag != null) { _UpdatingFlag.Close(); } _UpdateRunning = false; } return(true); }