sourcegit/src/Views/Launcher.axaml

185 lines
9.1 KiB
Text
Raw Normal View History

<v:ChromelessWindow 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:s="using:SourceGit"
xmlns:vm="using:SourceGit.ViewModels"
xmlns:m="using:SourceGit.Models"
xmlns:c="using:SourceGit.Converters"
xmlns:v="using:SourceGit.Views"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="SourceGit.Views.Launcher"
x:DataType="vm:Launcher"
Icon="/App.ico"
Title="SourceGit"
MinWidth="1280" MinHeight="720"
WindowStartupLocation="CenterScreen">
<Grid x:Name="MainLayout">
<Grid.RowDefinitions>
<RowDefinition Height="38"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- Custom TitleBar -->
<Grid Grid.Row="0" ColumnDefinitions="Auto,*,Auto">
<!-- Bottom border -->
2024-03-07 19:13:53 -08:00
<Border Grid.Column="0" Grid.ColumnSpan="3"
Background="{DynamicResource Brush.TitleBar}"
BorderThickness="0,0,0,1" BorderBrush="{DynamicResource Brush.Border0}"
DoubleTapped="OnTitleBarDoubleTapped"
PointerPressed="BeginMoveWindow"
PointerMoved="MoveWindow"
PointerReleased="EndMoveWindow"/>
<!-- Caption Buttons (macOS) -->
2024-03-07 19:13:53 -08:00
<Border Grid.Column="0" VerticalAlignment="Stretch" Margin="2,0,8,3" IsVisible="{OnPlatform False, macOS=True}">
<v:CaptionButtonsMacOS VerticalAlignment="Bottom"/>
</Border>
<!-- Menu (Windows/Linux) -->
<Button Grid.Column="0" Classes="icon_button" VerticalAlignment="Bottom" Margin="6,0,2,3" IsVisible="{OnPlatform True, macOS=False}">
<Button.Flyout>
<MenuFlyout Placement="BottomEdgeAlignedLeft" VerticalOffset="-8">
<MenuItem Header="{DynamicResource Text.Preference}" Command="{x:Static s:App.OpenPreferenceCommand}" InputGesture="Ctrl+Shift+P">
<MenuItem.Icon>
2024-06-17 04:44:54 -07:00
<Path Width="14" Height="14" Data="{StaticResource Icons.Settings}"/>
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="{DynamicResource Text.Hotkeys}" Command="{x:Static s:App.OpenHotkeysCommand}">
<MenuItem.Icon>
<Path Width="14" Height="14" Data="{StaticResource Icons.Hotkeys}"/>
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="-"/>
<MenuItem Header="{DynamicResource Text.SelfUpdate}" Command="{x:Static s:App.CheckForUpdateCommand}">
<MenuItem.Icon>
<Path Width="14" Height="14" Data="{StaticResource Icons.SoftwareUpdate}"/>
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="-"/>
<MenuItem Header="{DynamicResource Text.About}" Command="{x:Static s:App.OpenAboutCommand}">
<MenuItem.Icon>
<Path Width="14" Height="14" Data="{StaticResource Icons.Info}"/>
</MenuItem.Icon>
</MenuItem>
</MenuFlyout>
</Button.Flyout>
<Path Width="12" Height="12" Data="{StaticResource Icons.Menu}"/>
</Button>
<!-- Pages Tabs-->
<v:LauncherTabBar Grid.Column="1" Height="30" VerticalAlignment="Bottom"/>
<!-- Caption Buttons (Windows/Linux)-->
<Border Grid.Column="2" Margin="32,0,0,0" IsVisible="{OnPlatform True, macOS=False}">
<v:CaptionButtons Height="30" VerticalAlignment="Top"/>
</Border>
</Grid>
<!-- Page body -->
2024-05-30 00:13:59 -07:00
<ContentControl Grid.Row="1" Background="{DynamicResource Brush.ToolBar}" Content="{Binding ActivePage.Data}">
<ContentControl.DataTemplates>
<DataTemplate DataType="vm:Welcome">
<v:Welcome/>
</DataTemplate>
<DataTemplate DataType="vm:Repository">
<v:Repository/>
</DataTemplate>
</ContentControl.DataTemplates>
</ContentControl>
<!-- Popup container -->
<Grid Grid.Row="1" Margin="0,36,0,0" IsVisible="{Binding ActivePage.Popup, Converter={x:Static ObjectConverters.IsNotNull}}" ClipToBounds="True">
<Border Background="Transparent" PointerPressed="OnPopupCancelByClickMask"/>
2024-06-24 04:52:00 -07:00
<Border Width="500" HorizontalAlignment="Center" VerticalAlignment="Top" Effect="drop-shadow(0 0 8 #8F000000)" CornerRadius="0,0,8,8" ClipToBounds="True">
<ContentControl Content="{Binding ActivePage.Popup}" Background="{DynamicResource Brush.Popup}">
<ContentControl.DataTemplates>
<DataTemplate DataType="vm:Popup">
<StackPanel Orientation="Vertical" Background="{DynamicResource Brush.Popup}">
<!-- Popup Widget -->
<ContentPresenter Margin="8,16,8,8"
Content="{Binding View}"
IsHitTestVisible="{Binding InProgress, Converter={x:Static BoolConverters.Not}}"/>
<!-- Options -->
<StackPanel Margin="8,4,8,8"
Height="32"
Orientation="Horizontal"
HorizontalAlignment="Right"
IsVisible="{Binding InProgress, Converter={x:Static BoolConverters.Not}}">
<Button Classes="flat primary"
Width="80"
Content="{DynamicResource Text.Sure}"
Click="OnPopupSure"
HotKey="Enter"/>
<Button Classes="flat"
Width="80"
Margin="8,0,0,0"
Content="{DynamicResource Text.Cancel}"
Click="OnPopupCancel"/>
</StackPanel>
<!-- Running -->
<v:PopupRunningStatus Margin="12,8"
Description="{Binding ProgressDescription}"
IsVisible="{Binding InProgress}"/>
</StackPanel>
</DataTemplate>
</ContentControl.DataTemplates>
</ContentControl>
</Border>
</Grid>
<!-- Notification container -->
<Grid Grid.Row="1" Width="360" Margin="0,36,0,0" HorizontalAlignment="Right" VerticalAlignment="Top">
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
<ItemsControl ItemsSource="{Binding ActivePage.Notifications}">
<ItemsControl.ItemTemplate>
<DataTemplate DataType="vm:Notification">
2024-06-24 04:52:00 -07:00
<Border Margin="10,6" HorizontalAlignment="Stretch" VerticalAlignment="Top" Effect="drop-shadow(0 0 12 #A0000000)">
<Border Padding="8" CornerRadius="6" Background="{DynamicResource Brush.Popup}">
<Grid RowDefinitions="26,Auto,32">
<StackPanel Grid.Row="0" Margin="8,0,0,0" Orientation="Horizontal" IsVisible="{Binding IsError}">
<Path Width="14" Height="14" Data="{StaticResource Icons.Error}" Fill="Red"/>
<TextBlock Margin="8,0,0,0" FontWeight="Bold" FontSize="14" Text="{DynamicResource Text.Launcher.Error}"/>
</StackPanel>
<StackPanel Grid.Row="0" Margin="8,0,0,0" Orientation="Horizontal" IsVisible="{Binding !IsError}">
<Path Width="14" Height="14" Data="{StaticResource Icons.Info}" Fill="Green"/>
<TextBlock Margin="8,0,0,0" FontWeight="Bold" FontSize="14" Text="{DynamicResource Text.Launcher.Info}"/>
</StackPanel>
2024-06-24 04:52:00 -07:00
<TextBox Grid.Row="1"
Classes="no_background no_border"
IsReadOnly="True"
TextWrapping="Wrap"
ScrollViewer.VerticalScrollBarVisibility="Auto"
MaxHeight="100"
Margin="8" Padding="0"
VerticalContentAlignment="Top"
Text="{Binding Message}"/>
2024-06-24 04:52:00 -07:00
<StackPanel Grid.Row="2" Margin="0,4,0,0" Orientation="Horizontal" HorizontalAlignment="Right">
<Button Classes="flat"
Margin="0,0,8,0"
Command="{Binding CopyMessage}"
Content="{DynamicResource Text.CopyMessage}"
IsVisible="{Binding IsError}"/>
<Button Classes="flat primary"
Margin="0,0"
Content="{DynamicResource Text.Close}"
Click="OnDismissNotification"/>
2024-06-24 04:52:00 -07:00
</StackPanel>
</Grid>
</Border>
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</Grid>
</Grid>
</v:ChromelessWindow>