Skip to content

Commit

Permalink
Merge pull request #209 from ONLOX/dev
Browse files Browse the repository at this point in the history
Update Installer Page and Add Help Page
  • Loading branch information
DreamEnderKing authored Apr 11, 2024
2 parents 1652525 + 6f253ef commit 5e8ee10
Show file tree
Hide file tree
Showing 11 changed files with 462 additions and 293 deletions.
3 changes: 3 additions & 0 deletions installer/AppShell.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
<ShellContent
Title="Login"
ContentTemplate="{DataTemplate local:LoginPage}"/>
<ShellContent
Title="Help"
ContentTemplate="{DataTemplate local:HelpPage}"/>

</FlyoutItem>

Expand Down
10 changes: 5 additions & 5 deletions installer/Data/ConfigFileData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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!@#$%^&*()_+";

Expand Down Expand Up @@ -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());
}
Expand Down
16 changes: 16 additions & 0 deletions installer/Model/Logger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,22 @@ public enum LogLevel
public class LogRecord
{
public LogLevel Level { get; set; }
public string Color
{
get
{
return Level switch
{
LogLevel.Trace => "Black",
LogLevel.Debug => "Black",
LogLevel.Information => "Black",
LogLevel.Warning => "Yellow",
LogLevel.Error => "Red",
LogLevel.Critical => "DarkRed",
_ => "White",
};
}
}
public string Message { get; set; } = string.Empty;
}

Expand Down
92 changes: 92 additions & 0 deletions installer/Page/HelpPage.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:viewModels="clr-namespace:installer.ViewModel"
x:Class="installer.Page.HelpPage"
Title="Help">

<VerticalStackLayout
WidthRequest="600"
HorizontalOptions="Center">

<Label/>
<Label/>

<Label
Text="Installer"
FontAttributes="Bold"
FontSize="24"/>
<Frame
BorderColor="Gray"
Padding="10"
Margin="5"
VerticalOptions="FillAndExpand"
WidthRequest="600">
<CollectionView
ItemsSource="{Binding InstallerHelp}">
<CollectionView.ItemTemplate>
<DataTemplate>
<Label
Text="{Binding Content}"
FontSize="{Binding FontSize}"/>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</Frame>

<Label
Text="Launcher"
FontAttributes="Bold"
FontSize="24"/>
<Frame
BorderColor="Gray"
Padding="10"
Margin="5"
VerticalOptions="FillAndExpand"
WidthRequest="600">
<CollectionView
ItemsSource="{Binding LauncherHelp}">
<CollectionView.ItemTemplate>
<DataTemplate>
<Label
Text="{Binding Content}"
FontSize="{Binding FontSize}"/>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</Frame>

<Label
Text="Other"
FontAttributes="Bold"
FontSize="24"/>
<Frame
BorderColor="Gray"
Padding="10"
Margin="5"
VerticalOptions="FillAndExpand"
WidthRequest="600">
<CollectionView
ItemsSource="{Binding OtherHelp}">
<CollectionView.ItemTemplate>
<DataTemplate>
<Label
Text="{Binding Content}"
FontSize="{Binding FontSize}"/>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</Frame>

<Label/>
<Label/>

<Label
Text="祝大家 Debug 快乐!"
FontAttributes="Bold"
FontSize="22"
HorizontalOptions="Center"/>

</VerticalStackLayout>

</ContentPage>
12 changes: 12 additions & 0 deletions installer/Page/HelpPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using installer.ViewModel;

namespace installer.Page;

public partial class HelpPage : ContentPage
{
public HelpPage(HelpViewModel viewModel)
{
InitializeComponent();
BindingContext = viewModel;
}
}
157 changes: 85 additions & 72 deletions installer/Page/InstallPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,90 +8,103 @@
<Grid
HorizontalOptions="Center"
WidthRequest="600"
RowDefinitions="*,*,*,*,*,*,*,*,*,*,*,*"
RowDefinitions="*,*,*,*,*,*,*,*,*,*,*"
ColumnDefinitions="*">

<HorizontalStackLayout
Grid.Row="1">
<Label
WidthRequest="100"
Text="文件路径:"
VerticalOptions="Center"
FontSize="16"/>
<Entry
WidthRequest="400"
Placeholder="请输入文件路径……"
Text="{Binding DownloadPath}"
ReturnCommand="{Binding DownloadBtnClickedCommand}"
FontSize="16"/>
<Button
WidthRequest="100"
Text="选择文件夹"
Command="{Binding BrowseBtnClickedCommand}"
IsEnabled="{Binding BrowseEnabled}"
BackgroundColor="{Binding ConstBackgroundColor}"
TextColor="{Binding ConstTextColor}"/>
</HorizontalStackLayout>

