public async Task Window_Initialized() { if (!this.PluginsToUpdate.Any()) { Logger.Warn("No plugins to update passed. Exiting Plugin Updater"); this.DialogResult = false; return; } var list = new List <Tuple <string, string> >(); foreach (var it in this.PluginsToUpdate) { Logger.Info($"Updating {it.Name}..."); this.CurrentPlugin = it; string resultPath = await Task.Run(() => it.DownloadUpdate(new Progress <Tuple <long, long> >((t) => { this.CurrentDownloadProgressInKiloBytes = t.Item1; this.FileSizeInKiloBytes = t.Item2; }))); list.Add(new Tuple <string, string>(resultPath, Path.GetFileName(it.GetType().Assembly.Location))); } Logger.Info($"Done"); foreach (var it in list) { var finalPath = Path.Combine(App.PluginsPath, string.Concat(it.Item2, App.CONST_UPDATESUFFIX)); Logger.Info($"Moving temporary patch file from '{it.Item1}' to '{finalPath}'"); File.Move(it.Item1, finalPath); } this.OKButtonEnabled = true; }
public DownloadPluginUpdateDialogDataContext(IEnumerable <IUpdatingPlugin> pluginsToUpdate) { this.PluginsToUpdate = pluginsToUpdate; this.CurrentPlugin = pluginsToUpdate.FirstOrDefault(); }