From c66286458eccb7b42b1e7aaf4feec9315c961aeb Mon Sep 17 00:00:00 2001
From: gaviny82 <38808970+gaviny82@users.noreply.github.com>
Date: Sun, 10 Sep 2023 23:10:27 +0800
Subject: [PATCH 01/22] Redesign LanguagePage / welcome page
---
.../Views/MainWindow.xaml.cs | 4 +-
.../Views/OOBE/LanguagePage.xaml | 114 +++++++++++-------
.../Views/OOBE/OOBENavigationPage.xaml | 56 +++++----
3 files changed, 102 insertions(+), 72 deletions(-)
diff --git a/Natsurainko.FluentLauncher/Views/MainWindow.xaml.cs b/Natsurainko.FluentLauncher/Views/MainWindow.xaml.cs
index 0c65b54d..9ed0ace1 100644
--- a/Natsurainko.FluentLauncher/Views/MainWindow.xaml.cs
+++ b/Natsurainko.FluentLauncher/Views/MainWindow.xaml.cs
@@ -55,8 +55,10 @@ public MainWindow(INavigationService navService)
private bool _firstActivated = true;
private void WindowEx_Activated(object sender, WindowActivatedEventArgs args)
{
+
if (_firstActivated)
- _navService.NavigateTo(_settings.FinishGuide ? "ShellPage" : "OOBENavigationPage");
+ //_navService.NavigateTo(_settings.FinishGuide ? "ShellPage" : "OOBENavigationPage");
+ _navService.NavigateTo("OOBENavigationPage");
_firstActivated = false;
}
diff --git a/Natsurainko.FluentLauncher/Views/OOBE/LanguagePage.xaml b/Natsurainko.FluentLauncher/Views/OOBE/LanguagePage.xaml
index 4a357b20..ac6865b5 100644
--- a/Natsurainko.FluentLauncher/Views/OOBE/LanguagePage.xaml
+++ b/Natsurainko.FluentLauncher/Views/OOBE/LanguagePage.xaml
@@ -2,58 +2,88 @@
x:Class="Natsurainko.FluentLauncher.Views.OOBE.LanguagePage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:behaviors="using:Natsurainko.FluentLauncher.Utils.Xaml.Behaviors"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:guides="using:Natsurainko.FluentLauncher.ViewModels.OOBE"
+ xmlns:i="using:Microsoft.Xaml.Interactivity"
+ xmlns:labs="using:CommunityToolkit.Labs.WinUI"
xmlns:local="using:Natsurainko.FluentLauncher.Views.OOBE"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="using:Natsurainko.FluentLauncher.ViewModels.OOBE"
+ xmlns:xh="using:Natsurainko.FluentLauncher.Utils.Xaml"
d:DataContext="{d:DesignInstance vm:OOBEViewModel}"
mc:Ignorable="d">
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
-
-
-
-
+ Grid.Row="1"
+ HorizontalAlignment="Center"
+ Orientation="Horizontal"
+ Spacing="32">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Natsurainko.FluentLauncher/Views/OOBE/OOBENavigationPage.xaml b/Natsurainko.FluentLauncher/Views/OOBE/OOBENavigationPage.xaml
index fa6607ee..bdd20fdc 100644
--- a/Natsurainko.FluentLauncher/Views/OOBE/OOBENavigationPage.xaml
+++ b/Natsurainko.FluentLauncher/Views/OOBE/OOBENavigationPage.xaml
@@ -11,30 +11,15 @@
mc:Ignorable="d">
-
-
-
-
+
+
+
+
+
+
@@ -87,12 +72,25 @@
-
-
+
+
+
+
From bee6d055299cef007f83116ff52593dbf8f8d7ea Mon Sep 17 00:00:00 2001
From: gaviny82 <38808970+gaviny82@users.noreply.github.com>
Date: Sun, 10 Sep 2023 23:29:00 +0800
Subject: [PATCH 02/22] Split Minecraft folder and Java config in OOBE
---
Natsurainko.FluentLauncher/App.xaml.cs | 3 +-
.../Natsurainko.FluentLauncher.csproj | 4 +
.../ViewModels/OOBE/OOBEViewModel.cs | 11 +-
.../OOBE/{BasicPage.xaml => JavaPage.xaml} | 2 +-
.../{BasicPage.xaml.cs => JavaPage.xaml.cs} | 4 +-
.../Views/OOBE/MinecraftFolderPage.xaml | 163 ++++++++++++++++++
.../Views/OOBE/MinecraftFolderPage.xaml.cs | 11 ++
.../Views/OOBE/OOBENavigationPage.xaml | 14 +-
8 files changed, 201 insertions(+), 11 deletions(-)
rename Natsurainko.FluentLauncher/Views/OOBE/{BasicPage.xaml => JavaPage.xaml} (99%)
rename Natsurainko.FluentLauncher/Views/OOBE/{BasicPage.xaml.cs => JavaPage.xaml.cs} (66%)
create mode 100644 Natsurainko.FluentLauncher/Views/OOBE/MinecraftFolderPage.xaml
create mode 100644 Natsurainko.FluentLauncher/Views/OOBE/MinecraftFolderPage.xaml.cs
diff --git a/Natsurainko.FluentLauncher/App.xaml.cs b/Natsurainko.FluentLauncher/App.xaml.cs
index ce51eaf7..7c5e969d 100644
--- a/Natsurainko.FluentLauncher/App.xaml.cs
+++ b/Natsurainko.FluentLauncher/App.xaml.cs
@@ -70,7 +70,8 @@ private static IPageProvider BuildPageProvider(IServiceProvider sp) => WinUIPage
// OOBE
.WithPage("OOBENavigationPage")
.WithPage("OOBEAccountPage")
- .WithPage("OOBEBasicPage")
+ .WithPage("OOBEMinecraftFolderPage")
+ .WithPage("OOBEJavaPage")
.WithPage("OOBEGetStartedPage")
.WithPage("OOBELanguagePage")
diff --git a/Natsurainko.FluentLauncher/Natsurainko.FluentLauncher.csproj b/Natsurainko.FluentLauncher/Natsurainko.FluentLauncher.csproj
index b2f9f383..f6093569 100644
--- a/Natsurainko.FluentLauncher/Natsurainko.FluentLauncher.csproj
+++ b/Natsurainko.FluentLauncher/Natsurainko.FluentLauncher.csproj
@@ -75,6 +75,7 @@
+
@@ -283,6 +284,9 @@
MSBuild:Compile
+
+ $(DefaultXamlRuntime)
+
diff --git a/Natsurainko.FluentLauncher/ViewModels/OOBE/OOBEViewModel.cs b/Natsurainko.FluentLauncher/ViewModels/OOBE/OOBEViewModel.cs
index b926d609..d64f4604 100644
--- a/Natsurainko.FluentLauncher/ViewModels/OOBE/OOBEViewModel.cs
+++ b/Natsurainko.FluentLauncher/ViewModels/OOBE/OOBEViewModel.cs
@@ -67,7 +67,8 @@ internal partial class OOBEViewModel : ObservableRecipient, INavigationAware, IS
private static readonly string[] OOBEPageKeys =
{
"OOBELanguagePage",
- "OOBEBasicPage",
+ "OOBEMinecraftFolderPage",
+ "OOBEJavaPage",
"OOBEAccountPage",
"OOBEGetStartedPage"
};
@@ -90,15 +91,17 @@ public void Next()
{
// Language page
0 => Languages.Contains(CurrentLanguage),
- // Basic page
+ // Minecraft folder page
1 => !string.IsNullOrEmpty(ActiveMinecraftFolder) &&
!string.IsNullOrEmpty(ActiveJava) &&
Directory.Exists(ActiveMinecraftFolder) &&
File.Exists(ActiveJava),
+ // Java page
+ 2 => true, // TODO:
// Account page
- 2 => ActiveAccount is not null,
+ 3 => ActiveAccount is not null,
// Get started page
- 3 => false,
+ 4 => false,
// Default
_ => false,
};
diff --git a/Natsurainko.FluentLauncher/Views/OOBE/BasicPage.xaml b/Natsurainko.FluentLauncher/Views/OOBE/JavaPage.xaml
similarity index 99%
rename from Natsurainko.FluentLauncher/Views/OOBE/BasicPage.xaml
rename to Natsurainko.FluentLauncher/Views/OOBE/JavaPage.xaml
index 9dbc35be..b226da73 100644
--- a/Natsurainko.FluentLauncher/Views/OOBE/BasicPage.xaml
+++ b/Natsurainko.FluentLauncher/Views/OOBE/JavaPage.xaml
@@ -1,5 +1,5 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Natsurainko.FluentLauncher/Views/OOBE/MinecraftFolderPage.xaml.cs b/Natsurainko.FluentLauncher/Views/OOBE/MinecraftFolderPage.xaml.cs
new file mode 100644
index 00000000..fbc86ebf
--- /dev/null
+++ b/Natsurainko.FluentLauncher/Views/OOBE/MinecraftFolderPage.xaml.cs
@@ -0,0 +1,11 @@
+using Microsoft.UI.Xaml.Controls;
+
+namespace Natsurainko.FluentLauncher.Views.OOBE;
+
+public sealed partial class MinecraftFolderPage : Page
+{
+ public MinecraftFolderPage()
+ {
+ InitializeComponent();
+ }
+}
diff --git a/Natsurainko.FluentLauncher/Views/OOBE/OOBENavigationPage.xaml b/Natsurainko.FluentLauncher/Views/OOBE/OOBENavigationPage.xaml
index bdd20fdc..5500cd4d 100644
--- a/Natsurainko.FluentLauncher/Views/OOBE/OOBENavigationPage.xaml
+++ b/Natsurainko.FluentLauncher/Views/OOBE/OOBENavigationPage.xaml
@@ -12,7 +12,7 @@
-
+
@@ -35,12 +35,20 @@
Text="Language" />
-
+
+ Text="Minecraft Folder" />
+
+
+
+
+
From 0a017c04690fdc5d967dc3dcf99cffb1506c56c0 Mon Sep 17 00:00:00 2001
From: gaviny82 <38808970+gaviny82@users.noreply.github.com>
Date: Mon, 11 Sep 2023 16:59:29 +0800
Subject: [PATCH 03/22] Add progress indicator using
NavigationViewItem.IsEnabled
---
.../ViewModels/OOBE/OOBEViewModel.cs | 11 ++++-
.../Views/OOBE/OOBENavigationPage.xaml | 25 +++++++---
.../Views/OOBE/OOBENavigationPage.xaml.cs | 49 ++++++++++++++-----
3 files changed, 66 insertions(+), 19 deletions(-)
diff --git a/Natsurainko.FluentLauncher/ViewModels/OOBE/OOBEViewModel.cs b/Natsurainko.FluentLauncher/ViewModels/OOBE/OOBEViewModel.cs
index d64f4604..7931f1ff 100644
--- a/Natsurainko.FluentLauncher/ViewModels/OOBE/OOBEViewModel.cs
+++ b/Natsurainko.FluentLauncher/ViewModels/OOBE/OOBEViewModel.cs
@@ -3,6 +3,7 @@
using CommunityToolkit.Mvvm.Input;
using CommunityToolkit.Mvvm.Messaging;
using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Media.Animation;
using Natsurainko.FluentLauncher.Services.Accounts;
using Natsurainko.FluentLauncher.Services.Launch;
using Natsurainko.FluentLauncher.Services.Settings;
@@ -109,8 +110,8 @@ public void Next()
[RelayCommand(CanExecute = nameof(CanBack))]
public void Back()
{
- _navigationService.GoBack();
CurrentPageIndex--;
+ _navigationService.NavigateTo(OOBEPageKeys[CurrentPageIndex]);
BackCommand.NotifyCanExecuteChanged();
NextCommand.NotifyCanExecuteChanged();
}
@@ -124,6 +125,14 @@ bool CanBack()
return true;
}
+ public void NavigateTo(int pageIndex)
+ {
+ CurrentPageIndex = pageIndex;
+ _navigationService.NavigateTo(OOBEPageKeys[pageIndex]);
+ BackCommand.NotifyCanExecuteChanged();
+ NextCommand.NotifyCanExecuteChanged();
+ }
+
#endregion
#region Language
diff --git a/Natsurainko.FluentLauncher/Views/OOBE/OOBENavigationPage.xaml b/Natsurainko.FluentLauncher/Views/OOBE/OOBENavigationPage.xaml
index 5500cd4d..2b8259f1 100644
--- a/Natsurainko.FluentLauncher/Views/OOBE/OOBENavigationPage.xaml
+++ b/Natsurainko.FluentLauncher/Views/OOBE/OOBENavigationPage.xaml
@@ -22,6 +22,7 @@
Grid.Row="1"
IsBackButtonVisible="Collapsed"
IsSettingsVisible="False"
+ ItemInvoked="NavigationViewControl_ItemInvoked"
PaneDisplayMode="Top">
-
+
-
+
-
+
-
+
+ FontWeight="SemiBold" Click="BackButton_Click">
diff --git a/Natsurainko.FluentLauncher/Views/OOBE/OOBENavigationPage.xaml.cs b/Natsurainko.FluentLauncher/Views/OOBE/OOBENavigationPage.xaml.cs
index ecab6920..51920908 100644
--- a/Natsurainko.FluentLauncher/Views/OOBE/OOBENavigationPage.xaml.cs
+++ b/Natsurainko.FluentLauncher/Views/OOBE/OOBENavigationPage.xaml.cs
@@ -1,9 +1,11 @@
+using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Media.Animation;
using Microsoft.UI.Xaml.Navigation;
using Natsurainko.FluentLauncher.Services.UI.Navigation;
using Natsurainko.FluentLauncher.Services.UI.Pages;
using Natsurainko.FluentLauncher.ViewModels.OOBE;
+using System.ComponentModel;
using System.Linq;
namespace Natsurainko.FluentLauncher.Views.OOBE;
@@ -13,25 +15,48 @@ public sealed partial class OOBENavigationPage : Page, INavigationProvider
object INavigationProvider.NavigationControl => contentFrame;
private OOBEViewModel VM => (OOBEViewModel)DataContext;
+ public NavigationTransitionInfo TransitionInfo
+ {
+ get => navTransition.DefaultNavigationTransitionInfo;
+ set => navTransition.DefaultNavigationTransitionInfo = value;
+ }
+
public OOBENavigationPage()
{
InitializeComponent();
- contentFrame.Navigated += ContentFrame_Navigated1;
}
- // Change navigation transition effect after the first navigation
- int navigationCount = 0;
- private void ContentFrame_Navigated1(object sender, NavigationEventArgs e)
+ // Explicitly set transition effect at each navigation
+ private void NavigationViewControl_ItemInvoked(NavigationView sender, NavigationViewItemInvokedEventArgs args)
{
- if (navigationCount == 1)
- {
- navTransition.DefaultNavigationTransitionInfo = new SlideNavigationTransitionInfo { Effect = SlideNavigationTransitionEffect.FromRight };
- contentFrame.Navigated -= ContentFrame_Navigated1;
- return;
- }
- navigationCount++;
+ int sourcePageIndex = VM.CurrentPageIndex;
+
+ var navigationViewItems = sender.MenuItems.Union(sender.FooterMenuItems).Cast().Select(item => item.Tag).Cast().ToList();
+ string pageTag = ((NavigationViewItem)args.InvokedItemContainer).Tag.ToString();
+ int targetPageIndex = navigationViewItems.IndexOf(pageTag);
+
+ // Set transition direction
+ if (targetPageIndex > sourcePageIndex)
+ TransitionInfo = new SlideNavigationTransitionInfo { Effect = SlideNavigationTransitionEffect.FromRight };
+ else if (targetPageIndex < sourcePageIndex)
+ TransitionInfo = new SlideNavigationTransitionInfo { Effect = SlideNavigationTransitionEffect.FromLeft };
+ else
+ TransitionInfo = new EntranceNavigationTransitionInfo();
+
+ VM.NavigateTo(targetPageIndex);
}
+ private void BackButton_Click(object sender, RoutedEventArgs e)
+ {
+ TransitionInfo = new SlideNavigationTransitionInfo { Effect = SlideNavigationTransitionEffect.FromLeft };
+ }
+
+ private void NextButton_Click(object sender, RoutedEventArgs e)
+ {
+ TransitionInfo = new SlideNavigationTransitionInfo { Effect = SlideNavigationTransitionEffect.FromRight };
+ }
+
+ // Update NavigationViewItem selection
private void ContentFrame_Navigated(object sender, NavigationEventArgs e)
{
foreach (NavigationViewItem item in NavigationView.MenuItems.Union(NavigationView.FooterMenuItems).Cast())
@@ -40,9 +65,9 @@ private void ContentFrame_Navigated(object sender, NavigationEventArgs e)
{
NavigationView.SelectedItem = item;
item.IsSelected = true;
+ item.IsEnabled = true;
return;
}
}
}
-
}
From e243cbc22017c8671f67a4eec8dd53fdd7321032 Mon Sep 17 00:00:00 2001
From: gaviny82 <38808970+gaviny82@users.noreply.github.com>
Date: Mon, 11 Sep 2023 21:42:03 +0800
Subject: [PATCH 04/22] Fix incorrect transition when Next is clicked after a
NavigationViewItem is clicked
---
.../Views/OOBE/OOBENavigationPage.xaml.cs | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/Natsurainko.FluentLauncher/Views/OOBE/OOBENavigationPage.xaml.cs b/Natsurainko.FluentLauncher/Views/OOBE/OOBENavigationPage.xaml.cs
index 51920908..4aa91b65 100644
--- a/Natsurainko.FluentLauncher/Views/OOBE/OOBENavigationPage.xaml.cs
+++ b/Natsurainko.FluentLauncher/Views/OOBE/OOBENavigationPage.xaml.cs
@@ -27,8 +27,12 @@ public OOBENavigationPage()
}
// Explicitly set transition effect at each navigation
+ bool bypassTransitionUpdate = false; // Bypass transition update if NavigationViewItem is updated in ContentFrame_Navigated
private void NavigationViewControl_ItemInvoked(NavigationView sender, NavigationViewItemInvokedEventArgs args)
{
+ if (bypassTransitionUpdate)
+ return;
+
int sourcePageIndex = VM.CurrentPageIndex;
var navigationViewItems = sender.MenuItems.Union(sender.FooterMenuItems).Cast().Select(item => item.Tag).Cast().ToList();
@@ -63,7 +67,10 @@ private void ContentFrame_Navigated(object sender, NavigationEventArgs e)
{
if (App.GetService().RegisteredPages[item.Tag.ToString()].PageType == e.SourcePageType)
{
+ bypassTransitionUpdate = true;
NavigationView.SelectedItem = item;
+ bypassTransitionUpdate = false;
+
item.IsSelected = true;
item.IsEnabled = true;
return;
From ce145b1efb17befc077a18bdb3ac001be61190e9 Mon Sep 17 00:00:00 2001
From: gaviny82 <38808970+gaviny82@users.noreply.github.com>
Date: Mon, 11 Sep 2023 23:00:46 +0800
Subject: [PATCH 05/22] Redesign Minecraft folder page
---
.../Views/OOBE/MinecraftFolderPage.xaml | 203 +++++++-----------
1 file changed, 76 insertions(+), 127 deletions(-)
diff --git a/Natsurainko.FluentLauncher/Views/OOBE/MinecraftFolderPage.xaml b/Natsurainko.FluentLauncher/Views/OOBE/MinecraftFolderPage.xaml
index adf08ee0..0e582b18 100644
--- a/Natsurainko.FluentLauncher/Views/OOBE/MinecraftFolderPage.xaml
+++ b/Natsurainko.FluentLauncher/Views/OOBE/MinecraftFolderPage.xaml
@@ -3,146 +3,95 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:i="using:Microsoft.Xaml.Interactions.Core"
xmlns:local="using:Natsurainko.FluentLauncher.Views.OOBE"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="using:Natsurainko.FluentLauncher.ViewModels.OOBE"
+ xmlns:xh="using:Natsurainko.FluentLauncher.Utils.Xaml"
mc:Ignorable="d">
-
+
-
-
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+ x:Name="removeBtn"
+ Width="16"
+ Height="16"
+ HorizontalAlignment="Right"
+ Background="Transparent"
+ BorderThickness="0"
+ Foreground="Red">
-
-
-
-
-
+ Glyph="" />
-
-
-
-
-
-
+
+
+
+
+
+
Date: Tue, 12 Sep 2023 11:35:25 +0800
Subject: [PATCH 06/22] Redesign JavaPage
---
.../ViewModels/OOBE/OOBEViewModel.cs | 31 ++-
.../Views/OOBE/JavaPage.xaml | 249 +++++++++---------
.../Views/OOBE/MinecraftFolderPage.xaml | 56 ++--
.../Views/OOBE/OOBENavigationPage.xaml | 10 +-
4 files changed, 184 insertions(+), 162 deletions(-)
diff --git a/Natsurainko.FluentLauncher/ViewModels/OOBE/OOBEViewModel.cs b/Natsurainko.FluentLauncher/ViewModels/OOBE/OOBEViewModel.cs
index 7931f1ff..c1572be8 100644
--- a/Natsurainko.FluentLauncher/ViewModels/OOBE/OOBEViewModel.cs
+++ b/Natsurainko.FluentLauncher/ViewModels/OOBE/OOBEViewModel.cs
@@ -93,12 +93,11 @@ public void Next()
// Language page
0 => Languages.Contains(CurrentLanguage),
// Minecraft folder page
- 1 => !string.IsNullOrEmpty(ActiveMinecraftFolder) &&
- !string.IsNullOrEmpty(ActiveJava) &&
- Directory.Exists(ActiveMinecraftFolder) &&
- File.Exists(ActiveJava),
+ 1 => !string.IsNullOrEmpty(ActiveMinecraftFolder),
// Java page
- 2 => true, // TODO:
+ 2 => !string.IsNullOrEmpty(ActiveJavaRuntime) &&
+ Directory.Exists(ActiveMinecraftFolder) &&
+ File.Exists(ActiveJavaRuntime),
// Account page
3 => ActiveAccount is not null,
// Get started page
@@ -163,7 +162,7 @@ public void NavigateTo(int pageIndex)
private string activeMinecraftFolder;
[RelayCommand]
- public Task BrowserFolder() => Task.Run(async () =>
+ public Task BrowseFolder() => Task.Run(async () =>
{
var folderPicker = new FolderPicker();
@@ -192,18 +191,18 @@ public void NavigateTo(int pageIndex)
#region Java
[BindToSetting(Path = nameof(SettingsService.Javas))]
- public ObservableCollection Javas { get; private set; }
+ public ObservableCollection JavaRuntimes { get; private set; }
[ObservableProperty]
[BindToSetting(Path = nameof(SettingsService.ActiveJava))]
[NotifyCanExecuteChangedFor(nameof(NextCommand))]
- private string activeJava;
+ private string activeJavaRuntime;
[ObservableProperty]
private bool javaDropDownOpen;
[RelayCommand]
- public Task BrowserJava() => Task.Run(async () =>
+ public Task BrowseJava() => Task.Run(async () =>
{
var filePicker = new FileOpenPicker();
@@ -216,10 +215,10 @@ public void NavigateTo(int pageIndex)
if (file != null)
App.DispatcherQueue.TryEnqueue(() =>
{
- Javas.Add(file.Path);
- OnPropertyChanged(nameof(Javas));
+ JavaRuntimes.Add(file.Path);
+ OnPropertyChanged(nameof(JavaRuntimes));
- ActiveJava = file.Path;
+ ActiveJavaRuntime = file.Path;
});
});
@@ -227,12 +226,12 @@ public void NavigateTo(int pageIndex)
public void SearchJava()
{
foreach (var java in JavaUtils.SearchJava())
- if (!Javas.Contains(java))
- Javas.Add(java);
+ if (!JavaRuntimes.Contains(java))
+ JavaRuntimes.Add(java);
- ActiveJava = Javas.Any() ? Javas[0] : null;
+ ActiveJavaRuntime = JavaRuntimes.Any() ? JavaRuntimes[0] : null;
- OnPropertyChanged(nameof(Javas));
+ OnPropertyChanged(nameof(JavaRuntimes));
JavaDropDownOpen = true;
_notificationService.NotifyWithoutContent("Added the search Java to the runtime list", icon: "\uE73E");
diff --git a/Natsurainko.FluentLauncher/Views/OOBE/JavaPage.xaml b/Natsurainko.FluentLauncher/Views/OOBE/JavaPage.xaml
index b226da73..2cd9adc1 100644
--- a/Natsurainko.FluentLauncher/Views/OOBE/JavaPage.xaml
+++ b/Natsurainko.FluentLauncher/Views/OOBE/JavaPage.xaml
@@ -3,146 +3,147 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:i="using:Microsoft.Xaml.Interactions.Core"
xmlns:local="using:Natsurainko.FluentLauncher.Views.OOBE"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="using:Natsurainko.FluentLauncher.ViewModels.OOBE"
+ xmlns:xh="using:Natsurainko.FluentLauncher.Utils.Xaml"
mc:Ignorable="d">
-
+
-
-
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ VerticalAlignment="Center"
+ Source="/Assets/Icons/java_logo.png" />
+
+
+
+ Glyph="" />
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+ Spacing="14">
+ Text="Minecraft Data Folders" />
-
-
-
-
-
-
+ Orientation="Horizontal"
+ Spacing="8">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -48,7 +48,7 @@
@@ -101,15 +101,17 @@
Spacing="16">
+ FontWeight="SemiBold">
+ Style="{ThemeResource AccentButtonStyle}">
From 6717d57ec9591c9de9b2df1d284282c85d8020c9 Mon Sep 17 00:00:00 2001
From: gaviny82 <38808970+gaviny82@users.noreply.github.com>
Date: Tue, 12 Sep 2023 12:15:52 +0800
Subject: [PATCH 07/22] Update translation
---
.../Views/OOBE/JavaPage.xaml | 19 +++---
.../Views/OOBE/MinecraftFolderPage.xaml | 17 +++---
.../Views/OOBE/OOBENavigationPage.xaml | 60 +++++++------------
3 files changed, 38 insertions(+), 58 deletions(-)
diff --git a/Natsurainko.FluentLauncher/Views/OOBE/JavaPage.xaml b/Natsurainko.FluentLauncher/Views/OOBE/JavaPage.xaml
index 2cd9adc1..3c06dfed 100644
--- a/Natsurainko.FluentLauncher/Views/OOBE/JavaPage.xaml
+++ b/Natsurainko.FluentLauncher/Views/OOBE/JavaPage.xaml
@@ -37,8 +37,8 @@
Spacing="14">
@@ -47,9 +47,11 @@
Orientation="Horizontal"
Spacing="8">
+ Style="{ThemeResource AccentButtonStyle}"
+ ToolTipService.ToolTip="Detect Java runtimes installed">
-
+
+ Style="{ThemeResource AccentButtonStyle}"
+ ToolTipService.ToolTip="Add a javaw.exe manually">
-
+
@@ -150,9 +154,6 @@
VerticalAlignment="Center"
FontWeight="SemiBold"
Foreground="{ThemeResource ApplicationSecondaryForegroundThemeBrush}">
-
-
-
diff --git a/Natsurainko.FluentLauncher/Views/OOBE/MinecraftFolderPage.xaml b/Natsurainko.FluentLauncher/Views/OOBE/MinecraftFolderPage.xaml
index b1b58990..8d262274 100644
--- a/Natsurainko.FluentLauncher/Views/OOBE/MinecraftFolderPage.xaml
+++ b/Natsurainko.FluentLauncher/Views/OOBE/MinecraftFolderPage.xaml
@@ -37,8 +37,8 @@
Spacing="14">
@@ -47,6 +47,7 @@
Orientation="Horizontal"
Spacing="8">
-
+
@@ -74,7 +76,7 @@
FontSize="16"
Foreground="White"
Glyph="" />
-
+
@@ -119,13 +121,10 @@
FontWeight="SemiBold"
Foreground="{ThemeResource ApplicationSecondaryForegroundThemeBrush}">
-
-
-
-
+
-
+
diff --git a/Natsurainko.FluentLauncher/Views/OOBE/OOBENavigationPage.xaml b/Natsurainko.FluentLauncher/Views/OOBE/OOBENavigationPage.xaml
index 386713ab..047c716c 100644
--- a/Natsurainko.FluentLauncher/Views/OOBE/OOBENavigationPage.xaml
+++ b/Natsurainko.FluentLauncher/Views/OOBE/OOBENavigationPage.xaml
@@ -24,64 +24,44 @@
IsSettingsVisible="False"
ItemInvoked="NavigationViewControl_ItemInvoked"
PaneDisplayMode="Top">
+
+
+
-
-
-
-
+ Tag="OOBELanguagePage" />
-
-
-
-
+ Tag="OOBEMinecraftFolderPage" />
-
-
-
-
+ Tag="OOBEJavaPage" />
-
-
-
-
+ Tag="OOBEAccountPage" />
-
-
-
-
+ Tag="OOBEGetStartedPage" />
From 41577dcd48a46a798f6ebc004dd9749593036e58 Mon Sep 17 00:00:00 2001
From: gaviny82 <38808970+gaviny82@users.noreply.github.com>
Date: Tue, 12 Sep 2023 12:19:47 +0800
Subject: [PATCH 08/22] Update ListView template
---
Natsurainko.FluentLauncher/Views/OOBE/JavaPage.xaml | 3 ++-
.../Views/OOBE/MinecraftFolderPage.xaml | 10 +++++++++-
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/Natsurainko.FluentLauncher/Views/OOBE/JavaPage.xaml b/Natsurainko.FluentLauncher/Views/OOBE/JavaPage.xaml
index 3c06dfed..aae126be 100644
--- a/Natsurainko.FluentLauncher/Views/OOBE/JavaPage.xaml
+++ b/Natsurainko.FluentLauncher/Views/OOBE/JavaPage.xaml
@@ -101,6 +101,7 @@
+
@@ -129,7 +130,7 @@
-
+
+
+
+
+
Date: Tue, 12 Sep 2023 12:23:27 +0800
Subject: [PATCH 09/22] Update translation submodule
---
FluentLauncher.LocalizationPoroject | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/FluentLauncher.LocalizationPoroject b/FluentLauncher.LocalizationPoroject
index ceab22eb..90c4a4da 160000
--- a/FluentLauncher.LocalizationPoroject
+++ b/FluentLauncher.LocalizationPoroject
@@ -1 +1 @@
-Subproject commit ceab22eb2cc86e3a57955cc83d372175660a6970
+Subproject commit 90c4a4da5536baf54366b836d64ca6438b582ae6
From 09324748c416aa4145cb5884ba986f41c77ed5f9 Mon Sep 17 00:00:00 2001
From: gaviny82 <38808970+gaviny82@users.noreply.github.com>
Date: Tue, 12 Sep 2023 18:10:45 +0800
Subject: [PATCH 10/22] Get started page
---
FluentLauncher.LocalizationPoroject | 2 +-
.../ViewModels/OOBE/OOBEViewModel.cs | 20 ++++++++++++++++++-
.../Views/OOBE/GetStartedPage.xaml | 8 --------
.../Views/OOBE/OOBENavigationPage.xaml | 5 ++---
4 files changed, 22 insertions(+), 13 deletions(-)
diff --git a/FluentLauncher.LocalizationPoroject b/FluentLauncher.LocalizationPoroject
index 90c4a4da..15f64b48 160000
--- a/FluentLauncher.LocalizationPoroject
+++ b/FluentLauncher.LocalizationPoroject
@@ -1 +1 @@
-Subproject commit 90c4a4da5536baf54366b836d64ca6438b582ae6
+Subproject commit 15f64b48dab102bc42d7a592c367ed19d91a7dbb
diff --git a/Natsurainko.FluentLauncher/ViewModels/OOBE/OOBEViewModel.cs b/Natsurainko.FluentLauncher/ViewModels/OOBE/OOBEViewModel.cs
index c1572be8..13ae0a1b 100644
--- a/Natsurainko.FluentLauncher/ViewModels/OOBE/OOBEViewModel.cs
+++ b/Natsurainko.FluentLauncher/ViewModels/OOBE/OOBEViewModel.cs
@@ -63,6 +63,7 @@ internal partial class OOBEViewModel : ObservableRecipient, INavigationAware, IS
[ObservableProperty]
[NotifyCanExecuteChangedFor(nameof(BackCommand))]
+ [NotifyPropertyChangedFor(nameof(NextText))]
int currentPageIndex;
private static readonly string[] OOBEPageKeys =
@@ -82,6 +83,12 @@ void INavigationAware.OnNavigatedTo(object parameter)
[RelayCommand(CanExecute = nameof(CanNext))]
public void Next()
{
+ if (CurrentPageIndex == OOBEPageKeys.Length - 1)
+ {
+ Start();
+ return;
+ }
+
CurrentPageIndex++;
_navigationService.NavigateTo(OOBEPageKeys[CurrentPageIndex]);
BackCommand.NotifyCanExecuteChanged();
@@ -101,7 +108,7 @@ public void Next()
// Account page
3 => ActiveAccount is not null,
// Get started page
- 4 => false,
+ 4 => true,
// Default
_ => false,
};
@@ -268,6 +275,17 @@ public void Login(Button parameter)
#endregion
+ public string NextText
+ {
+ get
+ {
+ if (CurrentPageIndex == OOBEPageKeys.Length - 1)
+ return ResourceUtils.GetValue("OOBE_OOBEViewModel__ButtonGetStarted");
+ else
+ return ResourceUtils.GetValue("OOBE_OOBEViewModel__ButtonNext");
+ }
+ }
+
[RelayCommand]
public void Start()
{
diff --git a/Natsurainko.FluentLauncher/Views/OOBE/GetStartedPage.xaml b/Natsurainko.FluentLauncher/Views/OOBE/GetStartedPage.xaml
index f333e605..797b4bca 100644
--- a/Natsurainko.FluentLauncher/Views/OOBE/GetStartedPage.xaml
+++ b/Natsurainko.FluentLauncher/Views/OOBE/GetStartedPage.xaml
@@ -28,14 +28,6 @@
Text="You have all the basic settings done" />
-
-
-
-
diff --git a/Natsurainko.FluentLauncher/Views/OOBE/OOBENavigationPage.xaml b/Natsurainko.FluentLauncher/Views/OOBE/OOBENavigationPage.xaml
index 047c716c..12153e00 100644
--- a/Natsurainko.FluentLauncher/Views/OOBE/OOBENavigationPage.xaml
+++ b/Natsurainko.FluentLauncher/Views/OOBE/OOBENavigationPage.xaml
@@ -90,10 +90,9 @@
MinWidth="85"
Click="NextButton_Click"
Command="{Binding NextCommand}"
+ Content="{Binding NextText}"
FontWeight="SemiBold"
- Style="{ThemeResource AccentButtonStyle}">
-
-
+ Style="{ThemeResource AccentButtonStyle}" />
From 11d25b4e4e12491ba62236c7a8df9289723bf430 Mon Sep 17 00:00:00 2001
From: gaviny82 <38808970+gaviny82@users.noreply.github.com>
Date: Tue, 12 Sep 2023 18:21:45 +0800
Subject: [PATCH 11/22] Update translation
---
FluentLauncher.LocalizationPoroject | 2 +-
Natsurainko.FluentLauncher/Views/OOBE/OOBENavigationPage.xaml | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/FluentLauncher.LocalizationPoroject b/FluentLauncher.LocalizationPoroject
index 15f64b48..6a4cee18 160000
--- a/FluentLauncher.LocalizationPoroject
+++ b/FluentLauncher.LocalizationPoroject
@@ -1 +1 @@
-Subproject commit 15f64b48dab102bc42d7a592c367ed19d91a7dbb
+Subproject commit 6a4cee18b2341ee31b93046e88c9c17ec9bc3e13
diff --git a/Natsurainko.FluentLauncher/Views/OOBE/OOBENavigationPage.xaml b/Natsurainko.FluentLauncher/Views/OOBE/OOBENavigationPage.xaml
index 12153e00..1babf7fd 100644
--- a/Natsurainko.FluentLauncher/Views/OOBE/OOBENavigationPage.xaml
+++ b/Natsurainko.FluentLauncher/Views/OOBE/OOBENavigationPage.xaml
@@ -80,14 +80,14 @@
Orientation="Horizontal"
Spacing="16">
Date: Tue, 12 Sep 2023 18:59:01 +0800
Subject: [PATCH 12/22] Redesign accounts page
---
FluentLauncher.LocalizationPoroject | 2 +-
.../Views/OOBE/AccountPage.xaml | 240 +++++++++++-------
.../Views/OOBE/JavaPage.xaml | 8 +-
.../Views/OOBE/MinecraftFolderPage.xaml | 8 +-
4 files changed, 152 insertions(+), 106 deletions(-)
diff --git a/FluentLauncher.LocalizationPoroject b/FluentLauncher.LocalizationPoroject
index 6a4cee18..8714f32d 160000
--- a/FluentLauncher.LocalizationPoroject
+++ b/FluentLauncher.LocalizationPoroject
@@ -1 +1 @@
-Subproject commit 6a4cee18b2341ee31b93046e88c9c17ec9bc3e13
+Subproject commit 8714f32de42c7872a532b2dbdb0f5344c0abae9c
diff --git a/Natsurainko.FluentLauncher/Views/OOBE/AccountPage.xaml b/Natsurainko.FluentLauncher/Views/OOBE/AccountPage.xaml
index 3c8139d8..04caa6e4 100644
--- a/Natsurainko.FluentLauncher/Views/OOBE/AccountPage.xaml
+++ b/Natsurainko.FluentLauncher/Views/OOBE/AccountPage.xaml
@@ -2,114 +2,160 @@
x:Class="Natsurainko.FluentLauncher.Views.OOBE.AccountPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:behaviors="using:Natsurainko.FluentLauncher.Utils.Xaml.Behaviors"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:i="using:Microsoft.Xaml.Interactivity"
xmlns:local="using:Natsurainko.FluentLauncher.Views.OOBE"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="using:Natsurainko.FluentLauncher.ViewModels.OOBE"
d:DataContext="{d:DesignInstance vm:OOBEViewModel}"
mc:Ignorable="d">
-
+
-
-
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Natsurainko.FluentLauncher/Views/OOBE/JavaPage.xaml b/Natsurainko.FluentLauncher/Views/OOBE/JavaPage.xaml
index aae126be..a9523cc7 100644
--- a/Natsurainko.FluentLauncher/Views/OOBE/JavaPage.xaml
+++ b/Natsurainko.FluentLauncher/Views/OOBE/JavaPage.xaml
@@ -57,8 +57,8 @@
Orientation="Horizontal"
Spacing="4">
@@ -75,8 +75,8 @@
Orientation="Horizontal"
Spacing="4">
diff --git a/Natsurainko.FluentLauncher/Views/OOBE/MinecraftFolderPage.xaml b/Natsurainko.FluentLauncher/Views/OOBE/MinecraftFolderPage.xaml
index 065eb4f5..0283d840 100644
--- a/Natsurainko.FluentLauncher/Views/OOBE/MinecraftFolderPage.xaml
+++ b/Natsurainko.FluentLauncher/Views/OOBE/MinecraftFolderPage.xaml
@@ -55,8 +55,8 @@
Orientation="Horizontal"
Spacing="4">
@@ -72,8 +72,8 @@
Orientation="Horizontal"
Spacing="4">
From 7ce61905b84c64579ec4969557656a441d65881c Mon Sep 17 00:00:00 2001
From: gaviny82 <38808970+gaviny82@users.noreply.github.com>
Date: Tue, 12 Sep 2023 19:24:29 +0800
Subject: [PATCH 13/22] Detect official .minecraft folder
---
.../ViewModels/OOBE/OOBEViewModel.cs | 31 ++++++++++++++++---
.../Views/OOBE/MinecraftFolderPage.xaml | 1 +
2 files changed, 28 insertions(+), 4 deletions(-)
diff --git a/Natsurainko.FluentLauncher/ViewModels/OOBE/OOBEViewModel.cs b/Natsurainko.FluentLauncher/ViewModels/OOBE/OOBEViewModel.cs
index 13ae0a1b..21085d88 100644
--- a/Natsurainko.FluentLauncher/ViewModels/OOBE/OOBEViewModel.cs
+++ b/Natsurainko.FluentLauncher/ViewModels/OOBE/OOBEViewModel.cs
@@ -193,6 +193,33 @@ public void NavigateTo(int pageIndex)
});
});
+
+ private readonly string OfficialLauncherPath = $@"{Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)}\.minecraft";
+
+ [RelayCommand]
+ public void DetectOfficialMinecraftFolder()
+ {
+ // Official launcher .minecraft folder not exist
+ if (!Directory.Exists(OfficialLauncherPath))
+ {
+ _notificationService.NotifyMessage("Cannot add the official Minecraft Launcher data folder", $"{OfficialLauncherPath} does not exist.", icon: "\uF89A");
+ return;
+ }
+
+ // Already added
+ if (MinecraftFolders.Contains(OfficialLauncherPath))
+ {
+ _notificationService.NotifyMessage("Already added the official Minecraft Launcher data folder", $"{OfficialLauncherPath} has already been added.", icon: "\uF89A");
+ return;
+ }
+
+ // Add to list
+ MinecraftFolders.Add(OfficialLauncherPath);
+ _gameService.ActivateMinecraftFolder(OfficialLauncherPath);
+ ActiveMinecraftFolder = OfficialLauncherPath;
+ _notificationService.NotifyMessage("Official Minecraft Launcher data folder added", $"{OfficialLauncherPath} has been added to Fluent Launcher.", icon: "\uE73E");
+ }
+
#endregion
#region Java
@@ -205,9 +232,6 @@ public void NavigateTo(int pageIndex)
[NotifyCanExecuteChangedFor(nameof(NextCommand))]
private string activeJavaRuntime;
- [ObservableProperty]
- private bool javaDropDownOpen;
-
[RelayCommand]
public Task BrowseJava() => Task.Run(async () =>
{
@@ -240,7 +264,6 @@ public void SearchJava()
OnPropertyChanged(nameof(JavaRuntimes));
- JavaDropDownOpen = true;
_notificationService.NotifyWithoutContent("Added the search Java to the runtime list", icon: "\uE73E");
}
diff --git a/Natsurainko.FluentLauncher/Views/OOBE/MinecraftFolderPage.xaml b/Natsurainko.FluentLauncher/Views/OOBE/MinecraftFolderPage.xaml
index 0283d840..a381a16b 100644
--- a/Natsurainko.FluentLauncher/Views/OOBE/MinecraftFolderPage.xaml
+++ b/Natsurainko.FluentLauncher/Views/OOBE/MinecraftFolderPage.xaml
@@ -49,6 +49,7 @@
Date: Tue, 12 Sep 2023 19:29:33 +0800
Subject: [PATCH 14/22] Adjust card widths
---
Natsurainko.FluentLauncher/Views/OOBE/AccountPage.xaml | 2 +-
Natsurainko.FluentLauncher/Views/OOBE/JavaPage.xaml | 7 +++++--
.../Views/OOBE/MinecraftFolderPage.xaml | 7 +++++--
3 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/Natsurainko.FluentLauncher/Views/OOBE/AccountPage.xaml b/Natsurainko.FluentLauncher/Views/OOBE/AccountPage.xaml
index 04caa6e4..9a2b330c 100644
--- a/Natsurainko.FluentLauncher/Views/OOBE/AccountPage.xaml
+++ b/Natsurainko.FluentLauncher/Views/OOBE/AccountPage.xaml
@@ -13,7 +13,7 @@
-
+
diff --git a/Natsurainko.FluentLauncher/Views/OOBE/JavaPage.xaml b/Natsurainko.FluentLauncher/Views/OOBE/JavaPage.xaml
index a9523cc7..ed0d98fe 100644
--- a/Natsurainko.FluentLauncher/Views/OOBE/JavaPage.xaml
+++ b/Natsurainko.FluentLauncher/Views/OOBE/JavaPage.xaml
@@ -12,9 +12,12 @@
-
+
-
+
-
+
-
+
Date: Tue, 12 Sep 2023 19:31:23 +0800
Subject: [PATCH 15/22] Adjust LanguagePage widths
---
Natsurainko.FluentLauncher/Views/OOBE/LanguagePage.xaml | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/Natsurainko.FluentLauncher/Views/OOBE/LanguagePage.xaml b/Natsurainko.FluentLauncher/Views/OOBE/LanguagePage.xaml
index ac6865b5..47987856 100644
--- a/Natsurainko.FluentLauncher/Views/OOBE/LanguagePage.xaml
+++ b/Natsurainko.FluentLauncher/Views/OOBE/LanguagePage.xaml
@@ -13,7 +13,7 @@
d:DataContext="{d:DesignInstance vm:OOBEViewModel}"
mc:Ignorable="d">
-
+
@@ -23,6 +23,7 @@
@@ -73,6 +74,7 @@
Date: Tue, 12 Sep 2023 23:20:04 +0800
Subject: [PATCH 16/22] Add folder icon on MinecraftFolderPage
---
.../Views/OOBE/MinecraftFolderPage.xaml | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/Natsurainko.FluentLauncher/Views/OOBE/MinecraftFolderPage.xaml b/Natsurainko.FluentLauncher/Views/OOBE/MinecraftFolderPage.xaml
index 0009b529..8eee89ab 100644
--- a/Natsurainko.FluentLauncher/Views/OOBE/MinecraftFolderPage.xaml
+++ b/Natsurainko.FluentLauncher/Views/OOBE/MinecraftFolderPage.xaml
@@ -97,18 +97,23 @@
SelectedItem="{Binding ActiveMinecraftFolder, Mode=TwoWay}">
-
+
+
+
Date: Sat, 16 Sep 2023 21:37:00 +0800
Subject: [PATCH 17/22] OOBE Pages Redesigned
---
.../Services/Settings/SettingsService.cs | 4 +-
.../Services/UI/AppearanceService.cs | 2 +-
.../Views/OOBE/AccountPage.xaml | 235 ++++++++---------
.../Views/OOBE/GetStartedPage.xaml | 33 +--
.../Views/OOBE/JavaPage.xaml | 248 ++++++++----------
.../Views/OOBE/JavaPage.xaml.cs | 14 +
.../Views/OOBE/LanguagePage.xaml | 133 +++++-----
.../Views/OOBE/MinecraftFolderPage.xaml | 226 +++++++---------
.../Views/OOBE/MinecraftFolderPage.xaml.cs | 14 +
.../Views/OOBE/OOBENavigationPage.xaml | 57 ++--
.../Views/OOBE/OOBENavigationPage.xaml.cs | 2 +
.../Views/ShellPage.xaml | 3 +
12 files changed, 454 insertions(+), 517 deletions(-)
diff --git a/Natsurainko.FluentLauncher/Services/Settings/SettingsService.cs b/Natsurainko.FluentLauncher/Services/Settings/SettingsService.cs
index bebec5cd..a9309755 100644
--- a/Natsurainko.FluentLauncher/Services/Settings/SettingsService.cs
+++ b/Natsurainko.FluentLauncher/Services/Settings/SettingsService.cs
@@ -48,9 +48,9 @@ public partial class SettingsService : SettingsContainer, IFluentCoreSettingsSer
[SettingItem(typeof(string), "CurrentLanguage", Default = "en-US, English", Converter = typeof(JsonStringConverter))] // TODO: remove default value; set to system language if null
[SettingItem(typeof(int), "NavigationViewDisplayMode", Default = 0, Converter = typeof(JsonStringConverter))]
- [SettingItem(typeof(int), "DisplayTheme", Default = 0, Converter = typeof(JsonStringConverter))]
+ [SettingItem(typeof(int), "DisplayTheme", Default = 1, Converter = typeof(JsonStringConverter))]
[SettingItem(typeof(int), "BackgroundMode", Default = 0, Converter = typeof(JsonStringConverter))]
- [SettingItem(typeof(bool), "UseNewHomePage", Default = false, Converter = typeof(JsonStringConverter))]
+ [SettingItem(typeof(bool), "UseNewHomePage", Default = true, Converter = typeof(JsonStringConverter))]
[SettingItem(typeof(double), "TintLuminosityOpacity", Default = 0.64, Converter = typeof(JsonStringConverter))]
[SettingItem(typeof(double), "TintOpacity", Default = 0, Converter = typeof(JsonStringConverter))]
[SettingItem(typeof(bool), "EnableDefaultAcrylicBrush", Default = true, Converter = typeof(JsonStringConverter))]
diff --git a/Natsurainko.FluentLauncher/Services/UI/AppearanceService.cs b/Natsurainko.FluentLauncher/Services/UI/AppearanceService.cs
index 21346ffc..7a61d92d 100644
--- a/Natsurainko.FluentLauncher/Services/UI/AppearanceService.cs
+++ b/Natsurainko.FluentLauncher/Services/UI/AppearanceService.cs
@@ -71,7 +71,7 @@ public void ApplyBackgroundBeforePageInit(ShellPage page)
if (File.Exists(_settingsService.ImageFilePath))
{
page.Resources.Add("NavigationViewContentBackground", new SolidColorBrush(Colors.Transparent));
- page.Resources.Add("NavigationViewContentGridCornerRadius", new CornerRadius(0));
+ //page.Resources.Add("NavigationViewContentGridCornerRadius", new CornerRadius(0));
page.Resources.Add("NavigationViewContentGridBorderThickness", new Thickness(0));
using var fileStream = File.OpenRead(_settingsService.ImageFilePath);
diff --git a/Natsurainko.FluentLauncher/Views/OOBE/AccountPage.xaml b/Natsurainko.FluentLauncher/Views/OOBE/AccountPage.xaml
index 9a2b330c..0b02811e 100644
--- a/Natsurainko.FluentLauncher/Views/OOBE/AccountPage.xaml
+++ b/Natsurainko.FluentLauncher/Views/OOBE/AccountPage.xaml
@@ -11,151 +11,126 @@
d:DataContext="{d:DesignInstance vm:OOBEViewModel}"
mc:Ignorable="d">
-
+
-
-
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ TextTrimming="CharacterEllipsis"
+ TextWrapping="NoWrap" />
+
+
+
+
+
+
+
+
+
+
diff --git a/Natsurainko.FluentLauncher/Views/OOBE/GetStartedPage.xaml b/Natsurainko.FluentLauncher/Views/OOBE/GetStartedPage.xaml
index 797b4bca..96fea963 100644
--- a/Natsurainko.FluentLauncher/Views/OOBE/GetStartedPage.xaml
+++ b/Natsurainko.FluentLauncher/Views/OOBE/GetStartedPage.xaml
@@ -9,25 +9,20 @@
d:DataContext="{d:DesignInstance vm:OOBEViewModel}"
mc:Ignorable="d">
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
diff --git a/Natsurainko.FluentLauncher/Views/OOBE/JavaPage.xaml b/Natsurainko.FluentLauncher/Views/OOBE/JavaPage.xaml
index ed0d98fe..86bfd6dd 100644
--- a/Natsurainko.FluentLauncher/Views/OOBE/JavaPage.xaml
+++ b/Natsurainko.FluentLauncher/Views/OOBE/JavaPage.xaml
@@ -2,6 +2,7 @@
x:Class="Natsurainko.FluentLauncher.Views.OOBE.JavaPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:animatedvisuals="using:Microsoft.UI.Xaml.Controls.AnimatedVisuals"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:i="using:Microsoft.Xaml.Interactions.Core"
xmlns:local="using:Natsurainko.FluentLauncher.Views.OOBE"
@@ -10,160 +11,121 @@
xmlns:xh="using:Natsurainko.FluentLauncher.Utils.Xaml"
mc:Ignorable="d">
-
+
-
-
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ TextTrimming="CharacterEllipsis"
+ TextWrapping="NoWrap" />
+
+
+
+
+
+
+
+
+
+
diff --git a/Natsurainko.FluentLauncher/Views/OOBE/JavaPage.xaml.cs b/Natsurainko.FluentLauncher/Views/OOBE/JavaPage.xaml.cs
index 36ced655..75194a18 100644
--- a/Natsurainko.FluentLauncher/Views/OOBE/JavaPage.xaml.cs
+++ b/Natsurainko.FluentLauncher/Views/OOBE/JavaPage.xaml.cs
@@ -8,4 +8,18 @@ public JavaPage()
{
InitializeComponent();
}
+
+ private void Grid_PointerEntered(object sender, Microsoft.UI.Xaml.Input.PointerRoutedEventArgs e)
+ {
+ var grid = sender as Grid;
+ var button = grid.FindName("DeleteButton") as Button;
+ button.Visibility = Microsoft.UI.Xaml.Visibility.Visible;
+ }
+
+ private void Grid_PointerExited(object sender, Microsoft.UI.Xaml.Input.PointerRoutedEventArgs e)
+ {
+ var grid = sender as Grid;
+ var button = grid.FindName("DeleteButton") as Button;
+ button.Visibility = Microsoft.UI.Xaml.Visibility.Collapsed;
+ }
}
diff --git a/Natsurainko.FluentLauncher/Views/OOBE/LanguagePage.xaml b/Natsurainko.FluentLauncher/Views/OOBE/LanguagePage.xaml
index 47987856..f02cf184 100644
--- a/Natsurainko.FluentLauncher/Views/OOBE/LanguagePage.xaml
+++ b/Natsurainko.FluentLauncher/Views/OOBE/LanguagePage.xaml
@@ -13,79 +13,70 @@
d:DataContext="{d:DesignInstance vm:OOBEViewModel}"
mc:Ignorable="d">
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+ BorderBrush="{ThemeResource IconBorder}"
+ BorderThickness="3"
+ CornerRadius="8">
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
diff --git a/Natsurainko.FluentLauncher/Views/OOBE/MinecraftFolderPage.xaml b/Natsurainko.FluentLauncher/Views/OOBE/MinecraftFolderPage.xaml
index 8eee89ab..73e320f2 100644
--- a/Natsurainko.FluentLauncher/Views/OOBE/MinecraftFolderPage.xaml
+++ b/Natsurainko.FluentLauncher/Views/OOBE/MinecraftFolderPage.xaml
@@ -2,6 +2,7 @@
x:Class="Natsurainko.FluentLauncher.Views.OOBE.MinecraftFolderPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:animatedvisuals="using:Microsoft.UI.Xaml.Controls.AnimatedVisuals"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:i="using:Microsoft.Xaml.Interactions.Core"
xmlns:local="using:Natsurainko.FluentLauncher.Views.OOBE"
@@ -10,139 +11,110 @@
xmlns:xh="using:Natsurainko.FluentLauncher.Utils.Xaml"
mc:Ignorable="d">
-
+
-
-
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ Width="300"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Natsurainko.FluentLauncher/Views/OOBE/MinecraftFolderPage.xaml.cs b/Natsurainko.FluentLauncher/Views/OOBE/MinecraftFolderPage.xaml.cs
index fbc86ebf..c4a98d4f 100644
--- a/Natsurainko.FluentLauncher/Views/OOBE/MinecraftFolderPage.xaml.cs
+++ b/Natsurainko.FluentLauncher/Views/OOBE/MinecraftFolderPage.xaml.cs
@@ -8,4 +8,18 @@ public MinecraftFolderPage()
{
InitializeComponent();
}
+
+ private void Grid_PointerEntered(object sender, Microsoft.UI.Xaml.Input.PointerRoutedEventArgs e)
+ {
+ var grid = sender as Grid;
+ var button = grid.FindName("DeleteButton") as Button;
+ button.Visibility = Microsoft.UI.Xaml.Visibility.Visible;
+ }
+
+ private void Grid_PointerExited(object sender, Microsoft.UI.Xaml.Input.PointerRoutedEventArgs e)
+ {
+ var grid = sender as Grid;
+ var button = grid.FindName("DeleteButton") as Button;
+ button.Visibility = Microsoft.UI.Xaml.Visibility.Collapsed;
+ }
}
diff --git a/Natsurainko.FluentLauncher/Views/OOBE/OOBENavigationPage.xaml b/Natsurainko.FluentLauncher/Views/OOBE/OOBENavigationPage.xaml
index 1babf7fd..5172fb01 100644
--- a/Natsurainko.FluentLauncher/Views/OOBE/OOBENavigationPage.xaml
+++ b/Natsurainko.FluentLauncher/Views/OOBE/OOBENavigationPage.xaml
@@ -9,17 +9,28 @@
xmlns:xh="using:Natsurainko.FluentLauncher.Utils.Xaml"
d:DataContext="{d:DesignInstance vm:OOBEViewModel}"
mc:Ignorable="d">
+
+ 0
+
-
+
-
+
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+ Command="{Binding BackCommand}">
-
+
diff --git a/Natsurainko.FluentLauncher/Views/OOBE/OOBENavigationPage.xaml.cs b/Natsurainko.FluentLauncher/Views/OOBE/OOBENavigationPage.xaml.cs
index 4aa91b65..f803f1a1 100644
--- a/Natsurainko.FluentLauncher/Views/OOBE/OOBENavigationPage.xaml.cs
+++ b/Natsurainko.FluentLauncher/Views/OOBE/OOBENavigationPage.xaml.cs
@@ -1,5 +1,7 @@
+using Microsoft.UI;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Media;
using Microsoft.UI.Xaml.Media.Animation;
using Microsoft.UI.Xaml.Navigation;
using Natsurainko.FluentLauncher.Services.UI.Navigation;
diff --git a/Natsurainko.FluentLauncher/Views/ShellPage.xaml b/Natsurainko.FluentLauncher/Views/ShellPage.xaml
index 4ec550b8..2822a4a1 100644
--- a/Natsurainko.FluentLauncher/Views/ShellPage.xaml
+++ b/Natsurainko.FluentLauncher/Views/ShellPage.xaml
@@ -11,6 +11,9 @@
Loaded="Page_Loaded"
SizeChanged="Page_SizeChanged"
mc:Ignorable="d">
+
+ 0
+
Date: Sat, 16 Sep 2023 23:43:53 +0800
Subject: [PATCH 18/22] OOBE Localization
---
FluentLauncher.LocalizationPoroject | 2 +-
.../Dictionaries/NotifyStyleDictionary.xaml | 25 ++++------
.../AuthenticationWizardDialogViewModel.cs | 2 +-
.../ViewModels/OOBE/OOBEViewModel.cs | 46 ++++++++++++++++---
.../ViewModels/Settings/LaunchViewModel.cs | 11 ++++-
.../Views/OOBE/AccountPage.xaml | 24 +++++-----
.../Views/OOBE/GetStartedPage.xaml | 6 ++-
.../Views/OOBE/JavaPage.xaml | 30 +++++++-----
.../Views/OOBE/LanguagePage.xaml | 19 ++++----
.../Views/OOBE/MinecraftFolderPage.xaml | 24 ++++++----
.../Views/OOBE/OOBENavigationPage.xaml | 7 +--
11 files changed, 119 insertions(+), 77 deletions(-)
diff --git a/FluentLauncher.LocalizationPoroject b/FluentLauncher.LocalizationPoroject
index 8714f32d..8a927c34 160000
--- a/FluentLauncher.LocalizationPoroject
+++ b/FluentLauncher.LocalizationPoroject
@@ -1 +1 @@
-Subproject commit 8714f32de42c7872a532b2dbdb0f5344c0abae9c
+Subproject commit 8a927c3453f50a62fe2fb18a09c7247312a835ee
diff --git a/Natsurainko.FluentLauncher/Dictionaries/NotifyStyleDictionary.xaml b/Natsurainko.FluentLauncher/Dictionaries/NotifyStyleDictionary.xaml
index 81c11add..b354dba9 100644
--- a/Natsurainko.FluentLauncher/Dictionaries/NotifyStyleDictionary.xaml
+++ b/Natsurainko.FluentLauncher/Dictionaries/NotifyStyleDictionary.xaml
@@ -9,15 +9,10 @@
MinWidth="100"
MinHeight="75"
MaxWidth="500"
- BorderBrush="{ThemeResource CardStrokeColorDefaultBrush}"
+ Background="{ThemeResource SolidBackgroundFillColorTertiaryBrush}"
+ BorderBrush="{ThemeResource SurfaceStrokeColorDefaultBrush}"
BorderThickness="1"
CornerRadius="8">
-
-
-
@@ -70,15 +65,10 @@
-
-
-
@@ -115,11 +105,12 @@
-
+
+ Text="{Binding Description}"
+ TextWrapping="WrapWholeWords" />
@@ -151,7 +142,7 @@
-
+
diff --git a/Natsurainko.FluentLauncher/ViewModels/Common/AuthenticationWizardDialogViewModel.cs b/Natsurainko.FluentLauncher/ViewModels/Common/AuthenticationWizardDialogViewModel.cs
index 0ee94d65..8522febb 100644
--- a/Natsurainko.FluentLauncher/ViewModels/Common/AuthenticationWizardDialogViewModel.cs
+++ b/Natsurainko.FluentLauncher/ViewModels/Common/AuthenticationWizardDialogViewModel.cs
@@ -106,7 +106,7 @@ private void Finish()
_dialog.Hide();
_notificationService.NotifyWithSpecialContent(
- $"Added Successfully",
+ ResourceUtils.GetValue("Notifications", "_AccountAddSuccessful"),
"AuthenticationSuccessfulNotifyTemplate",
account, "\uE73E");
}
diff --git a/Natsurainko.FluentLauncher/ViewModels/OOBE/OOBEViewModel.cs b/Natsurainko.FluentLauncher/ViewModels/OOBE/OOBEViewModel.cs
index 21085d88..b0fe1902 100644
--- a/Natsurainko.FluentLauncher/ViewModels/OOBE/OOBEViewModel.cs
+++ b/Natsurainko.FluentLauncher/ViewModels/OOBE/OOBEViewModel.cs
@@ -3,7 +3,6 @@
using CommunityToolkit.Mvvm.Input;
using CommunityToolkit.Mvvm.Messaging;
using Microsoft.UI.Xaml.Controls;
-using Microsoft.UI.Xaml.Media.Animation;
using Natsurainko.FluentLauncher.Services.Accounts;
using Natsurainko.FluentLauncher.Services.Launch;
using Natsurainko.FluentLauncher.Services.Settings;
@@ -20,6 +19,7 @@
using System.IO;
using System.Linq;
using System.Threading.Tasks;
+using Windows.ApplicationModel;
using Windows.Storage.Pickers;
namespace Natsurainko.FluentLauncher.ViewModels.OOBE;
@@ -150,6 +150,18 @@ public void NavigateTo(int pageIndex)
public List Languages { get; } = ResourceUtils.Languages;
+ public string Version { get; } = string.Format("{0}.{1}.{2}.{3}",
+ Package.Current.Id.Version.Major,
+ Package.Current.Id.Version.Minor,
+ Package.Current.Id.Version.Build,
+ Package.Current.Id.Version.Revision);
+
+#if DEBUG
+ public string Edition { get; } = ResourceUtils.GetValue("Settings", "AboutPage", "_Debug");
+#else
+ public string Edition { get; } = ResourceUtils.GetValue("Settings", "AboutPage", "_Release");
+#endif
+
partial void OnCurrentLanguageChanged(string oldValue, string newValue)
{
if (Languages.Contains(CurrentLanguage) && oldValue is not null) // oldValue is null at startup
@@ -184,7 +196,11 @@ public void NavigateTo(int pageIndex)
{
if (MinecraftFolders.Contains(folder.Path))
{
- _notificationService.NotifyMessage("Failed to add the folder", "This folder already exists", icon: "\uF89A");
+ _notificationService.NotifyMessage(
+ ResourceUtils.GetValue("Notifications", "_AddFolderExistedT"),
+ ResourceUtils.GetValue("Notifications", "_AddFolderExistedD"),
+ icon: "\uF89A");
+
return;
}
@@ -202,14 +218,22 @@ public void DetectOfficialMinecraftFolder()
// Official launcher .minecraft folder not exist
if (!Directory.Exists(OfficialLauncherPath))
{
- _notificationService.NotifyMessage("Cannot add the official Minecraft Launcher data folder", $"{OfficialLauncherPath} does not exist.", icon: "\uF89A");
+ _notificationService.NotifyMessage(
+ ResourceUtils.GetValue("Notifications", "_AddOfficialFolderNotExistT"),
+ ResourceUtils.GetValue("Notifications", "_AddOfficialFolderNotExistD").Replace("${path}", OfficialLauncherPath),
+ icon: "\uF89A");
+
return;
}
// Already added
if (MinecraftFolders.Contains(OfficialLauncherPath))
{
- _notificationService.NotifyMessage("Already added the official Minecraft Launcher data folder", $"{OfficialLauncherPath} has already been added.", icon: "\uF89A");
+ _notificationService.NotifyMessage(
+ ResourceUtils.GetValue("Notifications", "_AddOfficiaFolderExistedT"),
+ ResourceUtils.GetValue("Notifications", "_AddOfficiaFolderExistedD").Replace("${path}", OfficialLauncherPath),
+ icon: "\uF89A");
+
return;
}
@@ -217,7 +241,11 @@ public void DetectOfficialMinecraftFolder()
MinecraftFolders.Add(OfficialLauncherPath);
_gameService.ActivateMinecraftFolder(OfficialLauncherPath);
ActiveMinecraftFolder = OfficialLauncherPath;
- _notificationService.NotifyMessage("Official Minecraft Launcher data folder added", $"{OfficialLauncherPath} has been added to Fluent Launcher.", icon: "\uE73E");
+
+ _notificationService.NotifyMessage(
+ ResourceUtils.GetValue("Notifications", "_AddOfficiaFolderAddedT"),
+ ResourceUtils.GetValue("Notifications", "_AddOfficiaFolderAddedD").Replace("${path}", OfficialLauncherPath),
+ icon: "\uE73E");
}
#endregion
@@ -264,9 +292,15 @@ public void SearchJava()
OnPropertyChanged(nameof(JavaRuntimes));
- _notificationService.NotifyWithoutContent("Added the search Java to the runtime list", icon: "\uE73E");
+ _notificationService.NotifyWithoutContent(
+ ResourceUtils.GetValue("Notifications", "_AddSearchedJavaT"),
+ icon: "\uE73E");
}
+ [RelayCommand]
+ public void OpenJavaMirrorsDialog(HyperlinkButton parameter)
+ => _ = new JavaMirrorsDialog { XamlRoot = parameter.XamlRoot }.ShowAsync();
+
#endregion
#region Account
diff --git a/Natsurainko.FluentLauncher/ViewModels/Settings/LaunchViewModel.cs b/Natsurainko.FluentLauncher/ViewModels/Settings/LaunchViewModel.cs
index f8fa6ab0..da1ee8f0 100644
--- a/Natsurainko.FluentLauncher/ViewModels/Settings/LaunchViewModel.cs
+++ b/Natsurainko.FluentLauncher/ViewModels/Settings/LaunchViewModel.cs
@@ -6,6 +6,7 @@
using Natsurainko.FluentLauncher.Services.Settings;
using Natsurainko.FluentLauncher.Services.UI;
using Natsurainko.FluentLauncher.Services.UI.Navigation;
+using Natsurainko.FluentLauncher.Utils;
using Natsurainko.FluentLauncher.ViewModels.Common;
using Natsurainko.FluentLauncher.Views;
using Natsurainko.FluentLauncher.Views.Common;
@@ -124,7 +125,11 @@ protected override void OnPropertyChanged(PropertyChangedEventArgs e)
{
if (MinecraftFolders.Contains(folder.Path))
{
- _notificationService.NotifyMessage("Failed to add the folder", "This folder already exists", icon: "\uF89A");
+ _notificationService.NotifyMessage(
+ ResourceUtils.GetValue("Notifications", "_AddFolderExistedT"),
+ ResourceUtils.GetValue("Notifications", "_AddFolderExistedD"),
+ icon: "\uF89A");
+
return;
}
@@ -164,7 +169,9 @@ public void SearchJava()
OnPropertyChanged(nameof(Javas));
- _notificationService.NotifyWithoutContent("Added the search Java to the runtime list", icon: "\uE73E");
+ _notificationService.NotifyWithoutContent(
+ ResourceUtils.GetValue("Notifications", "_AddSearchedJavaT"),
+ icon: "\uE73E");
}
[RelayCommand]
diff --git a/Natsurainko.FluentLauncher/Views/OOBE/AccountPage.xaml b/Natsurainko.FluentLauncher/Views/OOBE/AccountPage.xaml
index 0b02811e..08e66c26 100644
--- a/Natsurainko.FluentLauncher/Views/OOBE/AccountPage.xaml
+++ b/Natsurainko.FluentLauncher/Views/OOBE/AccountPage.xaml
@@ -5,7 +5,6 @@
xmlns:behaviors="using:Natsurainko.FluentLauncher.Utils.Xaml.Behaviors"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:i="using:Microsoft.Xaml.Interactivity"
- xmlns:local="using:Natsurainko.FluentLauncher.Views.OOBE"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="using:Natsurainko.FluentLauncher.ViewModels.OOBE"
d:DataContext="{d:DesignInstance vm:OOBEViewModel}"
@@ -25,33 +24,31 @@
-
+
-
+
-
+
-
+
-
+
@@ -73,6 +70,7 @@
@@ -110,7 +108,7 @@
diff --git a/Natsurainko.FluentLauncher/Views/OOBE/GetStartedPage.xaml b/Natsurainko.FluentLauncher/Views/OOBE/GetStartedPage.xaml
index 96fea963..b44456f8 100644
--- a/Natsurainko.FluentLauncher/Views/OOBE/GetStartedPage.xaml
+++ b/Natsurainko.FluentLauncher/Views/OOBE/GetStartedPage.xaml
@@ -17,8 +17,12 @@
Spacing="20">
-
+
diff --git a/Natsurainko.FluentLauncher/Views/OOBE/JavaPage.xaml b/Natsurainko.FluentLauncher/Views/OOBE/JavaPage.xaml
index 86bfd6dd..ca2d8e22 100644
--- a/Natsurainko.FluentLauncher/Views/OOBE/JavaPage.xaml
+++ b/Natsurainko.FluentLauncher/Views/OOBE/JavaPage.xaml
@@ -4,11 +4,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:animatedvisuals="using:Microsoft.UI.Xaml.Controls.AnimatedVisuals"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:i="using:Microsoft.Xaml.Interactions.Core"
- xmlns:local="using:Natsurainko.FluentLauncher.Views.OOBE"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:vm="using:Natsurainko.FluentLauncher.ViewModels.OOBE"
- xmlns:xh="using:Natsurainko.FluentLauncher.Utils.Xaml"
mc:Ignorable="d">
@@ -25,20 +21,24 @@
-
+
-
+
-
+
@@ -51,17 +51,24 @@
-
+
-
+
-
+
-
+
@@ -73,6 +80,7 @@
diff --git a/Natsurainko.FluentLauncher/Views/OOBE/LanguagePage.xaml b/Natsurainko.FluentLauncher/Views/OOBE/LanguagePage.xaml
index f02cf184..1e4d1f75 100644
--- a/Natsurainko.FluentLauncher/Views/OOBE/LanguagePage.xaml
+++ b/Natsurainko.FluentLauncher/Views/OOBE/LanguagePage.xaml
@@ -2,14 +2,9 @@
x:Class="Natsurainko.FluentLauncher.Views.OOBE.LanguagePage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:behaviors="using:Natsurainko.FluentLauncher.Utils.Xaml.Behaviors"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:i="using:Microsoft.Xaml.Interactivity"
- xmlns:labs="using:CommunityToolkit.Labs.WinUI"
- xmlns:local="using:Natsurainko.FluentLauncher.Views.OOBE"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="using:Natsurainko.FluentLauncher.ViewModels.OOBE"
- xmlns:xh="using:Natsurainko.FluentLauncher.Utils.Xaml"
d:DataContext="{d:DesignInstance vm:OOBEViewModel}"
mc:Ignorable="d">
@@ -44,10 +39,10 @@
Grid.Column="1"
Margin="16,0,0,0"
VerticalAlignment="Center">
-
+
+
+
+
-
+
@@ -25,15 +21,18 @@
-
+
-
+
-
+
@@ -53,13 +53,16 @@
-
+
-
+
-
+
@@ -73,6 +76,7 @@
diff --git a/Natsurainko.FluentLauncher/Views/OOBE/OOBENavigationPage.xaml b/Natsurainko.FluentLauncher/Views/OOBE/OOBENavigationPage.xaml
index 5172fb01..ad0a9905 100644
--- a/Natsurainko.FluentLauncher/Views/OOBE/OOBENavigationPage.xaml
+++ b/Natsurainko.FluentLauncher/Views/OOBE/OOBENavigationPage.xaml
@@ -3,7 +3,6 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:local="using:Natsurainko.FluentLauncher.Views.OOBE"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="using:Natsurainko.FluentLauncher.ViewModels.OOBE"
xmlns:xh="using:Natsurainko.FluentLauncher.Utils.Xaml"
@@ -29,7 +28,7 @@
-
-
-
+
Date: Sun, 17 Sep 2023 00:03:54 +0800
Subject: [PATCH 19/22] Update SettingsService.cs
---
.../Services/Settings/SettingsService.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Natsurainko.FluentLauncher/Services/Settings/SettingsService.cs b/Natsurainko.FluentLauncher/Services/Settings/SettingsService.cs
index a9309755..75f2bbeb 100644
--- a/Natsurainko.FluentLauncher/Services/Settings/SettingsService.cs
+++ b/Natsurainko.FluentLauncher/Services/Settings/SettingsService.cs
@@ -48,8 +48,8 @@ public partial class SettingsService : SettingsContainer, IFluentCoreSettingsSer
[SettingItem(typeof(string), "CurrentLanguage", Default = "en-US, English", Converter = typeof(JsonStringConverter))] // TODO: remove default value; set to system language if null
[SettingItem(typeof(int), "NavigationViewDisplayMode", Default = 0, Converter = typeof(JsonStringConverter))]
- [SettingItem(typeof(int), "DisplayTheme", Default = 1, Converter = typeof(JsonStringConverter))]
- [SettingItem(typeof(int), "BackgroundMode", Default = 0, Converter = typeof(JsonStringConverter))]
+ [SettingItem(typeof(int), "DisplayTheme", Default = 0, Converter = typeof(JsonStringConverter))]
+ [SettingItem(typeof(int), "BackgroundMode", Default = 1, Converter = typeof(JsonStringConverter))]
[SettingItem(typeof(bool), "UseNewHomePage", Default = true, Converter = typeof(JsonStringConverter))]
[SettingItem(typeof(double), "TintLuminosityOpacity", Default = 0.64, Converter = typeof(JsonStringConverter))]
[SettingItem(typeof(double), "TintOpacity", Default = 0, Converter = typeof(JsonStringConverter))]
From 621def1954471eb086991699b6aa5183b0474527 Mon Sep 17 00:00:00 2001
From: natsurainko
Date: Sun, 17 Sep 2023 00:05:19 +0800
Subject: [PATCH 20/22] Update AccountPage.xaml
---
Natsurainko.FluentLauncher/Views/OOBE/AccountPage.xaml | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/Natsurainko.FluentLauncher/Views/OOBE/AccountPage.xaml b/Natsurainko.FluentLauncher/Views/OOBE/AccountPage.xaml
index 08e66c26..2be0cb35 100644
--- a/Natsurainko.FluentLauncher/Views/OOBE/AccountPage.xaml
+++ b/Natsurainko.FluentLauncher/Views/OOBE/AccountPage.xaml
@@ -47,10 +47,7 @@
CommandParameter="{Binding RelativeSource={RelativeSource Mode=Self}}"
Style="{ThemeResource AccentButtonStyle}">
-
+
From ced0099e1caaeacaa8726f75e21332ba353bb00a Mon Sep 17 00:00:00 2001
From: natsurainko
Date: Sun, 17 Sep 2023 12:05:27 +0800
Subject: [PATCH 21/22] Add OOBE MinecraftFolders ListView Item Delete
---
.../Services/Launch/GameService.cs | 34 ++++++++++++++++++-
.../ViewModels/OOBE/OOBEViewModel.cs | 16 +++++----
.../ViewModels/Settings/LaunchViewModel.cs | 13 ++++---
.../Views/MainWindow.xaml.cs | 7 ++--
.../Views/OOBE/MinecraftFolderPage.xaml | 9 +++++
5 files changed, 60 insertions(+), 19 deletions(-)
diff --git a/Natsurainko.FluentLauncher/Services/Launch/GameService.cs b/Natsurainko.FluentLauncher/Services/Launch/GameService.cs
index ed903b22..a3eb8803 100644
--- a/Natsurainko.FluentLauncher/Services/Launch/GameService.cs
+++ b/Natsurainko.FluentLauncher/Services/Launch/GameService.cs
@@ -47,7 +47,39 @@ public override void ActivateMinecraftFolder(string folder)
}
}
- public void RefreshCurrentFolder() => InitFolder();
+ public void AddMinecraftFolder(string folder)
+ {
+ _minecraftFolders.Add(folder);
+ ActivateMinecraftFolder(folder);
+ }
+
+ public void RemoveMinecraftFolder(string folder)
+ {
+ _minecraftFolders.Remove(folder);
+
+ if (ActiveMinecraftFolder == folder)
+ {
+ ActiveMinecraftFolder = null;
+
+ if (MinecraftFolders.Any())
+ {
+ ActivateMinecraftFolder(MinecraftFolders.First());
+ }
+ }
+
+ RefreshCurrentFolder();
+ }
+
+ public void RefreshCurrentFolder()
+ {
+ if (!MinecraftFolders.Any())
+ {
+ _gameInfos.Clear();
+ return;
+ }
+
+ InitFolder();
+ }
protected override void InitFolder()
{
diff --git a/Natsurainko.FluentLauncher/ViewModels/OOBE/OOBEViewModel.cs b/Natsurainko.FluentLauncher/ViewModels/OOBE/OOBEViewModel.cs
index b0fe1902..0c4facb4 100644
--- a/Natsurainko.FluentLauncher/ViewModels/OOBE/OOBEViewModel.cs
+++ b/Natsurainko.FluentLauncher/ViewModels/OOBE/OOBEViewModel.cs
@@ -18,7 +18,7 @@
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
-using System.Threading.Tasks;
+using System.Threading.Tasks;
using Windows.ApplicationModel;
using Windows.Storage.Pickers;
@@ -204,12 +204,10 @@ public void NavigateTo(int pageIndex)
return;
}
- MinecraftFolders.Add(folder.Path);
- _gameService.ActivateMinecraftFolder(folder.Path);
+ _gameService.AddMinecraftFolder(folder.Path);
});
});
-
private readonly string OfficialLauncherPath = $@"{Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)}\.minecraft";
[RelayCommand]
@@ -238,9 +236,8 @@ public void DetectOfficialMinecraftFolder()
}
// Add to list
- MinecraftFolders.Add(OfficialLauncherPath);
- _gameService.ActivateMinecraftFolder(OfficialLauncherPath);
- ActiveMinecraftFolder = OfficialLauncherPath;
+
+ _gameService.AddMinecraftFolder(OfficialLauncherPath);
_notificationService.NotifyMessage(
ResourceUtils.GetValue("Notifications", "_AddOfficiaFolderAddedT"),
@@ -248,6 +245,9 @@ public void DetectOfficialMinecraftFolder()
icon: "\uE73E");
}
+ [RelayCommand]
+ public void RemoveFolder(string folder) => _gameService.RemoveMinecraftFolder(folder);
+
#endregion
#region Java
@@ -347,6 +347,8 @@ public string NextText
public void Start()
{
_navigationService.Parent?.NavigateTo("ShellPage");
+ (App.MainWindow.MinWidth, App.MainWindow.MinHeight) = (516, 328);
+
_settings.FinishGuide = true;
}
diff --git a/Natsurainko.FluentLauncher/ViewModels/Settings/LaunchViewModel.cs b/Natsurainko.FluentLauncher/ViewModels/Settings/LaunchViewModel.cs
index da1ee8f0..d81f3308 100644
--- a/Natsurainko.FluentLauncher/ViewModels/Settings/LaunchViewModel.cs
+++ b/Natsurainko.FluentLauncher/ViewModels/Settings/LaunchViewModel.cs
@@ -106,7 +106,10 @@ protected override void OnPropertyChanged(PropertyChangedEventArgs e)
base.OnPropertyChanged(e);
if (e.PropertyName == nameof(ActiveMinecraftFolder))
- _gameService.ActivateMinecraftFolder(ActiveMinecraftFolder);
+ {
+ if (!string.IsNullOrEmpty(ActiveMinecraftFolder))
+ _gameService.ActivateMinecraftFolder(ActiveMinecraftFolder);
+ }
}
[RelayCommand]
@@ -133,9 +136,7 @@ protected override void OnPropertyChanged(PropertyChangedEventArgs e)
return;
}
- MinecraftFolders.Add(folder.Path);
- _gameService.ActivateMinecraftFolder(folder.Path);
-
+ _gameService.AddMinecraftFolder(folder.Path);
OnPropertyChanged(nameof(IsMinecraftFoldersEmpty));
});
@@ -177,9 +178,7 @@ public void SearchJava()
[RelayCommand]
public void RemoveFolder()
{
- MinecraftFolders.Remove(ActiveMinecraftFolder);
- ActiveMinecraftFolder = MinecraftFolders.Any() ? MinecraftFolders[0] : null;
-
+ _gameService.RemoveMinecraftFolder(ActiveMinecraftFolder);
OnPropertyChanged(nameof(IsMinecraftFoldersEmpty));
}
diff --git a/Natsurainko.FluentLauncher/Views/MainWindow.xaml.cs b/Natsurainko.FluentLauncher/Views/MainWindow.xaml.cs
index 9ed0ace1..b85270ea 100644
--- a/Natsurainko.FluentLauncher/Views/MainWindow.xaml.cs
+++ b/Natsurainko.FluentLauncher/Views/MainWindow.xaml.cs
@@ -45,7 +45,7 @@ public MainWindow(INavigationService navService)
AppWindow.TitleBar.ButtonHoverBackgroundColor = hoverColor;
- (MinWidth, MinHeight) = (516, 328);
+ (MinWidth, MinHeight) = _settings.FinishGuide ? (516, 328) : (_settings.AppWindowWidth, _settings.AppWindowHeight);
(Width, Height) = (_settings.AppWindowWidth, _settings.AppWindowHeight);
App.GetService().ApplyBackgroundAtWindowCreated(this);
@@ -55,10 +55,9 @@ public MainWindow(INavigationService navService)
private bool _firstActivated = true;
private void WindowEx_Activated(object sender, WindowActivatedEventArgs args)
{
-
if (_firstActivated)
- //_navService.NavigateTo(_settings.FinishGuide ? "ShellPage" : "OOBENavigationPage");
- _navService.NavigateTo("OOBENavigationPage");
+ _navService.NavigateTo(_settings.FinishGuide ? "ShellPage" : "OOBENavigationPage");
+ //_navService.NavigateTo("OOBENavigationPage");
_firstActivated = false;
}
diff --git a/Natsurainko.FluentLauncher/Views/OOBE/MinecraftFolderPage.xaml b/Natsurainko.FluentLauncher/Views/OOBE/MinecraftFolderPage.xaml
index 00eb6b95..f1809289 100644
--- a/Natsurainko.FluentLauncher/Views/OOBE/MinecraftFolderPage.xaml
+++ b/Natsurainko.FluentLauncher/Views/OOBE/MinecraftFolderPage.xaml
@@ -3,7 +3,9 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:animatedvisuals="using:Microsoft.UI.Xaml.Controls.AnimatedVisuals"
+ xmlns:behaviors="using:Natsurainko.FluentLauncher.Utils.Xaml.Behaviors"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:i="using:Microsoft.Xaml.Interactivity"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
@@ -112,8 +114,15 @@
HorizontalAlignment="Right"
Background="Transparent"
BorderThickness="0"
+ CommandParameter="{Binding}"
Visibility="Collapsed">
+
+
+
From 632bb9368731d3b698aa4e1ab0b290d4c42c05a6 Mon Sep 17 00:00:00 2001
From: natsurainko
Date: Sat, 23 Sep 2023 18:49:54 +0800
Subject: [PATCH 22/22] Final Fix
---
FluentLauncher.LocalizationPoroject | 2 +-
.../Dictionaries/NotifyStyleDictionary.xaml | 10 ++++++
.../Services/Launch/GameService.cs | 4 ++-
.../ViewModels/Cores/CoresViewModel.cs | 30 +++++++++++++++--
.../Downloads/DownloadsViewModel.cs | 33 +++++++++++++++++--
.../Downloads/ResourceItemViewModel.cs | 2 +-
.../Downloads/ResourcesSearchViewModel.cs | 33 +++++++++++++++++--
.../ViewModels/Home/HomeViewModel.cs | 4 ++-
.../ViewModels/OOBE/OOBEViewModel.cs | 23 ++++++++++---
.../Views/OOBE/AccountPage.xaml | 7 ++++
.../Views/OOBE/AccountPage.xaml.cs | 14 ++++++++
.../Views/OOBE/JavaPage.xaml | 9 +++++
.../Views/OOBE/OOBENavigationPage.xaml.cs | 7 ++--
13 files changed, 157 insertions(+), 21 deletions(-)
diff --git a/FluentLauncher.LocalizationPoroject b/FluentLauncher.LocalizationPoroject
index 8a927c34..905b6298 160000
--- a/FluentLauncher.LocalizationPoroject
+++ b/FluentLauncher.LocalizationPoroject
@@ -1 +1 @@
-Subproject commit 8a927c3453f50a62fe2fb18a09c7247312a835ee
+Subproject commit 905b6298c3eaf1672b95134cda9971809ad1afcc
diff --git a/Natsurainko.FluentLauncher/Dictionaries/NotifyStyleDictionary.xaml b/Natsurainko.FluentLauncher/Dictionaries/NotifyStyleDictionary.xaml
index b354dba9..8e1ad123 100644
--- a/Natsurainko.FluentLauncher/Dictionaries/NotifyStyleDictionary.xaml
+++ b/Natsurainko.FluentLauncher/Dictionaries/NotifyStyleDictionary.xaml
@@ -186,4 +186,14 @@
+
+
+
+
+
+
+
diff --git a/Natsurainko.FluentLauncher/Services/Launch/GameService.cs b/Natsurainko.FluentLauncher/Services/Launch/GameService.cs
index a3eb8803..2d984f21 100644
--- a/Natsurainko.FluentLauncher/Services/Launch/GameService.cs
+++ b/Natsurainko.FluentLauncher/Services/Launch/GameService.cs
@@ -47,7 +47,7 @@ public override void ActivateMinecraftFolder(string folder)
}
}
- public void AddMinecraftFolder(string folder)
+ public void AddMinecraftFolder(string folder)
{
_minecraftFolders.Add(folder);
ActivateMinecraftFolder(folder);
@@ -75,6 +75,8 @@ public void RefreshCurrentFolder()
if (!MinecraftFolders.Any())
{
_gameInfos.Clear();
+ ActiveGameInfo = null;
+
return;
}
diff --git a/Natsurainko.FluentLauncher/ViewModels/Cores/CoresViewModel.cs b/Natsurainko.FluentLauncher/ViewModels/Cores/CoresViewModel.cs
index 226f0206..bed2bf06 100644
--- a/Natsurainko.FluentLauncher/ViewModels/Cores/CoresViewModel.cs
+++ b/Natsurainko.FluentLauncher/ViewModels/Cores/CoresViewModel.cs
@@ -5,7 +5,9 @@
using Natsurainko.FluentLauncher.Classes.Data.Launch;
using Natsurainko.FluentLauncher.Services.Launch;
using Natsurainko.FluentLauncher.Services.Settings;
+using Natsurainko.FluentLauncher.Services.UI;
using Natsurainko.FluentLauncher.Services.UI.Navigation;
+using Natsurainko.FluentLauncher.Utils;
using Nrk.FluentCore.Classes.Datas.Launch;
using System.Collections.Generic;
using System.Collections.ObjectModel;
@@ -17,18 +19,24 @@ namespace Natsurainko.FluentLauncher.ViewModels.Cores;
internal partial class CoresViewModel : ObservableObject, ISettingsViewModel
{
- private readonly GameService _gameService;
private bool initSettings = false;
[SettingsProvider]
private readonly SettingsService _settingsService;
private readonly INavigationService _navigationService;
+ private readonly GameService _gameService;
+ private readonly NotificationService _notificationService;
- public CoresViewModel(GameService gameService, SettingsService settingsService, INavigationService navigationService)
+ public CoresViewModel(
+ GameService gameService,
+ SettingsService settingsService,
+ INavigationService navigationService,
+ NotificationService notificationService)
{
_gameService = gameService;
_settingsService = settingsService;
_navigationService = navigationService;
+ _notificationService = notificationService;
GameInfos = _gameService.GameInfos;
@@ -100,9 +108,25 @@ public void OpenCoreManage(GameInfo gameInfo)
[RelayCommand]
public void SearchAllMinecraft()
- => _navigationService.NavigateTo("ResourcesSearchPage", new ResourceSearchData
+ {
+ if (string.IsNullOrEmpty(_gameService.ActiveMinecraftFolder))
+ {
+ _notificationService.NotifyWithSpecialContent(
+ ResourceUtils.GetValue("Notifications", "_NoMinecraftFolder"),
+ "NoMinecraftFolderNotifyTemplate",
+ GoToSettingsCommand, "\uE711");
+
+ return;
+ }
+
+ _navigationService.NavigateTo("ResourcesSearchPage", new ResourceSearchData
{
SearchInput = string.Empty,
ResourceType = 0
});
+ }
+
+ [RelayCommand]
+ public void GoToSettings() => _navigationService.NavigateTo("SettingsNavigationPage", "LaunchSettingsPage");
+
}
diff --git a/Natsurainko.FluentLauncher/ViewModels/Downloads/DownloadsViewModel.cs b/Natsurainko.FluentLauncher/ViewModels/Downloads/DownloadsViewModel.cs
index 22fe9c54..1b37a899 100644
--- a/Natsurainko.FluentLauncher/ViewModels/Downloads/DownloadsViewModel.cs
+++ b/Natsurainko.FluentLauncher/ViewModels/Downloads/DownloadsViewModel.cs
@@ -3,8 +3,11 @@
using Microsoft.UI.Xaml;
using Natsurainko.FluentLauncher.Classes.Data.Download;
using Natsurainko.FluentLauncher.Classes.Data.UI;
+using Natsurainko.FluentLauncher.Services.Launch;
using Natsurainko.FluentLauncher.Services.Storage;
+using Natsurainko.FluentLauncher.Services.UI;
using Natsurainko.FluentLauncher.Services.UI.Navigation;
+using Natsurainko.FluentLauncher.Utils;
using Nrk.FluentCore.Classes.Datas.Download;
using System;
using System.Collections.Generic;
@@ -18,11 +21,19 @@ internal partial class DownloadsViewModel : ObservableObject
{
private readonly InterfaceCacheService _interfaceCacheService;
private readonly INavigationService _navigationService;
-
- public DownloadsViewModel(InterfaceCacheService interfaceCacheService, INavigationService navigationService)
+ private readonly GameService _gameService;
+ private readonly NotificationService _notificationService;
+
+ public DownloadsViewModel(
+ InterfaceCacheService interfaceCacheService,
+ INavigationService navigationService,
+ GameService gameService,
+ NotificationService notificationService)
{
_interfaceCacheService = interfaceCacheService;
_navigationService = navigationService;
+ _gameService = gameService;
+ _notificationService = notificationService;
Task.Run(async () =>
{
@@ -120,7 +131,25 @@ public async Task DownloadMinecraft(PublishData resource)
.Where(manifestItem => manifestItem.Id.Equals(resource.Version));
if (manifestItems.Any())
+ {
+ if (string.IsNullOrEmpty(_gameService.ActiveMinecraftFolder))
+ {
+ _notificationService.NotifyWithSpecialContent(
+ ResourceUtils.GetValue("Notifications", "_NoMinecraftFolder"),
+ "NoMinecraftFolderNotifyTemplate",
+ GoToSettingsCommand, "\uE711");
+
+ return;
+ }
+
_navigationService.NavigateTo("CoreInstallWizardPage", manifestItems.First());
+ }
+ else _notificationService.NotifyWithoutContent(
+ ResourceUtils.GetValue("Notifications", "_CoreNotInSourceList"),
+ icon: "\uE9CE");
}
+ [RelayCommand]
+ public void GoToSettings() => _navigationService.NavigateTo("SettingsNavigationPage", "LaunchSettingsPage");
+
}
diff --git a/Natsurainko.FluentLauncher/ViewModels/Downloads/ResourceItemViewModel.cs b/Natsurainko.FluentLauncher/ViewModels/Downloads/ResourceItemViewModel.cs
index b56ea76d..981c5110 100644
--- a/Natsurainko.FluentLauncher/ViewModels/Downloads/ResourceItemViewModel.cs
+++ b/Natsurainko.FluentLauncher/ViewModels/Downloads/ResourceItemViewModel.cs
@@ -44,7 +44,7 @@ void INavigationAware.OnNavigatedTo(object parameter)
var urls = isCurse ? ((CurseResource)parameter).ScreenshotUrls : ((ModrinthResource)parameter).ScreenshotUrls;
object id = isCurse ? ((CurseResource)parameter).Id : ((ModrinthResource)parameter).Id;
- if (urls.Any())
+ if (urls.Any())
ScreenshotsBorderVisbility = Visibility.Visible;
Task.Run(() =>
diff --git a/Natsurainko.FluentLauncher/ViewModels/Downloads/ResourcesSearchViewModel.cs b/Natsurainko.FluentLauncher/ViewModels/Downloads/ResourcesSearchViewModel.cs
index 9e7d9f5d..f80f2323 100644
--- a/Natsurainko.FluentLauncher/ViewModels/Downloads/ResourcesSearchViewModel.cs
+++ b/Natsurainko.FluentLauncher/ViewModels/Downloads/ResourcesSearchViewModel.cs
@@ -2,8 +2,11 @@
using CommunityToolkit.Mvvm.Input;
using Microsoft.UI.Xaml;
using Natsurainko.FluentLauncher.Classes.Data.Download;
+using Natsurainko.FluentLauncher.Services.Launch;
using Natsurainko.FluentLauncher.Services.Storage;
+using Natsurainko.FluentLauncher.Services.UI;
using Natsurainko.FluentLauncher.Services.UI.Navigation;
+using Natsurainko.FluentLauncher.Utils;
using Nrk.FluentCore.Classes.Datas.Download;
using System.Collections.Generic;
using System.ComponentModel;
@@ -16,11 +19,19 @@ internal partial class ResourcesSearchViewModel : ObservableObject, INavigationA
{
private readonly InterfaceCacheService _interfaceCacheService;
private readonly INavigationService _navigationService;
-
- public ResourcesSearchViewModel(InterfaceCacheService interfaceCacheServicel, INavigationService navigationService)
+ private readonly GameService _gameService;
+ private readonly NotificationService _notificationService;
+
+ public ResourcesSearchViewModel(
+ InterfaceCacheService interfaceCacheServicel,
+ INavigationService navigationService,
+ GameService gameService,
+ NotificationService notificationService)
{
_interfaceCacheService = interfaceCacheServicel;
_navigationService = navigationService;
+ _gameService = gameService;
+ _notificationService = notificationService;
}
[ObservableProperty]
@@ -120,5 +131,21 @@ private void Search()
public void NavigateResourcePage(object resource) => _navigationService.NavigateTo("ResourceItemPage", resource);
[RelayCommand]
- public void NavigateCoreInstallWizardPage(object resource) => _navigationService.NavigateTo("CoreInstallWizardPage", resource);
+ public void NavigateCoreInstallWizardPage(object resource)
+ {
+ if (string.IsNullOrEmpty(_gameService.ActiveMinecraftFolder))
+ {
+ _notificationService.NotifyWithSpecialContent(
+ ResourceUtils.GetValue("Notifications", "_NoMinecraftFolder"),
+ "NoMinecraftFolderNotifyTemplate",
+ GoToSettingsCommand, "\uE711");
+
+ return;
+ }
+
+ _navigationService.NavigateTo("CoreInstallWizardPage", resource);
+ }
+
+ [RelayCommand]
+ public void GoToSettings() => _navigationService.NavigateTo("SettingsNavigationPage", "LaunchSettingsPage");
}
diff --git a/Natsurainko.FluentLauncher/ViewModels/Home/HomeViewModel.cs b/Natsurainko.FluentLauncher/ViewModels/Home/HomeViewModel.cs
index ad0d8698..d350c3e4 100644
--- a/Natsurainko.FluentLauncher/ViewModels/Home/HomeViewModel.cs
+++ b/Natsurainko.FluentLauncher/ViewModels/Home/HomeViewModel.cs
@@ -61,7 +61,7 @@ public HomeViewModel(GameService gameService, AccountService accountService, Lau
public Visibility AccountTag => ActiveAccount is null ? Visibility.Collapsed : Visibility.Visible;
- [RelayCommand]
+ [RelayCommand(CanExecute = nameof(CanExecuteLaunch))]
public void Launch()
{
_launchService.LaunchGame(ActiveGameInfo);
@@ -84,4 +84,6 @@ protected override void OnPropertyChanged(PropertyChangedEventArgs e)
if (e.PropertyName == nameof(ActiveGameInfo) && ActiveGameInfo is not null)
_gameService.ActivateGameInfo(ActiveGameInfo);
}
+
+ private bool CanExecuteLaunch() => ActiveGameInfo is not null;
}
diff --git a/Natsurainko.FluentLauncher/ViewModels/OOBE/OOBEViewModel.cs b/Natsurainko.FluentLauncher/ViewModels/OOBE/OOBEViewModel.cs
index 0c4facb4..83ba7e3e 100644
--- a/Natsurainko.FluentLauncher/ViewModels/OOBE/OOBEViewModel.cs
+++ b/Natsurainko.FluentLauncher/ViewModels/OOBE/OOBEViewModel.cs
@@ -18,7 +18,7 @@
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
-using System.Threading.Tasks;
+using System.Threading.Tasks;
using Windows.ApplicationModel;
using Windows.Storage.Pickers;
@@ -218,7 +218,7 @@ public void DetectOfficialMinecraftFolder()
{
_notificationService.NotifyMessage(
ResourceUtils.GetValue("Notifications", "_AddOfficialFolderNotExistT"),
- ResourceUtils.GetValue("Notifications", "_AddOfficialFolderNotExistD").Replace("${path}", OfficialLauncherPath),
+ ResourceUtils.GetValue("Notifications", "_AddOfficialFolderNotExistD").Replace("${path}", OfficialLauncherPath),
icon: "\uF89A");
return;
@@ -293,10 +293,17 @@ public void SearchJava()
OnPropertyChanged(nameof(JavaRuntimes));
_notificationService.NotifyWithoutContent(
- ResourceUtils.GetValue("Notifications", "_AddSearchedJavaT"),
+ ResourceUtils.GetValue("Notifications", "_AddSearchedJavaT"),
icon: "\uE73E");
}
+ [RelayCommand]
+ public void RemoveJava(string java)
+ {
+ JavaRuntimes.Remove(java);
+ ActiveJavaRuntime = JavaRuntimes.Any() ? JavaRuntimes[0] : null;
+ }
+
[RelayCommand]
public void OpenJavaMirrorsDialog(HyperlinkButton parameter)
=> _ = new JavaMirrorsDialog { XamlRoot = parameter.XamlRoot }.ShowAsync();
@@ -323,13 +330,21 @@ public void Receive(ActiveAccountChangedMessage message)
partial void OnActiveAccountChanged(Account value)
{
if (!processingActiveAccountChangedMessage)
- _accountService.Activate(value);
+ {
+ if (value is not null)
+ _accountService.Activate(value);
+ }
}
[RelayCommand]
public void Login(Button parameter)
=> _ = new AuthenticationWizardDialog { XamlRoot = parameter.XamlRoot }.ShowAsync();
+ [RelayCommand]
+ public void RemoveAccount(Account account)
+ {
+ _accountService.Remove(account);
+ }
#endregion
public string NextText
diff --git a/Natsurainko.FluentLauncher/Views/OOBE/AccountPage.xaml b/Natsurainko.FluentLauncher/Views/OOBE/AccountPage.xaml
index 2be0cb35..c305f22b 100644
--- a/Natsurainko.FluentLauncher/Views/OOBE/AccountPage.xaml
+++ b/Natsurainko.FluentLauncher/Views/OOBE/AccountPage.xaml
@@ -118,8 +118,15 @@
HorizontalAlignment="Right"
Background="Transparent"
BorderThickness="0"
+ CommandParameter="{Binding}"
Visibility="Collapsed">
+
+
+
diff --git a/Natsurainko.FluentLauncher/Views/OOBE/AccountPage.xaml.cs b/Natsurainko.FluentLauncher/Views/OOBE/AccountPage.xaml.cs
index b83c727a..a131678c 100644
--- a/Natsurainko.FluentLauncher/Views/OOBE/AccountPage.xaml.cs
+++ b/Natsurainko.FluentLauncher/Views/OOBE/AccountPage.xaml.cs
@@ -8,4 +8,18 @@ public AccountPage()
{
InitializeComponent();
}
+
+ private void Grid_PointerEntered(object sender, Microsoft.UI.Xaml.Input.PointerRoutedEventArgs e)
+ {
+ var grid = sender as Grid;
+ var button = grid.FindName("DeleteButton") as Button;
+ button.Visibility = Microsoft.UI.Xaml.Visibility.Visible;
+ }
+
+ private void Grid_PointerExited(object sender, Microsoft.UI.Xaml.Input.PointerRoutedEventArgs e)
+ {
+ var grid = sender as Grid;
+ var button = grid.FindName("DeleteButton") as Button;
+ button.Visibility = Microsoft.UI.Xaml.Visibility.Collapsed;
+ }
}
diff --git a/Natsurainko.FluentLauncher/Views/OOBE/JavaPage.xaml b/Natsurainko.FluentLauncher/Views/OOBE/JavaPage.xaml
index ca2d8e22..b8f4a878 100644
--- a/Natsurainko.FluentLauncher/Views/OOBE/JavaPage.xaml
+++ b/Natsurainko.FluentLauncher/Views/OOBE/JavaPage.xaml
@@ -3,7 +3,9 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:animatedvisuals="using:Microsoft.UI.Xaml.Controls.AnimatedVisuals"
+ xmlns:behaviors="using:Natsurainko.FluentLauncher.Utils.Xaml.Behaviors"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:i="using:Microsoft.Xaml.Interactivity"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
@@ -126,8 +128,15 @@
HorizontalAlignment="Right"
Background="Transparent"
BorderThickness="0"
+ CommandParameter="{Binding}"
Visibility="Collapsed">
+
+
+
diff --git a/Natsurainko.FluentLauncher/Views/OOBE/OOBENavigationPage.xaml.cs b/Natsurainko.FluentLauncher/Views/OOBE/OOBENavigationPage.xaml.cs
index f803f1a1..610f544b 100644
--- a/Natsurainko.FluentLauncher/Views/OOBE/OOBENavigationPage.xaml.cs
+++ b/Natsurainko.FluentLauncher/Views/OOBE/OOBENavigationPage.xaml.cs
@@ -1,13 +1,10 @@
-using Microsoft.UI;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
-using Microsoft.UI.Xaml.Media;
using Microsoft.UI.Xaml.Media.Animation;
using Microsoft.UI.Xaml.Navigation;
using Natsurainko.FluentLauncher.Services.UI.Navigation;
using Natsurainko.FluentLauncher.Services.UI.Pages;
using Natsurainko.FluentLauncher.ViewModels.OOBE;
-using System.ComponentModel;
using System.Linq;
namespace Natsurainko.FluentLauncher.Views.OOBE;
@@ -18,7 +15,7 @@ public sealed partial class OOBENavigationPage : Page, INavigationProvider
private OOBEViewModel VM => (OOBEViewModel)DataContext;
public NavigationTransitionInfo TransitionInfo
- {
+ {
get => navTransition.DefaultNavigationTransitionInfo;
set => navTransition.DefaultNavigationTransitionInfo = value;
}
@@ -36,7 +33,7 @@ private void NavigationViewControl_ItemInvoked(NavigationView sender, Navigation
return;
int sourcePageIndex = VM.CurrentPageIndex;
-
+
var navigationViewItems = sender.MenuItems.Union(sender.FooterMenuItems).Cast().Select(item => item.Tag).Cast().ToList();
string pageTag = ((NavigationViewItem)args.InvokedItemContainer).Tag.ToString();
int targetPageIndex = navigationViewItems.IndexOf(pageTag);