2024-02-05 23:08:37 -08:00
|
|
|
<UserControl 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:c="using:SourceGit.Converters"
|
|
|
|
xmlns:vm="using:SourceGit.ViewModels"
|
2024-08-19 02:24:39 -07:00
|
|
|
xmlns:v="using:SourceGit.Views"
|
2024-02-05 23:08:37 -08:00
|
|
|
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
|
|
|
x:Class="SourceGit.Views.Welcome"
|
|
|
|
x:DataType="vm:Welcome">
|
2024-07-14 09:30:31 -07:00
|
|
|
<Grid RowDefinitions="*,36">
|
|
|
|
<Grid Grid.Row="0" Margin="0,8" ColumnDefinitions="*,600,*">
|
2024-02-05 23:08:37 -08:00
|
|
|
<Grid Grid.Column="1" RowDefinitions="Auto,*">
|
2024-08-22 06:10:23 -07:00
|
|
|
<!-- Search Box -->
|
2024-03-11 03:54:12 -07:00
|
|
|
<TextBox Grid.Row="0"
|
2024-08-22 06:10:23 -07:00
|
|
|
x:Name="SearchBox"
|
2024-03-11 03:54:12 -07:00
|
|
|
Height="32"
|
|
|
|
Padding="0"
|
|
|
|
CornerRadius="16"
|
|
|
|
BorderBrush="{DynamicResource Brush.Border0}"
|
|
|
|
BorderThickness="1"
|
|
|
|
Background="{DynamicResource Brush.Contents}"
|
|
|
|
Watermark="{DynamicResource Text.Welcome.Search}"
|
|
|
|
VerticalContentAlignment="Center"
|
2024-08-19 02:24:39 -07:00
|
|
|
Text="{Binding SearchFilter, Mode=TwoWay}"
|
|
|
|
v:AutoFocusBehaviour.IsEnabled="True">
|
2024-08-23 03:05:09 -07:00
|
|
|
<TextBox.Styles>
|
|
|
|
<Style Selector="TextBox:pointerover /template/ Border#PART_BorderElement">
|
|
|
|
<Setter Property="BorderBrush" Value="{DynamicResource Brush.Border0}"/>
|
|
|
|
</Style>
|
|
|
|
<Style Selector="TextBox:focus /template/ Border#PART_BorderElement">
|
|
|
|
<Setter Property="BorderBrush" Value="{DynamicResource Brush.Border0}"/>
|
|
|
|
</Style>
|
|
|
|
</TextBox.Styles>
|
|
|
|
|
2024-03-11 03:54:12 -07:00
|
|
|
<TextBox.InnerLeftContent>
|
2024-07-15 00:40:15 -07:00
|
|
|
<Path Width="16" Height="16" Margin="6,0,3,0" Data="{StaticResource Icons.Search}" Fill="{DynamicResource Brush.FG2}"/>
|
2024-03-11 03:54:12 -07:00
|
|
|
</TextBox.InnerLeftContent>
|
2024-02-05 23:08:37 -08:00
|
|
|
|
2024-03-11 03:54:12 -07:00
|
|
|
<TextBox.InnerRightContent>
|
2024-05-06 23:12:33 -07:00
|
|
|
<Button Classes="icon_button" IsVisible="{Binding SearchFilter, Converter={x:Static StringConverters.IsNotNullOrEmpty}}" Command="{Binding ClearSearchFilter}">
|
2024-03-11 03:54:12 -07:00
|
|
|
<Path Width="16" Height="16" Margin="0,0,0,0" Data="{StaticResource Icons.Clear}" Fill="{DynamicResource Brush.FG1}"/>
|
|
|
|
</Button>
|
|
|
|
</TextBox.InnerRightContent>
|
|
|
|
</TextBox>
|
2024-02-05 23:08:37 -08:00
|
|
|
|
2024-08-22 06:10:23 -07:00
|
|
|
<!-- Repository Tree -->
|
|
|
|
<ListBox Grid.Row="1"
|
|
|
|
x:Name="TreeContainer"
|
|
|
|
Margin="0,8,8,0"
|
|
|
|
Focusable="True"
|
|
|
|
Background="Transparent"
|
|
|
|
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
|
|
|
|
ScrollViewer.VerticalScrollBarVisibility="Auto"
|
|
|
|
ItemsSource="{Binding Rows}"
|
|
|
|
SelectionMode="Single"
|
|
|
|
Loaded="SetupTreeViewDragAndDrop"
|
|
|
|
LostFocus="OnTreeViewLostFocus"
|
|
|
|
KeyDown="OnTreeViewKeyDown">
|
|
|
|
<ListBox.Styles>
|
|
|
|
<Style Selector="ListBox">
|
|
|
|
<Setter Property="FocusAdorner">
|
|
|
|
<FocusAdornerTemplate>
|
|
|
|
<Border Background="Transparent" BorderThickness="0"/>
|
|
|
|
</FocusAdornerTemplate>
|
|
|
|
</Setter>
|
|
|
|
</Style>
|
|
|
|
|
|
|
|
<Style Selector="ListBoxItem" x:DataType="vm:RepositoryNode">
|
|
|
|
<Setter Property="Margin" Value="0"/>
|
|
|
|
<Setter Property="Padding" Value="0"/>
|
|
|
|
<Setter Property="Height" Value="30"/>
|
2024-02-05 23:08:37 -08:00
|
|
|
<Setter Property="CornerRadius" Value="4"/>
|
2024-08-22 00:45:50 -07:00
|
|
|
<Setter Property="FocusAdorner">
|
|
|
|
<FocusAdornerTemplate>
|
|
|
|
<Border Background="Transparent" BorderThickness="0"/>
|
|
|
|
</FocusAdornerTemplate>
|
|
|
|
</Setter>
|
2024-02-05 23:08:37 -08:00
|
|
|
</Style>
|
2024-08-22 06:10:23 -07:00
|
|
|
</ListBox.Styles>
|
|
|
|
|
|
|
|
<ListBox.ItemsPanel>
|
|
|
|
<ItemsPanelTemplate>
|
|
|
|
<VirtualizingStackPanel Orientation="Vertical"/>
|
|
|
|
</ItemsPanelTemplate>
|
|
|
|
</ListBox.ItemsPanel>
|
|
|
|
|
|
|
|
<ListBox.ContextMenu>
|
|
|
|
<ContextMenu>
|
|
|
|
<MenuItem Header="{DynamicResource Text.Welcome.AddRootFolder}" Command="{Binding AddRootNode}">
|
|
|
|
<MenuItem.Icon>
|
|
|
|
<Path Width="12" Height="12" Data="{DynamicResource Icons.Folder.Add}"/>
|
|
|
|
</MenuItem.Icon>
|
|
|
|
</MenuItem>
|
|
|
|
</ContextMenu>
|
|
|
|
</ListBox.ContextMenu>
|
2024-02-05 23:08:37 -08:00
|
|
|
|
2024-08-22 06:10:23 -07:00
|
|
|
<ListBox.ItemTemplate>
|
|
|
|
<DataTemplate DataType="vm:RepositoryNode">
|
|
|
|
<Grid Background="Transparent"
|
2024-08-22 06:57:39 -07:00
|
|
|
Height="30"
|
2024-08-22 06:10:23 -07:00
|
|
|
ColumnDefinitions="16,18,Auto,*"
|
|
|
|
Margin="{Binding Depth, Converter={x:Static c:IntConverters.ToTreeMargin}}"
|
2024-04-27 22:51:44 -07:00
|
|
|
Loaded="SetupTreeNodeDragAndDrop"
|
|
|
|
ContextRequested="OnTreeNodeContextRequested"
|
2024-02-05 23:08:37 -08:00
|
|
|
PointerPressed="OnPointerPressedTreeNode"
|
|
|
|
PointerMoved="OnPointerMovedOverTreeNode"
|
|
|
|
PointerReleased="OnPointerReleasedOnTreeNode"
|
|
|
|
DoubleTapped="OnDoubleTappedTreeNode"
|
|
|
|
ClipToBounds="True">
|
2024-08-22 06:10:23 -07:00
|
|
|
<v:RepositoryTreeNodeToggleButton Grid.Column="0"
|
|
|
|
Classes="tree_expander"
|
|
|
|
Focusable="False"
|
|
|
|
HorizontalAlignment="Center"
|
|
|
|
IsChecked="{Binding IsExpanded, Mode=OneWay}"
|
|
|
|
IsVisible="{Binding !IsRepository}"/>
|
|
|
|
|
|
|
|
<Path Grid.Column="1"
|
2024-07-15 00:40:15 -07:00
|
|
|
Width="14" Height="14"
|
2024-02-05 23:08:37 -08:00
|
|
|
Fill="{Binding Bookmark, Converter={x:Static c:BookmarkConverters.ToBrush}}"
|
2024-07-15 00:40:15 -07:00
|
|
|
HorizontalAlignment="Center"
|
2024-02-05 23:08:37 -08:00
|
|
|
Data="{StaticResource Icons.Bookmark}"
|
|
|
|
IsVisible="{Binding IsRepository}"/>
|
2024-07-12 02:42:03 -07:00
|
|
|
|
2024-08-22 06:10:23 -07:00
|
|
|
<ToggleButton Grid.Column="1"
|
2024-07-12 02:42:03 -07:00
|
|
|
Classes="folder"
|
|
|
|
Focusable="False"
|
2024-07-15 00:40:15 -07:00
|
|
|
Width="14" Height="14"
|
|
|
|
HorizontalAlignment="Left"
|
2024-07-12 02:42:03 -07:00
|
|
|
Foreground="{DynamicResource Brush.FG1}"
|
|
|
|
IsChecked="{Binding IsExpanded}"
|
|
|
|
IsVisible="{Binding !IsRepository}"/>
|
2024-02-05 23:08:37 -08:00
|
|
|
|
2024-08-22 06:10:23 -07:00
|
|
|
<TextBlock Grid.Column="2"
|
|
|
|
Classes="primary"
|
|
|
|
VerticalAlignment="Center"
|
|
|
|
Text="{Binding Name}"/>
|
|
|
|
<TextBlock Grid.Column="3"
|
2024-07-29 05:48:04 -07:00
|
|
|
Classes="primary"
|
2024-02-05 23:08:37 -08:00
|
|
|
Margin="8,0"
|
|
|
|
HorizontalAlignment="Right" VerticalAlignment="Center"
|
|
|
|
Foreground="{DynamicResource Brush.FG2}"
|
|
|
|
Text="{Binding Id}"
|
|
|
|
IsVisible="{Binding IsRepository}"/>
|
|
|
|
</Grid>
|
2024-08-22 06:10:23 -07:00
|
|
|
</DataTemplate>
|
|
|
|
</ListBox.ItemTemplate>
|
|
|
|
</ListBox>
|
2024-02-05 23:08:37 -08:00
|
|
|
</Grid>
|
|
|
|
</Grid>
|
|
|
|
|
2024-08-22 06:10:23 -07:00
|
|
|
<!-- Tips -->
|
2024-07-14 09:30:31 -07:00
|
|
|
<TextBlock Grid.Row="1"
|
2024-02-05 23:08:37 -08:00
|
|
|
Classes="italic"
|
|
|
|
Margin="0,0,8,0"
|
|
|
|
HorizontalAlignment="Center" VerticalAlignment="Center"
|
2024-06-21 02:48:19 -07:00
|
|
|
FontSize="{Binding Source={x:Static vm:Preference.Instance}, Path=DefaultFontSize, Converter={x:Static c:DoubleConverters.Decrease}}"
|
2024-02-05 23:08:37 -08:00
|
|
|
Text="{DynamicResource Text.Welcome.DragDropTip}"
|
|
|
|
Foreground="{DynamicResource Brush.FG2}"/>
|
|
|
|
</Grid>
|
|
|
|
</UserControl>
|