From 5a8b28f489ebe37c837540afac05431121767003 Mon Sep 17 00:00:00 2001
From: ONLOX <3316820553@qq.com>
Date: Sat, 6 Apr 2024 22:06:16 +0800
Subject: [PATCH 1/6] feat: update installer ui
---
installer/Page/InstallPage.xaml | 153 +++++++-------
installer/Page/LaunchPage.xaml | 262 +++++++++++++-----------
installer/Page/LoginPage.xaml | 74 ++++---
installer/ViewModel/InstallViewModel.cs | 39 +---
4 files changed, 268 insertions(+), 260 deletions(-)
diff --git a/installer/Page/InstallPage.xaml b/installer/Page/InstallPage.xaml
index 88318e76..d32dfb05 100644
--- a/installer/Page/InstallPage.xaml
+++ b/installer/Page/InstallPage.xaml
@@ -8,89 +8,100 @@
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
-
+
-
-
-
-
+
+
+
+
+
+
+
+
+
diff --git a/installer/Page/LaunchPage.xaml b/installer/Page/LaunchPage.xaml
index 9738fcc8..242881b4 100644
--- a/installer/Page/LaunchPage.xaml
+++ b/installer/Page/LaunchPage.xaml
@@ -4,136 +4,148 @@
xmlns:viewModels="clr-namespace:installer.ViewModel"
x:Class="installer.Page.LaunchPage"
Title="Launcher">
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
-
-
-
-
+
-
-
-
-
-
-
-
-
+ Text="启动"
+ BorderWidth="2"
+ Command="{Binding StartBtnClickedCommand}"
+ IsEnabled="{Binding StartEnabled}"
+ BackgroundColor="{Binding ConstBackgroundColor}"
+ FontSize="{Binding ConstFontSize}"
+ TextColor="{Binding ConstTextColor}"/>
-
+
-
-
+
-
-
\ No newline at end of file
diff --git a/installer/Page/LoginPage.xaml b/installer/Page/LoginPage.xaml
index 72b25511..5dbe222f 100755
--- a/installer/Page/LoginPage.xaml
+++ b/installer/Page/LoginPage.xaml
@@ -5,37 +5,51 @@
x:Class="installer.Page.LoginPage"
Title="Login">
-
-
-
-
-
+ WidthRequest="500"
+ RowDefinitions="*,*,*,*,*">
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+ Text="{Binding ID}"
+ FontSize="{Binding ConstFontSize}"/>
+
+
+
+
+
+
\ No newline at end of file
diff --git a/installer/ViewModel/InstallViewModel.cs b/installer/ViewModel/InstallViewModel.cs
index 4742c0be..7fc977c6 100644
--- a/installer/ViewModel/InstallViewModel.cs
+++ b/installer/ViewModel/InstallViewModel.cs
@@ -43,36 +43,6 @@ public string? DebugAlert1
OnPropertyChanged();
}
}
- private string? debugAlert2;
- public string? DebugAlert2
- {
- get => debugAlert2;
- set
- {
- debugAlert2 = value;
- OnPropertyChanged();
- }
- }
- private string? debugAlert3;
- public string? DebugAlert3
- {
- get => debugAlert3;
- set
- {
- debugAlert3 = value;
- OnPropertyChanged();
- }
- }
- private string? debugAlert4;
- public string? DebugAlert4
- {
- get => debugAlert4;
- set
- {
- debugAlert4 = value;
- OnPropertyChanged();
- }
- }
private string downloadPath;
public string DownloadPath
@@ -142,12 +112,13 @@ public void UpdateExceptions()
Exceptions.Add(exception);
}
}
+ // Exceptions.Add(new Exception("Exceptions: " + Exceptions.Count.ToString()));
}
public ICommand BrowseBtnClickedCommand { get; }
private async Task BrowseBtnClicked()
{
- DebugAlert1 = "Browse Button Clicked";
+ // DebugAlert1 = "Browse Button Clicked";
BrowseEnabled = false;
CheckEnabled = false;
DownloadEnabled = false;
@@ -167,7 +138,7 @@ private async Task BrowseBtnClicked()
public ICommand CheckUpdBtnClickedCommand { get; }
private async void CheckUpdBtnClicked()
{
- DebugAlert1 = "Check Button Clicked";
+ // DebugAlert1 = "Check Button Clicked";
BrowseEnabled = false;
CheckEnabled = false;
DownloadEnabled = false;
@@ -190,7 +161,7 @@ private async void CheckUpdBtnClicked()
public ICommand DownloadBtnClickedCommand { get; }
private async Task DownloadBtnClicked()
{
- DebugAlert1 = "Download Button Clicked";
+ // DebugAlert1 = "Download Button Clicked";
BrowseEnabled = false;
CheckEnabled = false;
DownloadEnabled = false;
@@ -211,7 +182,7 @@ private async Task DownloadBtnClicked()
public ICommand UpdateBtnClickedCommand { get; }
private async Task UpdateBtnClicked()
{
- DebugAlert1 = "Update Button Clicked";
+ // DebugAlert1 = "Update Button Clicked";
BrowseEnabled = false;
CheckEnabled = false;
DownloadEnabled = false;
From 6e2e027a9fc1dd45a6e71730f02857326339084a Mon Sep 17 00:00:00 2001
From: ONLOX <3316820553@qq.com>
Date: Wed, 10 Apr 2024 00:46:49 +0800
Subject: [PATCH 2/6] chore: change sweeper to ship
---
installer/Data/ConfigFileData.cs | 10 +++---
installer/Page/LaunchPage.xaml | 4 +--
installer/ViewModel/LaunchViewModel.cs | 50 +++++++++++++-------------
3 files changed, 32 insertions(+), 32 deletions(-)
diff --git a/installer/Data/ConfigFileData.cs b/installer/Data/ConfigFileData.cs
index d0579e18..1eb78542 100644
--- a/installer/Data/ConfigFileData.cs
+++ b/installer/Data/ConfigFileData.cs
@@ -23,7 +23,7 @@ public record CommandFile
public string PlayerID { get; set; } = "0";
- public string SweeperType { get; set; } = "0";
+ public string ShipType { get; set; } = "0";
public string PlaybackFile { get; set; } = "CLGG!@#$%^&*()_+";
@@ -120,13 +120,13 @@ public string PlayerID
}
- public string SweeperType
+ public string ShipType
{
- get => file.SweeperType;
+ get => file.ShipType;
set
{
- var temp = file.SweeperType;
- file.SweeperType = value;
+ var temp = file.ShipType;
+ file.ShipType = value;
if (temp != value)
OnMemoryChanged?.Invoke(this, new EventArgs());
}
diff --git a/installer/Page/LaunchPage.xaml b/installer/Page/LaunchPage.xaml
index 242881b4..3a2a9567 100644
--- a/installer/Page/LaunchPage.xaml
+++ b/installer/Page/LaunchPage.xaml
@@ -67,13 +67,13 @@
diff --git a/installer/ViewModel/LaunchViewModel.cs b/installer/ViewModel/LaunchViewModel.cs
index 57316c7e..c6062cc0 100644
--- a/installer/ViewModel/LaunchViewModel.cs
+++ b/installer/ViewModel/LaunchViewModel.cs
@@ -23,7 +23,7 @@ public LaunchViewModel(Downloader downloader)
Port = Downloader.Data.Config.Commands.Port;
TeamID = Downloader.Data.Config.Commands.TeamID;
PlayerID = Downloader.Data.Config.Commands.PlayerID;
- SweeperType = Downloader.Data.Config.Commands.SweeperType;
+ ShipType = Downloader.Data.Config.Commands.ShipType;
PlaybackFile = Downloader.Data.Config.Commands.PlaybackFile;
PlaybackSpeed = Downloader.Data.Config.Commands.PlaybackSpeed.ToString();
@@ -31,7 +31,7 @@ public LaunchViewModel(Downloader downloader)
portChanged = false;
teamIDChanged = false;
playerIDChanged = false;
- sweeperTypeChanged = false;
+ shipTypeChanged = false;
playbackFileChanged = false;
playbackSpeedChanged = false;
@@ -67,7 +67,7 @@ public LaunchViewModel(Downloader downloader)
private string? port;
private string? teamID;
private string? playerID;
- private string? sweeperType;
+ private string? shipType;
private string? playbackFile;
private string? playbackSpeed;
private bool cppSelect;
@@ -77,7 +77,7 @@ public LaunchViewModel(Downloader downloader)
private bool portChanged;
private bool teamIDChanged;
private bool playerIDChanged;
- private bool sweeperTypeChanged;
+ private bool shipTypeChanged;
private bool playbackFileChanged;
private bool playbackSpeedChanged;
private bool languageChanged;
@@ -96,7 +96,7 @@ public string? IP
&& !portChanged
&& !teamIDChanged
&& !playerIDChanged
- && !sweeperTypeChanged
+ && !shipTypeChanged
&& !playbackFileChanged
&& !playbackSpeedChanged
&& !languageChanged;
@@ -117,7 +117,7 @@ public string? Port
&& !portChanged
&& !teamIDChanged
&& !playerIDChanged
- && !sweeperTypeChanged
+ && !shipTypeChanged
&& !playbackFileChanged
&& !playbackSpeedChanged
&& !languageChanged;
@@ -138,7 +138,7 @@ public string? TeamID
&& !portChanged
&& !teamIDChanged
&& !playerIDChanged
- && !sweeperTypeChanged
+ && !shipTypeChanged
&& !playbackFileChanged
&& !playbackSpeedChanged
&& !languageChanged;
@@ -159,28 +159,28 @@ public string? PlayerID
&& !portChanged
&& !teamIDChanged
&& !playerIDChanged
- && !sweeperTypeChanged
+ && !shipTypeChanged
&& !playbackFileChanged
&& !playbackSpeedChanged
&& !languageChanged;
OnPropertyChanged();
}
}
- public string? SweeperType
+ public string? ShipType
{
- get => sweeperType;
+ get => shipType;
set
{
- sweeperType = value;
- if (sweeperType == Downloader.Data.Config.Commands.SweeperType)
- sweeperTypeChanged = false;
+ shipType = value;
+ if (shipType == Downloader.Data.Config.Commands.ShipType)
+ shipTypeChanged = false;
else
- sweeperTypeChanged = true;
+ shipTypeChanged = true;
StartEnabled = !ipChanged
&& !portChanged
&& !teamIDChanged
&& !playerIDChanged
- && !sweeperTypeChanged
+ && !shipTypeChanged
&& !playbackFileChanged
&& !playbackSpeedChanged
&& !languageChanged;
@@ -201,7 +201,7 @@ public string? PlaybackFile
&& !portChanged
&& !teamIDChanged
&& !playerIDChanged
- && !sweeperTypeChanged
+ && !shipTypeChanged
&& !playbackFileChanged
&& !playbackSpeedChanged
&& !languageChanged;
@@ -222,7 +222,7 @@ public string? PlaybackSpeed
&& !portChanged
&& !teamIDChanged
&& !playerIDChanged
- && !sweeperTypeChanged
+ && !shipTypeChanged
&& !playbackFileChanged
&& !playbackSpeedChanged
&& !languageChanged;
@@ -249,7 +249,7 @@ public bool CppSelect
&& !portChanged
&& !teamIDChanged
&& !playerIDChanged
- && !sweeperTypeChanged
+ && !shipTypeChanged
&& !playbackFileChanged
&& !playbackSpeedChanged
&& !languageChanged;
@@ -276,7 +276,7 @@ public bool PySelect
&& !portChanged
&& !teamIDChanged
&& !playerIDChanged
- && !sweeperTypeChanged
+ && !shipTypeChanged
&& !playbackFileChanged
&& !playbackSpeedChanged
&& !languageChanged;
@@ -319,7 +319,7 @@ private async Task SaveBtnClicked()
&& !portChanged
&& !teamIDChanged
&& !playerIDChanged
- && !sweeperTypeChanged
+ && !shipTypeChanged
&& !playbackFileChanged
&& !playbackSpeedChanged
&& !languageChanged;
@@ -391,14 +391,14 @@ private void Save()
{
try
{
- if (SweeperType == null)
+ if (ShipType == null)
throw new Exception("empty");
- Downloader.Data.Config.Commands.SweeperType = SweeperType;
- sweeperTypeChanged = false;
+ Downloader.Data.Config.Commands.ShipType = ShipType;
+ shipTypeChanged = false;
}
catch (Exception e)
{
- DebugAlert = "Sweeper Type: " + e.Message;
+ DebugAlert = "Ship Type: " + e.Message;
}
});
Task.Run(() =>
@@ -457,7 +457,7 @@ private void Start()
+ Port + " "
+ TeamID + " "
+ PlayerID + " "
- + SweeperType + " "
+ + ShipType + " "
+ PlaybackFile + " "
+ PlaybackSpeed;
}
From 74880284f9ebc93acaac1afe7d2f5c13af85a431 Mon Sep 17 00:00:00 2001
From: ONLOX <3316820553@qq.com>
Date: Thu, 11 Apr 2024 14:30:26 +0800
Subject: [PATCH 3/6] feat: add log level label of installer
---
installer/Model/Logger.cs | 32 ++++++++++++++++++++++++++++++++
installer/Page/InstallPage.xaml | 17 ++++++++++++-----
2 files changed, 44 insertions(+), 5 deletions(-)
diff --git a/installer/Model/Logger.cs b/installer/Model/Logger.cs
index 6aed625b..18063295 100644
--- a/installer/Model/Logger.cs
+++ b/installer/Model/Logger.cs
@@ -30,6 +30,38 @@ public enum LogLevel
public class LogRecord
{
public LogLevel Level { get; set; }
+ public string LevelStr
+ {
+ get
+ {
+ return Level switch
+ {
+ LogLevel.Trace => "Trace",
+ LogLevel.Debug => "Debug",
+ LogLevel.Information => "Info",
+ LogLevel.Warning => "Warning",
+ LogLevel.Error => "Error",
+ LogLevel.Critical => "Critical",
+ _ => "None",
+ };
+ }
+ }
+ public string Color
+ {
+ get
+ {
+ return Level switch
+ {
+ LogLevel.Trace => "LightGary",
+ LogLevel.Debug => "LightGray",
+ LogLevel.Information => "LightGary",
+ LogLevel.Warning => "Yellow",
+ LogLevel.Error => "Red",
+ LogLevel.Critical => "DarkRed",
+ _ => "White",
+ };
+ }
+ }
public string Message { get; set; } = string.Empty;
}
diff --git a/installer/Page/InstallPage.xaml b/installer/Page/InstallPage.xaml
index d32dfb05..1294e0b4 100644
--- a/installer/Page/InstallPage.xaml
+++ b/installer/Page/InstallPage.xaml
@@ -80,16 +80,24 @@
+ ColumnDefinitions="*,*,*,*,*"
+ WidthRequest="570">
+
+
@@ -101,8 +109,7 @@
-
-
+
\ No newline at end of file
From c2e243fe0a0beead9c7a65ba05483588eef6486e Mon Sep 17 00:00:00 2001
From: ONLOX <3316820553@qq.com>
Date: Thu, 11 Apr 2024 21:54:50 +0800
Subject: [PATCH 4/6] feat: add help page
---
installer/AppShell.xaml | 3 +
installer/Page/HelpPage.xaml | 91 ++++++++++++++++++++++++++++
installer/Page/HelpPage.xaml.cs | 12 ++++
installer/ViewModel/HelpViewModel.cs | 38 ++++++++++++
4 files changed, 144 insertions(+)
create mode 100644 installer/Page/HelpPage.xaml
create mode 100644 installer/Page/HelpPage.xaml.cs
create mode 100644 installer/ViewModel/HelpViewModel.cs
diff --git a/installer/AppShell.xaml b/installer/AppShell.xaml
index 031ce892..cecf050f 100755
--- a/installer/AppShell.xaml
+++ b/installer/AppShell.xaml
@@ -19,6 +19,9 @@
+
diff --git a/installer/Page/HelpPage.xaml b/installer/Page/HelpPage.xaml
new file mode 100644
index 00000000..fbd29dee
--- /dev/null
+++ b/installer/Page/HelpPage.xaml
@@ -0,0 +1,91 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/installer/Page/HelpPage.xaml.cs b/installer/Page/HelpPage.xaml.cs
new file mode 100644
index 00000000..88b67c0b
--- /dev/null
+++ b/installer/Page/HelpPage.xaml.cs
@@ -0,0 +1,12 @@
+using installer.ViewModel;
+
+namespace installer.Page;
+
+public partial class HelpPage : ContentPage
+{
+ public HelpPage(HelpViewModel viewModel)
+ {
+ InitializeComponent();
+ BindingContext = viewModel;
+ }
+}
\ No newline at end of file
diff --git a/installer/ViewModel/HelpViewModel.cs b/installer/ViewModel/HelpViewModel.cs
new file mode 100644
index 00000000..fccae285
--- /dev/null
+++ b/installer/ViewModel/HelpViewModel.cs
@@ -0,0 +1,38 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace installer.ViewModel
+{
+ public class HelpViewModel : BaseViewModel
+ {
+
+ public List InstallerHelp { get; }
+ public List LauncherHelp { get; }
+ public List OtherHelp { get; }
+
+ public HelpViewModel()
+ {
+ InstallerHelp = new List();
+ LauncherHelp = new List();
+ OtherHelp = new List();
+
+ InstallerHelp.Add(new HelpMessage { Title = "Installer", Content = "> 下载功能需要选择空文件夹路径" });
+ InstallerHelp.Add(new HelpMessage { Title = "Installer", Content = "> 更新前请先进行检查更新操作" });
+
+ LauncherHelp.Add(new HelpMessage { Title = "Launcher", Content = "> 修改参数后需要进行保存操作" });
+
+ OtherHelp.Add(new HelpMessage { Title = "Other", Content = "> 欢迎在比赛群中提出有关比赛的各种问题" });
+ }
+ }
+
+ public class HelpMessage
+ {
+ public string? Title { get; set; }
+ public string? Content { get; set; }
+ public string FontSize { get; } = "18";
+ }
+}
From 2f73bc22c9abcca57d95dc36d3270f95fd4a3e85 Mon Sep 17 00:00:00 2001
From: ONLOX <3316820553@qq.com>
Date: Thu, 11 Apr 2024 21:55:23 +0800
Subject: [PATCH 5/6] chore: log list debug
---
installer/Model/Logger.cs | 22 +++-------------------
installer/Page/InstallPage.xaml | 13 ++++---------
installer/ViewModel/InstallViewModel.cs | 3 +--
3 files changed, 8 insertions(+), 30 deletions(-)
diff --git a/installer/Model/Logger.cs b/installer/Model/Logger.cs
index 18063295..ff982356 100644
--- a/installer/Model/Logger.cs
+++ b/installer/Model/Logger.cs
@@ -30,31 +30,15 @@ public enum LogLevel
public class LogRecord
{
public LogLevel Level { get; set; }
- public string LevelStr
- {
- get
- {
- return Level switch
- {
- LogLevel.Trace => "Trace",
- LogLevel.Debug => "Debug",
- LogLevel.Information => "Info",
- LogLevel.Warning => "Warning",
- LogLevel.Error => "Error",
- LogLevel.Critical => "Critical",
- _ => "None",
- };
- }
- }
public string Color
{
get
{
return Level switch
{
- LogLevel.Trace => "LightGary",
- LogLevel.Debug => "LightGray",
- LogLevel.Information => "LightGary",
+ LogLevel.Trace => "Black",
+ LogLevel.Debug => "Black",
+ LogLevel.Information => "Black",
LogLevel.Warning => "Yellow",
LogLevel.Error => "Red",
LogLevel.Critical => "DarkRed",
diff --git a/installer/Page/InstallPage.xaml b/installer/Page/InstallPage.xaml
index 1294e0b4..de1ecf90 100644
--- a/installer/Page/InstallPage.xaml
+++ b/installer/Page/InstallPage.xaml
@@ -75,6 +75,7 @@
@@ -86,20 +87,14 @@
-
-
+ TextColor="{Binding Color}"/>
diff --git a/installer/ViewModel/InstallViewModel.cs b/installer/ViewModel/InstallViewModel.cs
index c70d0dd9..205e14a3 100644
--- a/installer/ViewModel/InstallViewModel.cs
+++ b/installer/ViewModel/InstallViewModel.cs
@@ -17,7 +17,7 @@ public class InstallViewModel : BaseViewModel
{
private readonly Downloader Downloader;
private readonly IFolderPicker FolderPicker;
- public ObservableCollection Exceptions { get => Downloader.LogList.List; }
+ public ObservableCollection LogCollection { get => Downloader.LogList.List; }
public InstallViewModel(IFolderPicker folderPicker, Downloader downloader)
{
@@ -160,7 +160,6 @@ private async Task DownloadBtnClicked()
}
CheckEnabled = true;
BrowseEnabled = true;
- // DebugAlert2 = "Installed" + Downloader.Data.Installed.ToString();
}
public ICommand UpdateBtnClickedCommand { get; }
private async Task UpdateBtnClicked()
From 6f253ef8f6f129664b0b3e06f8b41d9460d50c73 Mon Sep 17 00:00:00 2001
From: ONLOX <3316820553@qq.com>
Date: Thu, 11 Apr 2024 21:58:00 +0800
Subject: [PATCH 6/6] fix: format
---
installer/Page/HelpPage.xaml | 1 +
installer/Page/HelpPage.xaml.cs | 6 +++---
installer/ViewModel/HelpViewModel.cs | 4 ++--
3 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/installer/Page/HelpPage.xaml b/installer/Page/HelpPage.xaml
index fbd29dee..8c106fa4 100644
--- a/installer/Page/HelpPage.xaml
+++ b/installer/Page/HelpPage.xaml
@@ -80,6 +80,7 @@
+