<Button
Grid.Row="2"
Text="下载"
Command="{Binding DownloadBtnClickedCommand}"
IsEnabled="{Binding DownloadEnabled}"
BackgroundColor="{Binding ConstBackgroundColor}"
FontSize="{Binding ConstFontSize}"
TextColor="{Binding ConstTextColor}"/>
<VerticalStackLayout
Grid.Row="1"
Grid.RowSpan="10"
HorizontalOptions="Center"
WidthRequest="600">

<HorizontalStackLayout>
<Label
WidthRequest="100"
Text="文件路径:"
VerticalOptions="Center"
FontSize="16"/>
<Entry
WidthRequest="400"
Placeholder="请输入文件路径……"
Text="{Binding DownloadPath}"
FontSize="16"/>
<Button
WidthRequest="100"
Text="选择文件夹"
BorderWidth="2"
Command="{Binding BrowseBtnClickedCommand}"
IsEnabled="{Binding BrowseEnabled}"
BackgroundColor="{Binding ConstBackgroundColor}"
TextColor="{Binding ConstTextColor}"/>
</HorizontalStackLayout>

<HorizontalStackLayout
Grid.Row="3">
<Button
WidthRequest="200"
Text="检查更新"
Command="{Binding CheckUpdBtnClickedCommand}"
IsEnabled="{Binding CheckEnabled}"
BackgroundColor="{Binding ConstBackgroundColor}"
FontSize="{Binding ConstFontSize}"
TextColor="{Binding ConstTextColor}"/>
<Button
WidthRequest="400"
Text="更新"
Command="{Binding UpdateBtnClickedCommand}"
IsEnabled="{Binding UpdateEnabled}"
Text="下载"
BorderWidth="2"
Command="{Binding DownloadBtnClickedCommand}"
IsEnabled="{Binding DownloadEnabled}"
BackgroundColor="{Binding ConstBackgroundColor}"
FontSize="{Binding ConstFontSize}"
TextColor="{Binding ConstTextColor}"/>
</HorizontalStackLayout>

<Label
Grid.Row="4"
Text="{Binding DebugAlert1}"/>
<Label
Grid.Row="5"
Text="{Binding DebugAlert2}"/>
<HorizontalStackLayout>
<Button
WidthRequest="200"
Text="检查更新"
BorderWidth="2"
Command="{Binding CheckUpdBtnClickedCommand}"
IsEnabled="{Binding CheckEnabled}"
BackgroundColor="{Binding ConstBackgroundColor}"
FontSize="{Binding ConstFontSize}"
TextColor="{Binding ConstTextColor}"/>
<Button
WidthRequest="400"
Text="更新"
BorderWidth="2"
Command="{Binding UpdateBtnClickedCommand}"
IsEnabled="{Binding UpdateEnabled}"
BackgroundColor="{Binding ConstBackgroundColor}"
FontSize="{Binding ConstFontSize}"
TextColor="{Binding ConstTextColor}"/>
</HorizontalStackLayout>

<Label
Text="{Binding DebugAlert1}"/>

<Frame
BorderColor="Gray"
Padding="3"
Margin="5"
WidthRequest="600"
HeightRequest="250">

<CollectionView
BackgroundColor="LightGray"
ItemsSource="{Binding LogCollection}"
ItemsUpdatingScrollMode="KeepLastItemInView"
VerticalScrollBarVisibility="Always">
<CollectionView.ItemTemplate>
<DataTemplate>
<Grid
ColumnDefinitions="*,*,*,*,*,*,*,*,*,*,*,*"
WidthRequest="570">

<Label
Grid.Column="1"
Grid.ColumnSpan="10"
Text="{Binding Message}"
TextColor="{Binding Color}"/>

</Grid>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>

<CollectionView
WidthRequest="570"
Grid.Row="6"
Grid.RowSpan="3"
BackgroundColor="Grey"
ItemsSource="{Binding Exceptions}"
ItemsUpdatingScrollMode="KeepLastItemInView"
VerticalScrollBarVisibility="Always">
<CollectionView.ItemTemplate>
<DataTemplate>
<Grid
HorizontalOptions="Center"
WidthRequest="550">
</Frame>

<Label
Text="{Binding Message}"
TextColor="Black"/>
</VerticalStackLayout>

</Grid>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>

</Grid>

</ContentPage>
Loading

0 comments on commit 5e8ee10

Please sign in to comment.