From 3ce51d785e9df267b7cb238b3e62d19b8d70aaaa Mon Sep 17 00:00:00 2001 From: "waffle.lord" Date: Fri, 26 Jan 2024 21:47:04 -0500 Subject: [PATCH] finish mod info page --- project/Aki.Launcher/App.axaml | 14 +-- .../ViewModels/ModInfoViewModel.cs | 37 ++++++- .../ViewModels/ProfileViewModel.cs | 11 +-- project/Aki.Launcher/Views/ModInfoView.axaml | 99 ++++++++++++++++++- project/Aki.Launcher/Views/ProfileView.axaml | 56 ++++------- 5 files changed, 157 insertions(+), 60 deletions(-) diff --git a/project/Aki.Launcher/App.axaml b/project/Aki.Launcher/App.axaml index 356068f..4ecaa8a 100644 --- a/project/Aki.Launcher/App.axaml +++ b/project/Aki.Launcher/App.axaml @@ -35,7 +35,7 @@ FillRule="NonZero" /> - @@ -47,21 +47,21 @@ FillRule="NonZero" /> - - - + /> - + /> diff --git a/project/Aki.Launcher/ViewModels/ModInfoViewModel.cs b/project/Aki.Launcher/ViewModels/ModInfoViewModel.cs index aa2177c..206cbbd 100644 --- a/project/Aki.Launcher/ViewModels/ModInfoViewModel.cs +++ b/project/Aki.Launcher/ViewModels/ModInfoViewModel.cs @@ -1,10 +1,45 @@ +using System; +using System.Diagnostics; +using System.Threading.Tasks; +using Aki.Launcher.Controllers; +using Aki.Launcher.Helpers; +using Aki.Launcher.Models.Launcher; +using Aki.Launcher.ViewModels.Dialogs; using ReactiveUI; namespace Aki.Launcher.ViewModels; public class ModInfoViewModel : ViewModelBase { - public ModInfoViewModel(IScreen Host) : base(Host) + public ModInfoCollection ModsCollection { get; set; } + public ModInfoViewModel(IScreen Host, ModInfoCollection mods) : base(Host) { + ModsCollection = mods; + } + + public async Task OpenUrlCommand(string url) + { + if (!url.StartsWith("https://") && !url.StartsWith("https://")) + { + LogManager.Instance.Warning($"url does not start with http/s \n -URL-> '{url}'"); + return; + } + + var question = String.Format(LocalizationProvider.Instance.open_link_question_format_1, url); + var confirmText = LocalizationProvider.Instance.open_link; + var cancelText = LocalizationProvider.Instance.cancel; + + var confirm = await ShowDialog(new ConfirmationDialogViewModel(HostScreen, question, confirmText, cancelText)); + + if (confirm is not (bool and true)) + return; + + Process.Start(new ProcessStartInfo + { + FileName = "cmd.exe", + UseShellExecute = true, + WindowStyle = ProcessWindowStyle.Hidden, + ArgumentList = { "/C", "start", url } + }); } } \ No newline at end of file diff --git a/project/Aki.Launcher/ViewModels/ProfileViewModel.cs b/project/Aki.Launcher/ViewModels/ProfileViewModel.cs index 87bc112..134b8c4 100644 --- a/project/Aki.Launcher/ViewModels/ProfileViewModel.cs +++ b/project/Aki.Launcher/ViewModels/ProfileViewModel.cs @@ -26,13 +26,6 @@ namespace Aki.Launcher.ViewModels set => this.RaiseAndSetIfChanged(ref _CurrentEdition, value); } - private bool _ModsListIsVisible; - public bool ModsListIsVisible - { - get => _ModsListIsVisible; - set => this.RaiseAndSetIfChanged(ref _ModsListIsVisible, value); - } - private bool _WipeProfileOnStart; public bool WipeProfileOnStart { @@ -76,8 +69,6 @@ namespace Aki.Launcher.ViewModels CurrentEdition = AccountManager.SelectedAccount.edition; CurrentID = AccountManager.SelectedAccount.id; - - ModsListIsVisible = false; } private async Task GameVersionCheck() @@ -105,7 +96,7 @@ namespace Aki.Launcher.ViewModels } public void OpenModsInfoCommand() => - NavigateTo(new ModInfoViewModel(HostScreen)); + NavigateTo(new ModInfoViewModel(HostScreen, ModInfoCollection)); public void LogoutCommand() { diff --git a/project/Aki.Launcher/Views/ModInfoView.axaml b/project/Aki.Launcher/Views/ModInfoView.axaml index 1a08ff4..77532f6 100644 --- a/project/Aki.Launcher/Views/ModInfoView.axaml +++ b/project/Aki.Launcher/Views/ModInfoView.axaml @@ -2,13 +2,104 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:cc="using:Aki.Launcher.CustomControls" + xmlns:launcher="using:Aki.Launcher.Models.Aki" + xmlns:helpers="using:Aki.Launcher.Helpers" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" x:Class="Aki.Launcher.Views.ModInfoView"> - - - - - - - - - - - - - - - - - -