Skip to content

Commit

Permalink
Profile tests and improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
TrinityDevelopers committed Apr 5, 2020
1 parent 5798404 commit 2cd7750
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 58 deletions.
22 changes: 10 additions & 12 deletions ZenovaLauncher/PlayPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
mc:Ignorable="d">
<Page.Resources>
<ImageBrush x:Key="ImageBackground" ImageSource="zenova_background.png" Stretch="UniformToFill" />
<local:Profiles x:Key="CurrentProfiles" />
</Page.Resources>

<Grid>
Expand Down Expand Up @@ -59,25 +60,22 @@
<Grid Grid.Row="1" Grid.Column="0">
<ComboBox
Style="{StaticResource ProfileBoxStyle}"
ItemsSource="{Binding Source={StaticResource CurrentProfiles}}"
x:Name="ProfileCombo"
Margin="10,4,10,4"
MinWidth="200"
HorizontalContentAlignment="Left"
Background="Transparent"
BorderThickness="0"
SelectedIndex="0">
<ComboBoxItem>
<ui:SimpleStackPanel Spacing="4">
<TextBlock FontWeight="Bold" FontSize="14" Text="Latest release" />
<TextBlock FontSize="10" Text="1.14.30.2" />
</ui:SimpleStackPanel>
</ComboBoxItem>
<ComboBoxItem>
<ui:SimpleStackPanel Spacing="4">
<TextBlock FontWeight="Bold" FontSize="14" Text="Profile2" />
<TextBlock FontSize="10" Text="1.14.1.0" />
</ui:SimpleStackPanel>
</ComboBoxItem>
<ComboBox.ItemTemplate>
<DataTemplate>
<ui:SimpleStackPanel Spacing="4">
<TextBlock FontWeight="Bold" FontSize="14" Text="{Binding Path=ProfileName}" />
<TextBlock FontSize="10" Text="{Binding Path=VersionName}" />
</ui:SimpleStackPanel>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
</Grid>

