250 lines
12 KiB
XML
250 lines
12 KiB
XML
<Window xmlns="https://github.com/avaloniaui"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:vm="using:BetterRaid.ViewModels"
|
|
xmlns:con="using:BetterRaid.Converters"
|
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
xmlns:ai="using:AsyncImageLoader"
|
|
xmlns:misc="using:BetterRaid.Misc"
|
|
mc:Ignorable="d"
|
|
d:DesignWidth="600"
|
|
d:DesignHeight="800"
|
|
Width="600"
|
|
Height="800"
|
|
x:Class="BetterRaid.Views.MainWindow"
|
|
x:DataType="vm:MainWindowViewModel"
|
|
Icon="/Assets/logo.png"
|
|
Title="BetterRaid"
|
|
Background="DarkSlateGray">
|
|
|
|
<Window.Resources>
|
|
<con:ChannelOnlineColorConverter x:Key="ChannelOnlineColorConverter" />
|
|
</Window.Resources>
|
|
|
|
<Grid HorizontalAlignment="Stretch"
|
|
VerticalAlignment="Stretch"
|
|
ColumnDefinitions="Auto,*"
|
|
RowDefinitions="50,*">
|
|
|
|
<StackPanel Grid.Column="0"
|
|
Grid.Row="0"
|
|
Orientation="Horizontal">
|
|
<ai:AdvancedImage CornerRadius="20"
|
|
Width="40"
|
|
Height="40"
|
|
Margin="5"
|
|
Source="{Binding Twitch.UserChannel.ThumbnailUrl,
|
|
FallbackValue={x:Static misc:Constants.ChannelPlaceholderImageUrl},
|
|
TargetNullValue={x:Static misc:Constants.ChannelPlaceholderImageUrl}}" />
|
|
|
|
<TextBlock VerticalAlignment="Center"
|
|
Margin="5, 0, 0, 0"
|
|
FontWeight="Bold">
|
|
<TextBlock.Text>
|
|
<MultiBinding StringFormat="{}{0} ({1})">
|
|
<Binding Path="Twitch.UserChannel.DisplayName"
|
|
FallbackValue="-" />
|
|
<Binding Path="Twitch.UserChannel.ViewerCount"
|
|
FallbackValue="Offline"
|
|
TargetNullValue="Offline" />
|
|
</MultiBinding>
|
|
</TextBlock.Text>
|
|
</TextBlock>
|
|
</StackPanel>
|
|
|
|
<StackPanel Grid.Column="1"
|
|
Grid.Row="0"
|
|
Orientation="Horizontal"
|
|
HorizontalAlignment="Right"
|
|
Spacing="5">
|
|
|
|
<CheckBox Content="Only Online"
|
|
IsChecked="{Binding OnlyOnline, Mode=TwoWay, FallbackValue=False}" />
|
|
|
|
<TextBox Width="200"
|
|
Margin="5, 10, 5, 10"
|
|
Watermark="Filter Channels"
|
|
Text="{Binding Filter, Mode=TwoWay}"
|
|
HorizontalAlignment="Right" />
|
|
|
|
</StackPanel>
|
|
|
|
<Button Grid.Column="0"
|
|
Grid.ColumnSpan="2"
|
|
Grid.Row="1"
|
|
HorizontalAlignment="Center"
|
|
VerticalAlignment="Center"
|
|
Width="200"
|
|
Height="50"
|
|
Command="{Binding LoginWithTwitch}"
|
|
IsVisible="{Binding !IsLoggedIn, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}">
|
|
|
|
<Button.Styles>
|
|
<Style Selector="Button">
|
|
<Setter Property="Background" Value="#6441a5" />
|
|
</Style>
|
|
<Style Selector="Button:pointerover /template/ ContentPresenter">
|
|
<Setter Property="Background" Value="#6C4CA5" />
|
|
</Style>
|
|
</Button.Styles>
|
|
|
|
<StackPanel Orientation="Horizontal">
|
|
<TextBlock Text="Login with Twitch"
|
|
Foreground="#f1f1f1"
|
|
FontSize="18"
|
|
VerticalAlignment="Center" />
|
|
<Image Source="avares://BetterRaid/Assets/glitch_flat_white.png"
|
|
Width="24"
|
|
Height="24"
|
|
VerticalAlignment="Center"
|
|
Margin="5, 0, 0, 0" />
|
|
</StackPanel>
|
|
|
|
</Button>
|
|
|
|
<ScrollViewer Grid.Column="0"
|
|
Grid.ColumnSpan="2"
|
|
Grid.Row="1"
|
|
IsVisible="{Binding IsLoggedIn, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
|
|
HorizontalScrollBarVisibility="Disabled"
|
|
VerticalScrollBarVisibility="Auto">
|
|
|
|
<ScrollViewer.GestureRecognizers>
|
|
<ScrollGestureRecognizer CanHorizontallyScroll="False"
|
|
CanVerticallyScroll="True"
|
|
IsScrollInertiaEnabled="True" />
|
|
</ScrollViewer.GestureRecognizers>
|
|
|
|
<ListBox Items="{Binding Channels, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
|
|
SelectionMode="Single"
|
|
SelectionChanged="SelectingItemsControl_OnSelectionChanged">
|
|
|
|
<ListBox.ItemsPanel>
|
|
<ItemsPanelTemplate>
|
|
<VirtualizingStackPanel Orientation="Vertical" />
|
|
</ItemsPanelTemplate>
|
|
</ListBox.ItemsPanel>
|
|
|
|
<ListBox.ItemTemplate>
|
|
<DataTemplate>
|
|
<Grid ColumnDefinitions="100, *, 120"
|
|
RowDefinitions="100">
|
|
|
|
<ai:AdvancedImage Grid.Column="0"
|
|
Grid.Row="0"
|
|
Source="{Binding ThumbnailUrl, TargetNullValue={x:Static misc:Constants.ChannelPlaceholderImageUrl}}" />
|
|
|
|
<Border Grid.Column="0"
|
|
Grid.Row="0"
|
|
HorizontalAlignment="Right"
|
|
VerticalAlignment="Bottom"
|
|
Height="25"
|
|
MinWidth="25"
|
|
CornerRadius="12.5"
|
|
Background="{Binding IsLive, Converter={StaticResource ChannelOnlineColorConverter}}"
|
|
Padding="0"
|
|
Margin="0, 0, 5, 5">
|
|
|
|
<TextBlock Text="{Binding ViewerCount, TargetNullValue='-', Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
|
|
FontSize="12"
|
|
TextAlignment="Center"
|
|
FontWeight="SemiBold"
|
|
Padding="0"
|
|
Margin="5"
|
|
Foreground="Black"/>
|
|
</Border>
|
|
|
|
<Grid Grid.Column="1"
|
|
Grid.Row="0"
|
|
Margin="10, 0, 0, 0"
|
|
ColumnDefinitions="100, *"
|
|
RowDefinitions="20, 20, 40, 20">
|
|
<TextBlock Grid.Column="0"
|
|
Grid.Row="0"
|
|
Grid.ColumnSpan="2"
|
|
FontWeight="Bold"
|
|
TextDecorations="Underline"
|
|
Text="{Binding Name, TargetNullValue='???'}" />
|
|
|
|
<TextBlock Grid.Column="0"
|
|
Grid.Row="1"
|
|
Text="Category:"
|
|
FontWeight="SemiBold" />
|
|
|
|
<TextBlock Grid.Column="0"
|
|
Grid.Row="2"
|
|
Text="Title:"
|
|
FontWeight="SemiBold" />
|
|
|
|
<TextBlock Grid.Column="0"
|
|
Grid.Row="3"
|
|
Text="Last Raided:"
|
|
FontWeight="SemiBold" />
|
|
|
|
<TextBlock Grid.Column="1"
|
|
Grid.Row="1"
|
|
Text="{Binding Category, TargetNullValue='-'}" />
|
|
|
|
<TextBlock Grid.Column="1"
|
|
Grid.Row="2"
|
|
TextWrapping="Wrap"
|
|
Text="{Binding Title, TargetNullValue='-'}" />
|
|
|
|
<TextBlock Grid.Column="1"
|
|
Grid.Row="3"
|
|
Text="{Binding LastRaided, TargetNullValue='Never Raided'}" />
|
|
</Grid>
|
|
|
|
<StackPanel Grid.Column="2"
|
|
Grid.Row="0"
|
|
HorizontalAlignment="Stretch"
|
|
VerticalAlignment="Stretch">
|
|
|
|
<Button Content="Start Raid"
|
|
Height="50"
|
|
Margin="0"
|
|
CornerRadius="0"
|
|
Background="ForestGreen"
|
|
HorizontalAlignment="Stretch"
|
|
VerticalAlignment="Stretch"
|
|
HorizontalContentAlignment="Center"
|
|
VerticalContentAlignment="Center"
|
|
IsEnabled="{Binding IsLive}"
|
|
IsVisible="{Binding !$parent[Window].((vm:MainWindowViewModel)DataContext).Twitch.IsRaidStarted}"
|
|
Command="{Binding $parent[Window].((vm:MainWindowViewModel)DataContext).Twitch.StartRaidCommand}"
|
|
CommandParameter="{Binding BroadcasterId}" />
|
|
|
|
<Button Content="Cancel Raid"
|
|
Height="50"
|
|
Margin="0"
|
|
CornerRadius="0"
|
|
Background="DarkRed"
|
|
HorizontalAlignment="Stretch"
|
|
VerticalAlignment="Stretch"
|
|
HorizontalContentAlignment="Center"
|
|
VerticalContentAlignment="Center"
|
|
IsVisible="{Binding $parent[Window].((vm:MainWindowViewModel)DataContext).Twitch.IsRaidStarted}"
|
|
Command="{Binding $parent[Window].((vm:MainWindowViewModel)DataContext).Twitch.StopRaidCommand}" />
|
|
|
|
<Button Content="View Channel"
|
|
Height="50"
|
|
CornerRadius="0"
|
|
Margin="0"
|
|
HorizontalAlignment="Stretch"
|
|
VerticalAlignment="Stretch"
|
|
HorizontalContentAlignment="Center"
|
|
VerticalContentAlignment="Center"
|
|
Command="{Binding $parent[Window].((vm:MainWindowViewModel)DataContext).Twitch.OpenChannelCommand}"
|
|
CommandParameter="{Binding Name}" />
|
|
</StackPanel>
|
|
</Grid>
|
|
</DataTemplate>
|
|
</ListBox.ItemTemplate>
|
|
</ListBox>
|
|
|
|
</ScrollViewer>
|
|
|
|
</Grid>
|
|
|
|
</Window>
|