private async Task Remove(Version v) { v.StateChangeInfo = new VersionStateChangeInfo(VersionState.Uninstalling); await UnregisterPackage(v.GamePackageFamily, Path.GetFullPath(v.GameDirectory)); Directory.Delete(v.GameDirectory, true); v.StateChangeInfo = null; if (v.IsImported) { Dispatcher.Invoke(() => _versions.Remove(v)); Debug.WriteLine("Removed imported version " + v.DisplayName); } else { v.UpdateInstallStatus(); Debug.WriteLine("Removed release version " + v.DisplayName); } }
private void InvokeRemove(WPFDataTypes.Version v) { Task.Run(async() => { v.StateChangeInfo = new VersionStateChangeInfo(VersionState.Uninstalling); await UnregisterPackage(Path.GetFullPath(v.GameDirectory)); Directory.Delete(v.GameDirectory, true); v.StateChangeInfo = null; if (v.UUID == WPFDataTypes.Version.UNKNOWN_UUID) { Dispatcher.Invoke(() => _versions.Remove(v)); Debug.WriteLine("Removed imported version " + v.DisplayName); } else { v.UpdateInstallStatus(); Debug.WriteLine("Removed release version " + v.DisplayName); } }); }