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">
|
2024-12-16 17:36:06 -08:00
|
|
|
<!-- Managed Repositories -->
|
|
|
|
<Grid Grid.Column="1" MinWidth="600" Margin="8" RowDefinitions="Auto,*" HorizontalAlignment="Center">
|
|
|
|
<!-- Search Box -->
|
|
|
|
<TextBox Grid.Row="0"
|
|
|
|
x:Name="SearchBox"
|
|
|
|
Height="32"
|
|
|
|
Padding="0"
|
|
|
|
CornerRadius="16"
|
|
|
|
BorderBrush="{DynamicResource Brush.Border0}"
|
|
|
|
BorderThickness="1"
|
|
|
|
Background="{DynamicResource Brush.Contents}"
|
|
|
|
Watermark="{DynamicResource Text.Welcome.Search}"
|
|
|
|
VerticalContentAlignment="Center"
|
|
|
|
Text="{Binding SearchFilter, Mode=TwoWay}"
|
|
|
|
v:AutoFocusBehaviour.IsEnabled="True">
|
|
|
|
<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-02-05 23:08:37 -08:00
|
|
|
|
2024-12-16 17:36:06 -08:00
|
|
|
<TextBox.InnerLeftContent>
|
|
|
|
<Path Width="16" Height="16" Margin="6,0,3,0" Data="{StaticResource Icons.Search}" Fill="{DynamicResource Brush.FG2}"/>
|
|
|
|
</TextBox.InnerLeftContent>
|
2024-02-05 23:08:37 -08:00
|
|
|
|
2024-12-16 17:36:06 -08:00
|
|
|
<TextBox.InnerRightContent>
|
|
|
|
<Button Classes="icon_button" IsVisible="{Binding SearchFilter, Converter={x:Static StringConverters.IsNotNullOrEmpty}}" Command="{Binding ClearSearchFilter}">
|
|
|
|
<Path Width="16" Height="16" Margin="0,0,0,0" Data="{StaticResource Icons.Clear}" Fill="{DynamicResource Brush.FG1}"/>
|
|
|
|
</Button>
|
|
|
|
</TextBox.InnerRightContent>
|
|
|
|
</TextBox>
|
2024-08-22 06:10:23 -07:00
|
|
|
|
2024-12-16 17:36:06 -08:00
|
|
|
<!-- Repository Tree -->
|
|
|
|
<v:RepositoryListBox 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>
|
2024-08-22 06:10:23 -07:00
|
|
|
|
2024-12-16 17:36:06 -08:00
|
|
|
<Style Selector="ListBoxItem" x:DataType="vm:RepositoryNode">
|
|
|
|
<Setter Property="Margin" Value="0"/>
|
|
|
|
<Setter Property="Padding" Value="0"/>
|
|
|
|
<Setter Property="Height" Value="30"/>
|
|
|
|
<Setter Property="CornerRadius" Value="4"/>
|
|
|
|
<Setter Property="FocusAdorner">
|
|
|
|
<FocusAdornerTemplate>
|
|
|
|
<Border Background="Transparent" BorderThickness="0"/>
|
|
|
|
</FocusAdornerTemplate>
|
|
|
|
</Setter>
|
|
|
|
</Style>
|
|
|
|
</ListBox.Styles>
|
2024-02-05 23:08:37 -08:00
|
|
|
|
2024-12-16 17:36:06 -08:00
|
|
|
<ListBox.ItemsPanel>
|
|
|
|
<ItemsPanelTemplate>
|
|
|
|
<VirtualizingStackPanel Orientation="Vertical"/>
|
|
|
|
</ItemsPanelTemplate>
|
|
|
|
</ListBox.ItemsPanel>
|
2024-07-12 02:42:03 -07:00
|
|
|
|
2024-12-16 17:36:06 -08:00
|
|
|
<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-12-16 17:36:06 -08:00
|
|
|
<ListBox.ItemTemplate>
|
|
|
|
<DataTemplate DataType="vm:RepositoryNode">
|
|
|
|
<Grid Background="Transparent"
|
|
|
|
Height="30"
|
|
|
|
ColumnDefinitions="16,18,Auto,*"
|
|
|
|
Margin="{Binding Depth, Converter={x:Static c:IntConverters.ToTreeMargin}}"
|
|
|
|
Loaded="SetupTreeNodeDragAndDrop"
|
|
|
|
ContextRequested="OnTreeNodeContextRequested"
|
|
|
|
PointerPressed="OnPointerPressedTreeNode"
|
|
|
|
PointerMoved="OnPointerMovedOverTreeNode"
|
|
|
|
PointerReleased="OnPointerReleasedOnTreeNode"
|
|
|
|
DoubleTapped="OnDoubleTappedTreeNode"
|
|
|
|
ClipToBounds="True">
|
|
|
|
<v:RepositoryTreeNodeToggleButton Grid.Column="0"
|
|
|
|
Classes="tree_expander"
|
|
|
|
Focusable="False"
|
|
|
|
HorizontalAlignment="Center"
|
|
|
|
IsChecked="{Binding IsExpanded, Mode=OneWay}"
|
|
|
|
IsVisible="{Binding !IsRepository}"/>
|
|
|
|
|
|
|
|
<Path Grid.Column="1"
|
|
|
|
Width="14" Height="14"
|
|
|
|
Fill="{Binding Bookmark, Converter={x:Static c:IntConverters.ToBookmarkBrush}}"
|
|
|
|
HorizontalAlignment="Center"
|
|
|
|
Data="{StaticResource Icons.Bookmark}"
|
|
|
|
IsVisible="{Binding IsRepository}"/>
|
|
|
|
|
|
|
|
<ToggleButton Grid.Column="1"
|
|
|
|
Classes="folder"
|
|
|
|
Focusable="False"
|
|
|
|
Width="14" Height="14"
|
|
|
|
HorizontalAlignment="Left"
|
|
|
|
Foreground="{DynamicResource Brush.FG1}"
|
|
|
|
IsChecked="{Binding IsExpanded}"
|
|
|
|
IsVisible="{Binding !IsRepository}"/>
|
|
|
|
|
|
|
|
<StackPanel Grid.Column="2" Orientation="Horizontal">
|
|
|
|
<TextBlock Classes="primary" VerticalAlignment="Center" Text="{Binding Name}"/>
|
|
|
|
<Path Margin="2,0,0,0"
|
|
|
|
Width="12" Height="12"
|
|
|
|
Data="{StaticResource Icons.Error}"
|
|
|
|
Fill="Orange"
|
|
|
|
IsVisible="{Binding IsInvalid}"/>
|
|
|
|
</StackPanel>
|
|
|
|
|
|
|
|
<Border Grid.Column="3" Margin="8,0" VerticalAlignment="Center" ClipToBounds="True">
|
|
|
|
<TextBlock Classes="primary"
|
|
|
|
HorizontalAlignment="Right"
|
2024-02-05 23:08:37 -08:00
|
|
|
Foreground="{DynamicResource Brush.FG2}"
|
2024-09-21 20:00:30 -07:00
|
|
|
Text="{Binding Id, Converter={x:Static c:PathConverters.RelativeToHome}}"
|
2024-02-05 23:08:37 -08:00
|
|
|
IsVisible="{Binding IsRepository}"/>
|
2024-12-16 17:36:06 -08:00
|
|
|
</Border>
|
|
|
|
</Grid>
|
|
|
|
</DataTemplate>
|
|
|
|
</ListBox.ItemTemplate>
|
|
|
|
</v:RepositoryListBox>
|
2024-02-05 23:08:37 -08:00
|
|
|
</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>
|