예제 #1
0
        internal ReleaseNotesViewModel([NotNull] LauncherViewModel launcher, [NotNull] string version)
            : base(launcher.SafeArgument(nameof(launcher)).ServiceProvider)
        {
            if (version == null)
            {
                throw new ArgumentNullException(nameof(version));
            }
            this.launcher = launcher;

            Version = version;
            baseUrl = $"{RootUrl}/{Version}/ReleaseNotes/";
#if DEBUG
            if (Environment.CommandLine.ToLowerInvariant().Contains("/previewreleasenotes"))
            {
                var launcherPath = AppDomain.CurrentDomain.BaseDirectory;
                var mdPath       = Path.Combine(launcherPath, @"..\..\..\..\..\doc\");
                if (File.Exists($"{mdPath}{ReleaseNotesFileName}"))
                {
                    baseUrl = $"file:///{mdPath.Replace("\\", "/")}";
                }
            }
#endif

            ToggleCommand = new AnonymousCommand(ServiceProvider, Toggle);
        }
예제 #2
0
 internal VsixVersionViewModel(LauncherViewModel launcher, NugetStore store)
     : base(launcher, store, null)
 {
     ExecuteActionCommand = new AnonymousCommand(ServiceProvider, ExecuteAction)
     {
         IsEnabled = false
     };
 }
예제 #3
0
 private void CloseAnnouncement()
 {
     Validated = true;
     if (DontShowAgain)
     {
         LauncherViewModel.SaveTaskAsDone(TaskName);
     }
 }
예제 #4
0
 internal VsixVersionViewModel(LauncherViewModel launcher, NugetStore store, string packageId)
     : base(launcher, store, null)
 {
     this.packageId       = packageId;
     status               = FormatStatus(Strings.ReportChecking);
     ExecuteActionCommand = new AnonymousTaskCommand(ServiceProvider, ExecuteAction)
     {
         IsEnabled = false
     };
 }
예제 #5
0
 internal StrideDevVersionViewModel(LauncherViewModel launcher, NugetStore store, [CanBeNull] NugetLocalPackage localPackage, UDirectory path, bool isDevRedirect)
     : base(launcher, store, localPackage, localPackage.Id, int.MaxValue, devMinorCounter--)
 {
     this.path                 = path;
     this.localPackage         = localPackage;
     this.isDevRedirect        = isDevRedirect;
     DownloadCommand.IsEnabled = false;
     // Update initial status (IsVisible will be set to true)
     UpdateStatus();
 }
예제 #6
0
        internal StrideVersionViewModel(LauncherViewModel launcher, NugetStore store, NugetLocalPackage localPackage, string packageId, int major, int minor)
            : base(launcher, store, localPackage)
        {
            PackageSimpleName  = packageId.Replace(".GameStudio", string.Empty);
            Major              = major;
            Minor              = minor;
            SetAsActiveCommand = new AnonymousCommand(ServiceProvider, () => launcher.ActiveVersion = this);
            // Update status if the user changes whether to display beta versions.
            launcher.PropertyChanged += (s, e) => { if (e.PropertyName == nameof(LauncherViewModel.ShowBetaVersions))
                                                    {
                                                        UpdateStatus();
                                                    }
            };

            if (LocalPackage != null && InstallPath != null)
            {
                var libDirectory = Path.Combine(InstallPath, "lib");
                var frameworks   = Directory.EnumerateDirectories(libDirectory);
                foreach (var frameworkPath in frameworks)
                {
                    var frameworkFolder = new DirectoryInfo(frameworkPath).Name;
                    if (File.Exists(Path.Combine(frameworkPath, "Stride.GameStudio.exe")) ||
                        File.Exists(Path.Combine(frameworkPath, "Xenko.GameStudio.exe")))
                    {
                        Frameworks.Add(frameworkFolder);
                    }
                }

                if (Frameworks.Count > 0)
                {
                    try
                    {
                        // If preferred framework exists in our list, select it
                        var preferredFramework = LauncherSettings.PreferredFramework;
                        if (Frameworks.Contains(preferredFramework))
                        {
                            SelectedFramework = preferredFramework;
                        }
                        else
                        {
                            // Otherwise, try to find a framework of the same kind (.NET Core or .NET Framework)
                            var nugetFramework = NuGetFramework.ParseFolder(preferredFramework);
                            SelectedFramework =
                                Frameworks.FirstOrDefault(x => NuGetFramework.ParseFolder(preferredFramework).Framework == nugetFramework.Framework)
                                ?? Frameworks.First(); // otherwise fallback to first choice
                        }
                    }
                    catch
                    {
                        SelectedFramework = Frameworks.First();
                    }
                }
            }
        }
예제 #7
0
 public AnnouncementViewModel(LauncherViewModel launcher, string announcementName)
     : base(launcher.SafeArgument(nameof(launcher)).ServiceProvider)
 {
     this.launcher         = launcher;
     this.announcementName = announcementName;
     if (!LauncherViewModel.HasDoneTask(TaskName))
     {
         MarkdownAnnouncement = Initialize(announcementName);
     }
     // We want to explicitely trigger the property change notification for the view storyboard
     Dispatcher.InvokeAsync(() => Validated = false);
     CloseAnnouncementCommand = new AnonymousCommand(ServiceProvider, CloseAnnouncement);
 }
예제 #8
0
 internal StrideVersionViewModel(LauncherViewModel launcher, NugetStore store, NugetLocalPackage localPackage, string packageId, int major, int minor)
     : base(launcher, store, localPackage)
 {
     PackageSimpleName  = packageId.Replace(".GameStudio", string.Empty);
     Major              = major;
     Minor              = minor;
     SetAsActiveCommand = new AnonymousCommand(ServiceProvider, () => launcher.ActiveVersion = this);
     // Update status if the user changes whether to display beta versions.
     launcher.PropertyChanged += (s, e) => { if (e.PropertyName == nameof(LauncherViewModel.ShowBetaVersions))
                                             {
                                                 UpdateStatus();
                                             }
     };
 }
예제 #9
0
 internal RecentProjectViewModel(LauncherViewModel launcher, UFile path)
     : base(launcher.SafeArgument(nameof(launcher)).ServiceProvider)
 {
     Name              = path.GetFileNameWithoutExtension();
     Launcher          = launcher;
     fullPath          = path;
     StrideVersionName = Strings.ReportDiscovering;
     OpenCommand       = new AnonymousTaskCommand(ServiceProvider, () => OpenWith(null))
     {
         IsEnabled = false
     };
     OpenWithCommand    = new AnonymousTaskCommand <StrideVersionViewModel>(ServiceProvider, OpenWith);
     ExploreCommand     = new AnonymousCommand(ServiceProvider, Explore);
     RemoveCommand      = new AnonymousCommand(ServiceProvider, Remove);
     CompatibleVersions = new ObservableList <StrideVersionViewModel>();
     DiscoverStrideVersion();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="PackageVersionViewModel"/> class.
 /// </summary>
 /// <param name="launcher">The parent <see cref="LauncherViewModel"/> instance.</param>
 /// <param name="store">The related <see cref="NugetStore"/> instance.</param>
 /// <param name="localPackage">The local package of this version, if a local package exists.</param>
 internal PackageVersionViewModel(LauncherViewModel launcher, NugetStore store, NugetLocalPackage localPackage)
     : base(launcher.SafeArgument("launcher").ServiceProvider)
 {
     if (launcher == null)
     {
         throw new ArgumentNullException(nameof(launcher));
     }
     if (store == null)
     {
         throw new ArgumentNullException(nameof(store));
     }
     Launcher        = launcher;
     Store           = store;
     LocalPackage    = localPackage;
     DownloadCommand = new AnonymousCommand(ServiceProvider, () => Download(true));
     DeleteCommand   = new AnonymousTaskCommand(ServiceProvider, () => Delete(true, true))
     {
         IsEnabled = CanDelete
     };
     UpdateStatusInternal();
 }
예제 #11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="StrideStoreVersionViewModel"/>
 /// </summary>
 /// <param name="launcher"></param>
 /// <param name="store"></param>
 /// <param name="localPackage"></param>
 /// <param name="major"></param>
 /// <param name="minor"></param>
 internal StrideStoreVersionViewModel(LauncherViewModel launcher, NugetStore store, NugetLocalPackage localPackage, string packageId, int major, int minor)
     : base(launcher, store, localPackage, packageId, major, minor)
 {
     FetchReleaseNotes();
     FetchDocumentation();
 }