client(ui): migrate to mvvm
This commit is contained in:
152
ModpackUpdater.Apps.Client.Gui/MainView.axaml
Normal file
152
ModpackUpdater.Apps.Client.Gui/MainView.axaml
Normal file
@@ -0,0 +1,152 @@
|
||||
<Window xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:lang="clr-namespace:ModpackUpdater.Apps.Client.Gui.LangRes"
|
||||
xmlns:pilz="https://git.pilzinsel64.de/pilz-framework/pilz"
|
||||
xmlns:gui="clr-namespace:ModpackUpdater.Apps.Client.Gui"
|
||||
xmlns:symbols="clr-namespace:Pilz.UI.Symbols;assembly=Pilz.UI"
|
||||
mc:Ignorable="d"
|
||||
x:Class="ModpackUpdater.Apps.Client.Gui.MainView"
|
||||
x:DataType="gui:MainViewModel"
|
||||
x:Name="window"
|
||||
Width="520"
|
||||
SizeToContent="Height"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
CanMaximize="false"
|
||||
Title="Minecraft Modpack Updater"
|
||||
Icon="/Assets/app.ico"
|
||||
Loaded="Control_OnLoaded">
|
||||
|
||||
<Design.DataContext>
|
||||
<gui:MainViewModel/>
|
||||
</Design.DataContext>
|
||||
|
||||
<Grid
|
||||
RowDefinitions="Auto,Auto,Auto,Auto,Auto"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Top"
|
||||
Margin="3"
|
||||
x:Name="MainGrid">
|
||||
|
||||
<Grid.IsEnabled>
|
||||
<MultiBinding Converter="{x:Static BoolConverters.And}">
|
||||
<Binding Path="HasInitialized"/>
|
||||
<Binding Path="!IsUpdating"/>
|
||||
</MultiBinding>
|
||||
</Grid.IsEnabled>
|
||||
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*" MinWidth="250"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!-- Labels -->
|
||||
<Label Grid.Row="0" Grid.Column="0" Margin="3" Content="{x:Static lang:GeneralLangRes.MinecraftProfile}" Target="TextBoxMinecraftProfileFolder"/>
|
||||
<Label Grid.Row="1" Grid.Column="0" Margin="3" Content="{x:Static lang:GeneralLangRes.ModpackConfigUrl}" Target="TextBoxModpackConfig"/>
|
||||
<Label Grid.Row="2" Grid.Column="0" Margin="3" IsVisible="{Binding CanUseExtrasKey}" Content="{x:Static lang:GeneralLangRes.InstallationKey}" Target="TextBoxInstallKey"/>
|
||||
<TextBlock Grid.Row="3" Grid.Column="0" Margin="3" Text="{x:Static lang:GeneralLangRes.Status}"/>
|
||||
<StackPanel Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="2" Margin="3" Orientation="Horizontal" Spacing="6" MinHeight="{Binding MinHeight, ElementName=TextBoxMinecraftProfileFolder}">
|
||||
<Image Width="{x:Static symbols:SymbolGlobals.DefaultImageSmallSize}" Source="{Binding StatusImage}"/>
|
||||
<TextBlock Text="{Binding StatusText}"/>
|
||||
</StackPanel>
|
||||
|
||||
<!-- TextBoxes: Profile -->
|
||||
<TextBox
|
||||
x:Name="TextBoxMinecraftProfileFolder"
|
||||
Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
Margin="3"
|
||||
VerticalAlignment="Center"
|
||||
Watermark="C:\..."
|
||||
Text="{Binding MinecraftProfileFolder}"/>
|
||||
|
||||
<!-- TextBoxes: ModpackConfig -->
|
||||
<TextBox
|
||||
x:Name="TextBoxModpackConfig"
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
Grid.ColumnSpan="2"
|
||||
Margin="3"
|
||||
VerticalAlignment="Center"
|
||||
Watermark="https://..."
|
||||
Text="{Binding ModpackConfigUrl}"/>
|
||||
|
||||
<!-- TextBoxes: InstallKey -->
|
||||
<TextBox
|
||||
x:Name="TextBoxInstallKey"
|
||||
Grid.Row="2"
|
||||
Grid.Column="1"
|
||||
Grid.ColumnSpan="2"
|
||||
Margin="3"
|
||||
VerticalAlignment="Center"
|
||||
Watermark="XXXXX-YYYYY-ZZZZZ-AAAAA-BBBBB"
|
||||
Text="{Binding InstallKey}"
|
||||
IsVisible="{Binding CanUseExtrasKey}"/>
|
||||
|
||||
<!-- Button: SearchProfileFolder -->
|
||||
<pilz:ImageSplitButton
|
||||
x:Name="ButtonSearchProfileFolder"
|
||||
Grid.Row="0"
|
||||
Grid.Column="2"
|
||||
Margin="3"
|
||||
VerticalAlignment="Stretch"
|
||||
HorizontalAlignment="Stretch"
|
||||
Text="{x:Static lang:GeneralLangRes.Select}"
|
||||
Click="ButtonSearchProfileFolder_Click">
|
||||
|
||||
<pilz:ImageSplitButton.DataTemplates>
|
||||
<DataTemplate DataType="gui:MainViewModel+EmptyRecentFilesItem">
|
||||
<TextBlock Text="{x:Static lang:GeneralLangRes.NoRecentProfilesAvailable}" FontStyle="Italic"/>
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate DataType="gui:MainViewModel+RecentFilesItem">
|
||||
<MenuItem Header="{Binding Display}" Command="{Binding DataContext.OpenRecentPathCommand, ElementName=window}" CommandParameter="{Binding Path}" />
|
||||
</DataTemplate>
|
||||
</pilz:ImageSplitButton.DataTemplates>
|
||||
|
||||
<pilz:ImageSplitButton.Flyout>
|
||||
<MenuFlyout ItemsSource="{Binding RecentMinecraftProfilePathItems}">
|
||||
<MenuFlyout.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<ContentControl Content="{Binding}"/>
|
||||
</DataTemplate>
|
||||
</MenuFlyout.ItemTemplate>
|
||||
</MenuFlyout>
|
||||
</pilz:ImageSplitButton.Flyout>
|
||||
</pilz:ImageSplitButton>
|
||||
|
||||
<!-- Button: CheckForUpdates -->
|
||||
<pilz:ImageButton
|
||||
x:Name="ButtonCheckForUpdates"
|
||||
Grid.Row="4"
|
||||
Grid.Column="1"
|
||||
Margin="3"
|
||||
VerticalAlignment="Stretch"
|
||||
HorizontalAlignment="Stretch"
|
||||
Text="{x:Static lang:GeneralLangRes.CheckForUpdates}"
|
||||
Command="{Binding CheckForUpdatesCommand}"
|
||||
IsEnabled="{Binding CanUpdate}"/>
|
||||
|
||||
<!-- Button: Install -->
|
||||
<pilz:ImageSplitButton
|
||||
x:Name="ButtonInstall"
|
||||
Grid.Row="4"
|
||||
Grid.Column="2"
|
||||
Margin="3"
|
||||
VerticalAlignment="Stretch"
|
||||
HorizontalAlignment="Stretch"
|
||||
HorizontalContentAlignment="Center"
|
||||
Text="{x:Static lang:GeneralLangRes.Install}"
|
||||
Command="{Binding InstallCommand}"
|
||||
IsEnabled="{Binding CanUpdate}">
|
||||
|
||||
<SplitButton.Flyout>
|
||||
<MenuFlyout>
|
||||
<MenuItem x:Name="MenuItemRepair" Header="{x:Static lang:GeneralLangRes.Repair}" Command="{Binding RepairCommand}"/>
|
||||
</MenuFlyout>
|
||||
</SplitButton.Flyout>
|
||||
</pilz:ImageSplitButton>
|
||||
</Grid>
|
||||
</Window>
|
||||
Reference in New Issue
Block a user