132 lines
7.5 KiB
XML
132 lines
7.5 KiB
XML
<UserControl x:Class="Saradomin.View.Controls.PluginManagerView"
|
|
xmlns="https://github.com/avaloniaui"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:local="clr-namespace:Saradomin.View.Controls"
|
|
xmlns:model="clr-namespace:Saradomin.Model"
|
|
xmlns:mvvm="clr-namespace:Glitonea.Mvvm;assembly=Glitonea"
|
|
xmlns:vm="clr-namespace:Saradomin.ViewModel.Controls"
|
|
DataContext="{mvvm:DataContextSource vm:PluginManagerViewModel}">
|
|
<Grid Margin="0,0,0,4"
|
|
RowDefinitions="Auto,*">
|
|
<Grid Grid.Row="0"
|
|
Margin="0,0,0,4">
|
|
<TextBlock HorizontalAlignment="Left"
|
|
VerticalAlignment="Center"
|
|
Foreground="{StaticResource DarkBackgroundBrush}">
|
|
<Run Text="Status:" />
|
|
<Run Text="{Binding CurrentStatusMessage}" />
|
|
</TextBlock>
|
|
|
|
<Button Classes="Hyperlink"
|
|
Content="check for updates"
|
|
HorizontalAlignment="Right"
|
|
VerticalAlignment="Center"
|
|
Command="{Binding CheckForUpdates}"
|
|
IsEnabled="{Binding !IsTransactionInProgress}" />
|
|
</Grid>
|
|
|
|
<TextBlock Grid.Row="1"
|
|
HorizontalAlignment="Center"
|
|
VerticalAlignment="Center"
|
|
Foreground="{StaticResource DarkForegroundBrush}"
|
|
IsVisible="{Binding !!!PluginList.Count}"
|
|
Text="Reloading plugin registry..." />
|
|
|
|
<ListBox Grid.Row="1"
|
|
Classes="PluginList"
|
|
ItemsSource="{Binding PluginList}"
|
|
SelectionMode="Single"
|
|
ClipToBounds="True"
|
|
BorderThickness="1"
|
|
BorderBrush="{StaticResource DarkBorderBrush}"
|
|
IsVisible="{Binding PluginList.Count}">
|
|
<ListBox.ItemsPanel>
|
|
<ItemsPanelTemplate>
|
|
<!-- There won't be too many plugins and virtualization hides any
|
|
expanded items, so by using this instead of VirtualizingStackPanel
|
|
helps avoid UI inconsistency. -->
|
|
<StackPanel />
|
|
</ItemsPanelTemplate>
|
|
</ListBox.ItemsPanel>
|
|
|
|
<ListBox.ItemTemplate>
|
|
<DataTemplate DataType="{x:Type model:PluginInfo}">
|
|
<Grid ColumnDefinitions="*,Auto,Auto">
|
|
<Expander Grid.Column="0"
|
|
HorizontalAlignment="Stretch"
|
|
HorizontalContentAlignment="Stretch"
|
|
Header="{Binding}">
|
|
<Expander.HeaderTemplate>
|
|
<DataTemplate>
|
|
<Grid ColumnDefinitions="*,Auto">
|
|
<Grid Grid.Column="0"
|
|
HorizontalAlignment="Stretch"
|
|
ColumnDefinitions="Auto, Auto">
|
|
<TextBlock Grid.Column="0"
|
|
HorizontalAlignment="Left"
|
|
VerticalAlignment="Center"
|
|
Foreground="#BBFFFFFF"
|
|
FontSize="11"
|
|
Text="{Binding Version, StringFormat='{}[v{0}] '}" />
|
|
|
|
<TextBlock Grid.Column="1"
|
|
VerticalAlignment="Center"
|
|
HorizontalAlignment="Left"
|
|
Text="{Binding Name}" />
|
|
</Grid>
|
|
|
|
<Grid Grid.Column="1"
|
|
IsEnabled="{Binding !$parent[local:PluginManagerView].DataContext.IsTransactionInProgress}"
|
|
VerticalAlignment="Center"
|
|
Margin="0,2,4,2">
|
|
<Button BorderBrush="{StaticResource DarkBorderBrush}"
|
|
BorderThickness="1"
|
|
Classes="OutsideNavigator"
|
|
Command="{Binding $parent[local:PluginManagerView].DataContext.UpdateLocalPlugin}"
|
|
VerticalAlignment="Top"
|
|
Content="Update"
|
|
IsVisible="{Binding CanUpdate}" />
|
|
<Button BorderBrush="{StaticResource DarkBorderBrush}"
|
|
BorderThickness="1"
|
|
Classes="OutsideNavigator"
|
|
Command="{Binding $parent[local:PluginManagerView].DataContext.InstallRemotePlugin}"
|
|
CommandParameter="{Binding}"
|
|
VerticalAlignment="Top"
|
|
Content="Install"
|
|
IsVisible="{Binding !Installed}" />
|
|
<Button BorderBrush="{StaticResource DarkBorderBrush}"
|
|
BorderThickness="1"
|
|
Classes="OutsideNavigator"
|
|
Command="{Binding $parent[local:PluginManagerView].DataContext.UninstallLocalPlugin}"
|
|
CommandParameter="{Binding}"
|
|
VerticalAlignment="Top"
|
|
Content="Uninstall"
|
|
IsVisible="{Binding Installed}" />
|
|
</Grid>
|
|
</Grid>
|
|
</DataTemplate>
|
|
</Expander.HeaderTemplate>
|
|
|
|
<StackPanel>
|
|
<TextBlock Margin="4,0,0,0"
|
|
Foreground="#BBFFFFFF"
|
|
FontSize="11"
|
|
FontStyle="Oblique"
|
|
Text="{Binding Author}" />
|
|
|
|
<TextBlock Margin="4,0,0,4"
|
|
MaxWidth="400"
|
|
FontSize="11"
|
|
HorizontalAlignment="Left"
|
|
Foreground="#BBFFFFFF"
|
|
TextWrapping="Wrap"
|
|
TextAlignment="DetectFromContent"
|
|
Text="{Binding Description}" />
|
|
</StackPanel>
|
|
</Expander>
|
|
</Grid>
|
|
</DataTemplate>
|
|
</ListBox.ItemTemplate>
|
|
</ListBox>
|
|
</Grid>
|
|
</UserControl> |