forked from stride3d/stride
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Launcher] Allow to select Xenko version
- Loading branch information
Showing
13 changed files
with
296 additions
and
15 deletions.
There are no files selected for viewing
11 changes: 10 additions & 1 deletion
11
sources/launcher/Xenko.Launcher/Resources/Strings.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
sources/launcher/Xenko.Launcher/ViewModels/XenkoStoreAlternateVersionViewModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Xenko.Core; | ||
using Xenko.Core.Annotations; | ||
using Xenko.Core.Packages; | ||
using Xenko.Core.Presentation.Commands; | ||
using Xenko.Core.Presentation.ViewModel; | ||
|
||
namespace Xenko.LauncherApp.ViewModels | ||
{ | ||
internal sealed class XenkoStoreAlternateVersionViewModel : DispatcherViewModel | ||
{ | ||
private XenkoStoreVersionViewModel xenkoVersion; | ||
internal NugetServerPackage ServerPackage; | ||
internal NugetLocalPackage LocalPackage; | ||
|
||
public XenkoStoreAlternateVersionViewModel([NotNull] XenkoStoreVersionViewModel xenkoVersion) | ||
: base(xenkoVersion.ServiceProvider) | ||
{ | ||
this.xenkoVersion = xenkoVersion; | ||
|
||
SetAsActiveCommand = new AnonymousCommand(ServiceProvider, () => | ||
{ | ||
xenkoVersion.UpdateLocalPackage(LocalPackage, null); | ||
if (LocalPackage == null) | ||
{ | ||
// If it's a non installed version, offer same version for serverPackage so that it offers to install this specific version | ||
xenkoVersion.UpdateServerPackage(ServerPackage, null); | ||
} | ||
else | ||
{ | ||
// Otherwise, offer latest version for update | ||
xenkoVersion.UpdateServerPackage(xenkoVersion.LatestServerPackage, null); | ||
} | ||
|
||
xenkoVersion.Launcher.ActiveVersion = xenkoVersion; | ||
}); | ||
} | ||
|
||
/// <summary> | ||
/// Gets the command that will set the associated version as active. | ||
/// </summary> | ||
public CommandBase SetAsActiveCommand { get; } | ||
|
||
public string FullName | ||
{ | ||
get | ||
{ | ||
if (LocalPackage != null) | ||
return $"{LocalPackage.Id} {LocalPackage.Version} (installed)"; | ||
return $"{ServerPackage.Id} {ServerPackage.Version}"; | ||
} | ||
} | ||
|
||
public PackageVersion Version => LocalPackage?.Version ?? ServerPackage.Version; | ||
|
||
internal void UpdateLocalPackage(NugetLocalPackage package) | ||
{ | ||
OnPropertyChanging(nameof(FullName), nameof(Version)); | ||
LocalPackage = package; | ||
OnPropertyChanged(nameof(FullName), nameof(Version)); | ||
} | ||
|
||
internal void UpdateServerPackage(NugetServerPackage package) | ||
{ | ||
OnPropertyChanging(nameof(FullName), nameof(Version)); | ||
ServerPackage = package; | ||
OnPropertyChanged(nameof(FullName), nameof(Version)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.