sourcegit/src/Views/SelfUpdate.axaml

154 lines
7.2 KiB
Text
Raw Normal View History

<Window 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:m="using:SourceGit.Models"
xmlns:vm="using:SourceGit.ViewModels"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="SourceGit.Views.SelfUpdate"
x:DataType="vm:SelfUpdate"
Title="{DynamicResource Text.SelfUpdate.Title}"
Icon="/App.ico"
Background="Transparent"
SizeToContent="WidthAndHeight"
CanResize="False"
WindowStartupLocation="CenterOwner"
ExtendClientAreaToDecorationsHint="True"
ExtendClientAreaChromeHints="NoChrome"
SystemDecorations="{OnPlatform Full, Linux=None}">
<Grid RowDefinitions="Auto,*" Margin="{OnPlatform 0, Linux=6}">
<!-- Custom window shadow for Linux -->
<Border Grid.Row="0" Grid.RowSpan="2"
Background="{DynamicResource Brush.Window}"
Effect="drop-shadow(0 0 6 #A0000000)"
IsVisible="{OnPlatform False, Linux=True}"/>
<!-- TitleBar -->
<Grid Grid.Row="0" ColumnDefinitions="Auto,*,Auto" Height="30">
<Border Grid.Column="0" Grid.ColumnSpan="3"
Background="{DynamicResource Brush.TitleBar}"
BorderThickness="0,0,0,1" BorderBrush="{DynamicResource Brush.Border0}"
PointerPressed="BeginMoveWindow"/>
<Path Grid.Column="0"
Width="14" Height="14"
Margin="10,0,0,0"
Data="{StaticResource Icons.SoftwareUpdate}"
IsVisible="{OnPlatform True, macOS=False}"/>
<Grid Grid.Column="0" Classes="caption_button_box" Margin="2,4,0,0" IsVisible="{OnPlatform False, macOS=True}">
<Button Classes="caption_button_macos" Click="CloseWindow">
<Grid>
<Ellipse Fill="{DynamicResource Brush.MacOS.Close}"/>
<Path Height="6" Width="6" Stretch="Fill" Fill="#404040" Stroke="#404040" StrokeThickness="1" Data="{StaticResource Icons.Window.Close}"/>
</Grid>
</Button>
</Grid>
<TextBlock Grid.Column="0" Grid.ColumnSpan="3"
Classes="bold"
Text="{DynamicResource Text.SelfUpdate.Title}"
HorizontalAlignment="Center" VerticalAlignment="Center"
IsHitTestVisible="False"/>
<Button Grid.Column="2"
Classes="caption_button"
Click="CloseWindow"
IsVisible="{OnPlatform True, macOS=False}">
<Path Data="{StaticResource Icons.Window.Close}"/>
</Button>
</Grid>
<!-- Body -->
<Grid Grid.Row="1" Background="{DynamicResource Brush.Window}">
<ContentControl Content="{Binding Data}">
<ContentControl.DataTemplates>
<DataTemplate DataType="m:Version">
<StackPanel Orientation="Vertical" Margin="16,8">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,8">
<Path Width="14" Height="14" Data="{StaticResource Icons.Info}" Fill="Green"/>
<TextBlock Margin="8,0,0,0" FontWeight="Bold" FontSize="14" Text="{DynamicResource Text.SelfUpdate.Available}"/>
<Border Margin="4,0,0,0" Height="20" CornerRadius="10" Background="{DynamicResource Brush.Accent1}" Effect="drop-shadow(0 0 6 #40000000)">
<TextBlock Classes="monospace" Margin="8,0" Text="{Binding TagName}" FontSize="12" Foreground="White"/>
</Border>
</StackPanel>
<TextBox IsReadOnly="True"
TextWrapping="Wrap"
ScrollViewer.VerticalScrollBarVisibility="Auto"
MaxWidth="500" MaxHeight="400"
Margin="0,8" Padding="0"
VerticalContentAlignment="Top"
Text="{Binding Body}"/>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<Button Classes="flat primary"
Height="30"
Click="GotoDownload"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center">
<StackPanel Orientation="Horizontal">
<Path Width="12" Height="12" Data="{StaticResource Icons.Pull}"/>
<TextBlock Text="{DynamicResource Text.SelfUpdate.GotoDownload}" Margin="8,0,0,0"/>
</StackPanel>
</Button>
<Button Classes="flat"
Height="30"
Margin="8,0,0,0"
Click="IgnoreThisVersion"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center">
<StackPanel Orientation="Horizontal">
<Path Width="12" Height="12" Data="{StaticResource Icons.File.Ignore}"/>
<TextBlock Text="{DynamicResource Text.SelfUpdate.IgnoreThisVersion}" Margin="8,0,0,0"/>
</StackPanel>
</Button>
</StackPanel>
</StackPanel>
</DataTemplate>
<DataTemplate DataType="sys:Exception">
<StackPanel Orientation="Vertical" Margin="16,8">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<Path Width="14" Height="14" Data="{StaticResource Icons.Error}" Fill="Red"/>
<TextBlock Margin="8,0,0,0" FontWeight="Bold" FontSize="14" Text="{DynamicResource Text.SelfUpdate.Error}"/>
</StackPanel>
<TextBlock Text="{Binding Message}" MaxWidth="500" TextWrapping="Wrap" Margin="0,8"/>
<Button Classes="flat primary"
Height="30"
Margin="4,0"
Click="CloseWindow"
Content="{DynamicResource Text.Close}"
HorizontalAlignment="Center"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"/>
</StackPanel>
</DataTemplate>
<DataTemplate DataType="m:AlreadyUpToDate">
<StackPanel Orientation="Vertical" Margin="16,8">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,8">
<Path Width="14" Height="14" Data="{StaticResource Icons.Info}" Fill="Green"/>
<TextBlock Margin="8,0,0,0" Text="{DynamicResource Text.SelfUpdate.UpToDate}"/>
</StackPanel>
<Button Classes="flat primary"
Height="30"
Margin="4,0"
Click="CloseWindow"
Content="{DynamicResource Text.Close}"
HorizontalAlignment="Center"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"/>
</StackPanel>
</DataTemplate>
</ContentControl.DataTemplates>
</ContentControl>
</Grid>
</Grid>
</Window>