Expand Down
10 changes: 10 additions & 0 deletions ZenovaLauncher/Profiles/Profile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@ public Profiles()
{
Add(new Profile("Latest release", new MinecraftVersion("1.14.30.2", "uuid", false)));
Add(new Profile("Latest beta", new MinecraftVersion("1.16.0.55", "uuid", true)));
Add(new Profile("This is a very long profile name that could potentially cause problems", new MinecraftVersion("1.14.30.2", "uuid", false)));
Add(new Profile("Profile1", new MinecraftVersion("1.14.30.2", "uuid", false)));
Add(new Profile("Profile2", new MinecraftVersion("1.14.30.2", "uuid", false)));
Add(new Profile("Profile3", new MinecraftVersion("1.14.30.2", "uuid", false)));
Add(new Profile("Profile4", new MinecraftVersion("1.14.30.2", "uuid", false)));
Add(new Profile("Profile5", new MinecraftVersion("1.14.30.2", "uuid", false)));
Add(new Profile("Profile6", new MinecraftVersion("1.14.30.2", "uuid", false)));
Add(new Profile("Profile7", new MinecraftVersion("1.14.30.2", "uuid", false)));
Add(new Profile("Profile8", new MinecraftVersion("1.14.30.2", "uuid", false)));
Add(new Profile("Profile9", new MinecraftVersion("1.14.30.2", "uuid", false)));
}
}
}
54 changes: 35 additions & 19 deletions ZenovaLauncher/ProfilesPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<ui:SimpleStackPanel Grid.Column="0" Orientation="Horizontal">
<Button Margin="0,0,15,0">
<Button x:Name="AddProfileButton" Margin="0,0,15,0">
<Button.Content>
<ui:SimpleStackPanel Orientation="Horizontal" Spacing="8" Margin="3">
<ui:SymbolIcon VerticalAlignment="Center" Symbol="Add" />
Expand All @@ -45,6 +45,7 @@
<ui:SimpleStackPanel Margin="17,0,10,0">
<TextBlock Margin="0,-8,0,0" FontSize="15" FontWeight="SemiBold" Typography.Capitals="AllSmallCaps" Text="Sort By" />
<ComboBox
x:Name="SortProfileBox"
Style="{DynamicResource StandardComboBoxStyle}"
SelectedIndex="0"
MinWidth="120"
Expand All @@ -65,32 +66,47 @@
<ui:SimpleStackPanel Margin="15,0,0,0">
<TextBlock Margin="0,-8,0,0" FontSize="15" FontWeight="SemiBold" Typography.Capitals="AllSmallCaps" Text="Versions" />
<ui:SimpleStackPanel Orientation="Horizontal" Spacing="13">
<CheckBox Style="{DynamicResource SmallCheckBoxStyle}" Content="Releases"></CheckBox>
<CheckBox Style="{DynamicResource SmallCheckBoxStyle}" Content="Beta Builds"></CheckBox>
<CheckBox Style="{DynamicResource SmallCheckBoxStyle}" Content="Historical"></CheckBox>
<CheckBox x:Name="ReleasesBox" Style="{DynamicResource SmallCheckBoxStyle}" Content="Releases"></CheckBox>
<CheckBox x:Name="BetasBox" Style="{DynamicResource SmallCheckBoxStyle}" Content="Beta Builds"></CheckBox>
<CheckBox x:Name="HistoricalBox" Style="{DynamicResource SmallCheckBoxStyle}" Content="Historical"></CheckBox>
</ui:SimpleStackPanel>
</ui:SimpleStackPanel>
</ui:SimpleStackPanel>
</Grid>
<Grid Grid.Row="1" HorizontalAlignment="Stretch">
<ListBox ItemsSource="{Binding Source={StaticResource CurrentProfiles}}" Style="{DynamicResource ProfileListBoxStyle}">
<ListBox
ItemsSource="{Binding Source={StaticResource CurrentProfiles}}"
Style="{DynamicResource ProfileListBoxStyle}">
<ListBox.ItemTemplate>
<DataTemplate>
<Grid MaxWidth="900" Margin="15,10,15,12" HorizontalAlignment="Stretch">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<ui:SimpleStackPanel Grid.Column="0" HorizontalAlignment="Left" Orientation="Horizontal">
<ui:SimpleStackPanel>
<TextBlock FontWeight="Bold" FontSize="16" Text="{Binding Path=ProfileName}" />
<TextBlock FontSize="12" Text="{Binding Path=VersionName}" />
<Grid>
<Grid MaxWidth="900" Height="1" VerticalAlignment="Top" Margin="15,0,15,0" SnapsToDevicePixels="True" Background="{DynamicResource AppBarSeparatorForeground}" />
<Grid MaxWidth="900" Margin="15,10,15,12" HorizontalAlignment="Stretch">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<ui:SimpleStackPanel Grid.Column="0" HorizontalAlignment="Left" Orientation="Horizontal">
<ui:SimpleStackPanel>
<TextBlock FontWeight="Bold" FontSize="16" Text="{Binding Path=ProfileName}" />
<TextBlock FontSize="12" Text="{Binding Path=VersionName}" />
</ui:SimpleStackPanel>
</ui:SimpleStackPanel>
</ui:SimpleStackPanel>
<ui:SimpleStackPanel Grid.Column="2" HorizontalAlignment="Right" Orientation="Horizontal">
<Button Content="Play" Style="{DynamicResource AccentButtonStyle}" />
</ui:SimpleStackPanel>
<ui:SimpleStackPanel Grid.Column="2" HorizontalAlignment="Right" Orientation="Horizontal" Spacing="5">
<Button Width="68" ui:ControlHelper.CornerRadius="0" Content="Play" FontWeight="Bold" Style="{DynamicResource AccentButtonStyle}" />
<Button ui:ControlHelper.CornerRadius="0" FontWeight="Bold">
<Button.Content>
<ui:SymbolIcon Symbol="More" />
</Button.Content>
<ui:FlyoutService.Flyout>
<ui:MenuFlyout Placement="Bottom">

</ui:MenuFlyout>
</ui:FlyoutService.Flyout>
</Button>
</ui:SimpleStackPanel>
</Grid>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
Expand Down
5 changes: 4 additions & 1 deletion ZenovaLauncher/Styles/LauncherTheme.xaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:ZenovaLauncher"
xmlns:ui="http://schemas.modernwpf.com/2019">
xmlns:ui="http://schemas.modernwpf.com/2019"
xmlns:sys="clr-namespace:System;assembly=mscorlib">

<Color x:Key="LauncherAltMediumColor">#FF303030</Color>
<Color x:Key="LauncherBaseMediumColor">#FF595959</Color>
Expand All @@ -13,4 +14,6 @@

