Files
WinWARP/WinWARP.Ui/Views/SubsSettingsPage.xaml
T
2026-09-22 15:23:39 +03:00

153 lines
9.1 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<Page
x:Class="WinWARP.Ui.Views.SubsSettingsPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:WinWARP.Ui.Views"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:com="using:CommunityToolkit.WinUI.Controls"
xmlns:conv="using:WinWARP.Ui.Converters"
xmlns:c="using:WinWARP.Ui.Views.Components"
xmlns:vm="using:WinWARP.Core.ViewModels"
xmlns:w="using:WinWARP.Core.ViewModels.Wrappers"
xmlns:u="using:WinUI3Localizer"
mc:Ignorable="d">
<Page.Resources>
<conv:BoolToVisibilityConverter x:Key="BoolToVisConverter" />
</Page.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<com:TabbedCommandBar Margin="8,0">
<com:TabbedCommandBar.PaneFooter>
<CommandBar Background="Transparent" DefaultLabelPosition="Right">
<AppBarButton u:Uids.Uid="SubsSettingsCommandCommandEnable">
<AppBarButton.Icon>
<FontIcon Glyph="&#xE8FB;" />
</AppBarButton.Icon>
</AppBarButton>
<AppBarButton u:Uids.Uid="SubsSettingsCommandCommandDisable">
<AppBarButton.Icon>
<FontIcon Glyph="&#xE733;" />
</AppBarButton.Icon>
</AppBarButton>
<AppBarButton u:Uids.Uid="SubsSettingsCommandCommandDelete">
<AppBarButton.Icon>
<FontIcon Glyph="&#xE74D;" />
</AppBarButton.Icon>
</AppBarButton>
</CommandBar>
</com:TabbedCommandBar.PaneFooter>
<com:TabbedCommandBar.MenuItems>
<com:TabbedCommandBarItem u:Uids.Uid="SubsSettingsCommandTabSubs">
<AppBarButton u:Uids.Uid="SubsSettingsCommandAddSub" Command="{x:Bind ViewModel.AddSubscriptionCommand}">
<AppBarButton.Icon>
<FontIcon Glyph="&#xED0E;" />
</AppBarButton.Icon>
</AppBarButton>
<AppBarSeparator/>
<AppBarToggleButton u:Uids.Uid="SubsSettingsCommandSelSub">
<AppBarToggleButton.Icon>
<FontIcon Glyph="&#xE8FD;" />
</AppBarToggleButton.Icon>
</AppBarToggleButton>
<AppBarButton u:Uids.Uid="SubsSettingsCommandSelAll">
<AppBarButton.Icon>
<FontIcon Glyph="&#xE8B3;" />
</AppBarButton.Icon>
</AppBarButton>
</com:TabbedCommandBarItem>
<com:TabbedCommandBarItem u:Uids.Uid="SubsSettingsCommandTabServ">
<AppBarButton u:Uids.Uid="SubsSettingsCommandAddServLink">
<AppBarButton.Icon>
<FontIcon Glyph="&#xE71B;" />
</AppBarButton.Icon>
</AppBarButton>
<AppBarButton u:Uids.Uid="SubsSettingsCommandAddServFile">
<AppBarButton.Icon>
<FontIcon Glyph="&#xE8E5;" />
</AppBarButton.Icon>
</AppBarButton>
<AppBarSeparator/>
<AppBarToggleButton u:Uids.Uid="SubsSettingsCommandSelServ">
<AppBarToggleButton.Icon>
<FontIcon Glyph="&#xF207;" />
</AppBarToggleButton.Icon>
</AppBarToggleButton>
<AppBarButton u:Uids.Uid="SubsSettingsCommandSelAll">
<AppBarButton.Icon>
<FontIcon Glyph="&#xE8B3;" />
</AppBarButton.Icon>
</AppBarButton>
</com:TabbedCommandBarItem>
</com:TabbedCommandBar.MenuItems>
</com:TabbedCommandBar>
<ScrollView Grid.Row="1" CornerRadius="4">
<ItemsView ItemsSource="{x:Bind ViewModel.Subscriptions}" SelectionMode="Multiple" HorizontalAlignment="Stretch">
<ItemsView.Layout>
<StackLayout/>
</ItemsView.Layout>
<ItemsView.ItemTemplate>
<DataTemplate x:DataType="w:SubscriptionViewModel">
<ItemContainer Margin="8,8,8,0" Background="{ThemeResource CardBackgroundFillColorDefaultBrush}" VerticalContentAlignment="Center">
<Expander HorizontalAlignment="Stretch" Margin="0,0,28,0">
<Expander.ContextFlyout>
<MenuFlyout x:Name="SubscritionListFlyout">
<MenuFlyoutItem u:Uids.Uid="{x:Bind GetUidForNameEditing(IsNameEditing), Mode=OneWay}" Command="{x:Bind EditNameCommand}">
<MenuFlyoutItem.Icon>
<FontIcon Glyph="{x:Bind GetGlyphForNameEditing(IsNameEditing), Mode=OneWay}"/>
</MenuFlyoutItem.Icon>
</MenuFlyoutItem>
<ToggleMenuFlyoutItem u:Uids.Uid="SubscriptionListElementMenuFlyoutIsDisabled" IsChecked="{x:Bind IsDisabled, Mode=TwoWay}">
<ToggleMenuFlyoutItem.Icon>
<FontIcon Glyph="&#xE7E8;" />
</ToggleMenuFlyoutItem.Icon>
</ToggleMenuFlyoutItem>
<MenuFlyoutSeparator/>
<MenuFlyoutItem u:Uids.Uid="SubscriptionListElementMenuFlyoutDelete" Command="{x:Bind DeleteCommand}">
<MenuFlyoutItem.Icon>
<FontIcon Glyph="&#xE74D;" />
</MenuFlyoutItem.Icon>
</MenuFlyoutItem>
</MenuFlyout>
</Expander.ContextFlyout>
<Expander.Header>
<StackPanel Orientation="Horizontal">
<TextBox Text="{x:Bind Title, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" u:Uids.Uid="SubscriptionListElementTitleTextBox"
Style="{StaticResource BodyStrongTextBlockStyle}" Visibility="{x:Bind IsNameEditing, Converter={StaticResource BoolToVisConverter}, Mode=OneWay}"
VerticalAlignment="Center"/>
<TextBlock Text="{x:Bind GetTitle, Mode=OneWay}" Style="{StaticResource BodyStrongTextBlockStyle}" Visibility="{x:Bind IsNameEditing, Converter={StaticResource BoolToVisConverter}, ConverterParameter=True, Mode=OneWay}"
VerticalAlignment="Center"/>
<TextBlock Text="{x:Bind DefaultTitle, Mode=OneWay}" Style="{StaticResource BodyTextBlockStyle}" Visibility="{x:Bind IsNotDefaultTitle, Converter={StaticResource BoolToVisConverter}, Mode=OneWay}"
VerticalAlignment="Center" Margin="8"/>
</StackPanel>
</Expander.Header>
<ItemsView ItemsSource="{x:Bind Servers}" SelectionMode="Multiple">
<ItemsView.Layout>
<UniformGridLayout Orientation="Horizontal" ItemsStretch="None" ItemsJustification="SpaceAround"/>
</ItemsView.Layout>
<ItemsView.ItemTemplate>
<DataTemplate x:DataType="vm:ServerItemViewModel">
<ItemContainer Margin="6">
<c:ServerListElement ServerData="{x:Bind}"/>
</ItemContainer>
</DataTemplate>
</ItemsView.ItemTemplate>
</ItemsView>
</Expander>
</ItemContainer>
</DataTemplate>
</ItemsView.ItemTemplate>
</ItemsView>
</ScrollView>
<TextBlock Grid.Row="1" u:Uids.Uid="SubsSettingsEmtpyText" Style="{ThemeResource BodyLargeTextBlockStyle}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Grid>
</Page>