public ModUpdateInformation(List <OnlineContent.ModUpdateInfo> modsWithUpdates) { DataContext = this; modsWithUpdates.ForEach(x => { x.ApplyUpdateCommand = new RelayCommand(ApplyUpdateToMod, CanApplyUpdateToMod); x.DownloadButtonText = M3L.GetString(M3L.string_downloadUpdate); }); UpdatableMods.AddRange(modsWithUpdates); LoadCommands(); InitializeComponent(); }
public ModUpdateInformation(List <OnlineContent.ModUpdateInfo> modsWithUpdates) { DataContext = this; modsWithUpdates.ForEach(x => { x.ApplyUpdateCommand = new RelayCommand(ApplyUpdateToMod, CanApplyUpdateToMod); if (x.mod.ModModMakerID > 0 && BackupService.GetGameBackupPath(x.mod.Game) == null) { x.DownloadButtonText = M3L.GetString(M3L.string_requiresBackup); } else { x.DownloadButtonText = M3L.GetString(M3L.string_downloadUpdate); } }); UpdatableMods.AddRange(modsWithUpdates); LoadCommands(); InitializeComponent(); }
private void DownloadAll() { var updates = UpdatableMods.Where(x => x.CanUpdate && (x.mod.ModClassicUpdateCode > 0 || x.mod.ModModMakerID > 0)).ToList(); OperationInProgress = true; CommandManager.InvalidateRequerySuggested(); Task.Run(() => { object syncObj = new object(); void updateDone() { lock (syncObj) { Monitor.Pulse(syncObj); } } foreach (var update in updates) { if (update is OnlineContent.ModMakerModUpdateInfo mui) { UpdateModMakerMod(mui, updateDone); lock (syncObj) { Monitor.Wait(syncObj); } } else if (update.mod.ModClassicUpdateCode > 0) { UpdateClassicMod(update, updateDone); lock (syncObj) { Monitor.Wait(syncObj); } } } }); }
public ModUpdateInformation(List <OnlineContent.ModUpdateInfo> modsWithUpdates) { modsWithUpdates.ForEach(x => { x.ApplyUpdateCommand = new RelayCommand(ApplyUpdateToMod, CanApplyUpdateToMod); if (x.mod.ModModMakerID > 0 && BackupService.GetGameBackupPath(x.mod.Game) == null) { x.DownloadButtonText = M3L.GetString(M3L.string_requiresBackup); } else if (x.mod.ModClassicUpdateCode > 0 || x.mod.ModModMakerID > 0) { x.DownloadButtonText = M3L.GetString(M3L.string_downloadUpdate); } else { x.DownloadButtonText = M3L.GetString(M3L.string_downloadUpdateFromNexusMods); } }); UpdatableMods.ReplaceAll(modsWithUpdates); LoadCommands(); InitializeComponent(); }
private bool TaskNotRunning() => UpdatableMods.All(x => !x.UpdateInProgress);
private bool CanDownloadAll() => !OperationInProgress && UpdatableMods.Any(x => x.CanUpdate && (x.mod.ModClassicUpdateCode > 0 || x.mod.ModModMakerID > 0));