<ui:StaticResource x:Key="CheckBoxCheckBackgroundStrokeUnchecked" ResourceKey="LauncherControlForegroundBaseMediumBrush" />
<SolidColorBrush x:Key="CheckBoxCheckBackgroundFillUncheckedPointerOver" Color="{ui:StaticColor SystemBaseHighColor}" Opacity="0.1" />

<sys:Boolean x:Key="AutoHideScrollBars">True</sys:Boolean>
</ResourceDictionary>
31 changes: 5 additions & 26 deletions ZenovaLauncher/Styles/ListBox.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
<Condition Property="IsSelected" Value="True" />
<Condition Property="IsMouseOver" Value="False" />
</MultiTrigger.Conditions>
<Setter TargetName="PressedBackground" Property="Fill" Value="{DynamicResource SystemControlHighlightListAccentLowBrush}" />
<Setter TargetName="PressedBackground" Property="Fill" Value="{DynamicResource SystemControlHighlightListMediumBrush}" />
<Setter TargetName="ContentPresenter" Property="TextElement.Foreground" Value="{DynamicResource SystemControlHighlightAltBaseHighBrush}" />
</MultiTrigger>
<!-- SelectedUnfocused -->
Expand All @@ -62,7 +62,7 @@
<Condition Property="IsSelected" Value="True" />
<Condition Property="IsMouseOver" Value="False" />
</MultiTrigger.Conditions>
<Setter TargetName="PressedBackground" Property="Fill" Value="{DynamicResource SystemControlHighlightListAccentLowBrush}" />
<Setter TargetName="PressedBackground" Property="Fill" Value="{DynamicResource SystemControlHighlightListMediumBrush}" />
<Setter TargetName="ContentPresenter" Property="TextElement.Foreground" Value="{DynamicResource SystemControlHighlightAltBaseHighBrush}" />
</MultiTrigger>
<!-- SelectedPointerOver -->
Expand All @@ -71,7 +71,7 @@
<Condition Property="IsSelected" Value="True" />
<Condition Property="IsMouseOver" Value="True" />
</MultiTrigger.Conditions>
<Setter TargetName="PressedBackground" Property="Fill" Value="{DynamicResource SystemControlHighlightListAccentMediumBrush}" />
<Setter TargetName="PressedBackground" Property="Fill" Value="{DynamicResource SystemControlHighlightListMediumBrush}" />
<Setter TargetName="ContentPresenter" Property="TextElement.Foreground" Value="{DynamicResource SystemControlHighlightAltBaseHighBrush}" />
</MultiTrigger>
</ControlTemplate.Triggers>
Expand All @@ -80,19 +80,12 @@
</Setter>
</Style>

<Style TargetType="ListBoxItem" BasedOn="{StaticResource DefaultListBoxItemStyle}" />

<Style x:Key="ProfileListBoxStyle" TargetType="ListBox">
<Setter Property="OverridesDefaultStyle" Value="True" />
<Setter Property="Foreground" Value="{DynamicResource SystemControlForegroundBaseHighBrush}" />
<Setter Property="Background" Value="{DynamicResource SystemControlBackgroundChromeMediumLowBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource SystemControlForegroundBaseHighBrush}" />
<Setter Property="BorderThickness" Value="{DynamicResource ListBoxBorderThemeThickness}" />
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" />
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
<Setter Property="ScrollViewer.IsDeferredScrollingEnabled" Value="False" />
<Setter Property="ScrollViewer.CanContentScroll" Value="true" />
<Setter Property="ScrollViewer.PanningMode" Value="VerticalOnly" />
<Setter Property="Stylus.IsFlicksEnabled" Value="False" />
<Setter Property="IsTabStop" Value="False" />
<Setter Property="KeyboardNavigation.TabNavigation" Value="Once" />
Expand All @@ -108,24 +101,10 @@
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Padding="{TemplateBinding Padding}"
SnapsToDevicePixels="true">
<ScrollViewer
x:Name="ScrollViewer"
Padding="{TemplateBinding Padding}"
Focusable="False"
ui:ScrollViewerHelper.AutoHideScrollBars="{TemplateBinding ui:ScrollViewerHelper.AutoHideScrollBars}">
<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</ScrollViewer>
<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Border>
<ControlTemplate.Triggers>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsGrouping" Value="true" />
<Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="false" />
</MultiTrigger.Conditions>
<Setter Property="ScrollViewer.CanContentScroll" Value="false" />
</MultiTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
Expand Down

0 comments on commit 2cd7750

Please sign in to comment.