implemented zoom for plugin readme
MODIFY
HunterPie/GUIControls/Plugins.xaml
HunterPie/GUIControls/Plugins.xaml
mc:Ignorable="d"
x:Name="PluginsControl"
Margin="-1,0,0,0"
- d:DesignHeight="450" d:DesignWidth="800" DataContext="{StaticResource Localization}">
+ d:DesignHeight="450" d:DesignWidth="800" DataContext="{Binding RelativeSource={RelativeSource Self}}">
+ <Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<guiControls:PluginListControl Grid.Row="1" DataContext="{Binding ElementName=PluginsControl, Path=PluginList}"/>
</Grid>
+
+ <!-- image preview -->
+ <Grid VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Background="#88000000">
+ <Grid.InputBindings>
+ <MouseBinding MouseAction="LeftClick" Command="{Binding Path=CloseImagePreviewCommand}"/>
+ <MouseBinding MouseAction="RightClick" Command="{Binding Path=CloseImagePreviewCommand}"/>
+ </Grid.InputBindings>
+
+ <Grid.Style>
+ <Style TargetType="Grid">
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding IsPreviewVisible}" Value="True">
+ <DataTrigger.EnterActions>
+ <BeginStoryboard>
+ <Storyboard>
+ <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility"
+ Duration="0">
+ <DiscreteObjectKeyFrame Value="{x:Static Visibility.Visible}" />
+ </ObjectAnimationUsingKeyFrames>
+ <DoubleAnimation Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="0:0:.2" />
+ </Storyboard>
+ </BeginStoryboard>
+ </DataTrigger.EnterActions>
+ <DataTrigger.ExitActions>
+ <BeginStoryboard>
+ <Storyboard>
+ <DoubleAnimation Storyboard.TargetProperty="Opacity" From="1" To="0" Duration="0:0:.2" />
+ <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility"
+ Duration="0"
+ BeginTime="0:0:.2">
+ <DiscreteObjectKeyFrame Value="{x:Static Visibility.Hidden}" />
+ </ObjectAnimationUsingKeyFrames>
+ </Storyboard>
+ </BeginStoryboard>
+ </DataTrigger.ExitActions>
+ </DataTrigger>
+ </Style.Triggers>
+ <Setter Property="Visibility" Value="Hidden" />
+ </Style>
+ </Grid.Style>
+
+ <Image Source="{Binding PreviewImg}" Margin="5" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Stretch="Uniform" />
+ </Grid>
+ </Grid>
</UserControl>

MODIFY
HunterPie/GUIControls/Plugins.xaml.cs
HunterPie/GUIControls/Plugins.xaml.cs
@@ -4,6 +4,7 @@ using System.IO;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
+using System.Windows.Media;
using HunterPie.Plugins;
using HunterPie.UI.Infrastructure;
@@ -28,6 +29,29 @@ namespace HunterPie.GUIControls
}
}
+ public static readonly DependencyProperty PreviewImgProperty = DependencyProperty.Register(
+ "PreviewImg", typeof(ImageSource), typeof(Plugins), new PropertyMetadata(default(ImageSource)));
+
+ public ImageSource PreviewImg
+ {
+ get { return (ImageSource)GetValue(PreviewImgProperty); }
+ set
+ {
+ SetValue(PreviewImgProperty, value);
+ IsPreviewVisible = value != null;
+ CommandManager.InvalidateRequerySuggested();
+ }
+ }
+
+ public static readonly DependencyProperty IsPreviewVisibleProperty = DependencyProperty.Register(
+ "IsPreviewVisible", typeof(bool), typeof(Plugins), new PropertyMetadata(default(bool)));
+
+ public bool IsPreviewVisible
+ {
+ get { return (bool)GetValue(IsPreviewVisibleProperty); }
+ set { SetValue(IsPreviewVisibleProperty, value); }
+ }
+
public PluginListViewModel PluginList { get; set; }
public ICommand OpenPluginsFolderCommand { get; } = new RelayCommand(
@@ -40,35 +64,53 @@ namespace HunterPie.GUIControls
_ => Hunterpie.Instance.Reload()
);
- public static readonly DependencyProperty SearchOpenedProperty = DependencyProperty.Register(
- "SearchOpened", typeof(bool), typeof(Plugins), new PropertyMetadata(default(bool)));
- private KeyBinding SearchBinding { get; }
- public KeyBinding RefreshBinding { get; }
+ public ICommand MagnifyImageCommand { get; }
+
+ public ICommand CloseImagePreviewCommand { get; }
+
+
+ private KeyBinding[] KeyBindings { get; }
public Plugins()
{
PluginList = new PluginListViewModel(PluginRegistryService.Instance);
+
+ // commands
+ MagnifyImageCommand = new RelayCommand(Magnify);
+ CloseImagePreviewCommand = new ArglessRelayCommand(ClearMagnify);
+
InitializeComponent();
- SearchBinding = new KeyBinding(SearchBarControl.ToggleSearchCommand, Key.F, ModifierKeys.Control)
+ KeyBindings = CreateKeyBindings();
+ PluginList.Refresh();
+ }
+
+ private KeyBinding[] CreateKeyBindings() => new[]
+ {
+ new KeyBinding(SearchBarControl.ToggleSearchCommand, Key.F, ModifierKeys.Control)
{
CommandParameter = true
+ },
+ new KeyBinding(PluginList.RefreshCommand, Key.F5, ModifierKeys.None),
+ new KeyBinding(CloseImagePreviewCommand, Key.Escape, ModifierKeys.None)
};
- RefreshBinding = new KeyBinding(PluginList.RefreshCommand, Key.F5, ModifierKeys.None);
- PluginList.Refresh();
- }
public void OnActivate()
{
- Hunterpie.Instance.InputBindings.Add(SearchBinding);
- Hunterpie.Instance.InputBindings.Add(RefreshBinding);
+ Hunterpie.Instance.InputBindings.AddRange(KeyBindings);
}
public void OnDeactivate()
{
- Hunterpie.Instance.InputBindings.Remove(SearchBinding);
- Hunterpie.Instance.InputBindings.Remove(RefreshBinding);
+ foreach (var binding in KeyBindings)
+ {
+ Hunterpie.Instance.InputBindings.Remove(binding);
}
}
+
+ public void Magnify(object arg) => PreviewImg = arg as ImageSource;
+
+ public void ClearMagnify() => PreviewImg = null;
+ }
}

ADD
HunterPie/HunterPie.Resources/UI/magnifying-glass-white.cur
HunterPie/HunterPie.Resources/UI/magnifying-glass-white.cur
Binary files /dev/null and b/HunterPie/HunterPie.Resources/UI/magnifying-glass-white.cur differ

MODIFY
HunterPie/HunterPie.csproj
HunterPie/HunterPie.csproj
<Content Include="HunterPie.Resources\UI\damage_plot.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
+ <None Include="HunterPie.Resources\UI\magnifying-glass-white.cur">
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>

MODIFY
HunterPie/Hunterpie.xaml
HunterPie/Hunterpie.xaml
<!-- Console content -->
<Grid x:Name="ConsolePanel" Margin="51,157,0,2"/>
<Rectangle Height="130" VerticalAlignment="Top" Margin="0,22,0,0" Fill="{StaticResource CONSOLE_HEADER_BACKGROUND}"/>
- <Rectangle Cursor="SizeAll" x:Name="WindowTopBar" Fill="{StaticResource CONSOLE_WINDOWBAR_BACKGROUND}" Height="22" VerticalAlignment="Top" MouseLeftButtonDown="OnWindowDrag"/>
+ <Rectangle Cursor="SizeAll" x:Name="WindowTopBar" Fill="{StaticResource CONSOLE_WINDOWBAR_BACKGROUND}" Height="22" VerticalAlignment="Top" MouseLeftButtonDown="OnWindowDrag">
+ <Rectangle.InputBindings>
+ <MouseBinding Gesture="LeftDoubleClick" Command="{Binding ElementName=window, Path=MaximizeCommand}"/>
+ </Rectangle.InputBindings>
+ </Rectangle>
<Image Height="20" Width="20" Visibility="{Binding ElementName=window, Path=AdministratorIconVisibility}" ToolTip="HunterPie (Administrator)" Source="{StaticResource ICON_ADMINISTRATOR}" VerticalAlignment="Top" HorizontalAlignment="Left" Opacity="0.8" Margin="1,1,0,0" />
<!-- Top buttons -->

MODIFY
HunterPie/Hunterpie.xaml.cs
HunterPie/Hunterpie.xaml.cs
@@ -104,6 +104,8 @@ namespace HunterPie
public static readonly DependencyProperty IsDraggingProperty =
DependencyProperty.Register("IsDragging", typeof(bool), typeof(Hunterpie));
+ public ICommand MaximizeCommand { get; }
+
#endregion
public Hunterpie()
@@ -118,6 +120,8 @@ namespace HunterPie
}
CheckIfHunterPieOpen();
+ MaximizeCommand = new ArglessRelayCommand(() => WindowState = WindowState.Maximized);
+
AppDomain.CurrentDomain.UnhandledException += ExceptionLogger;
IsPlayerLoggedOn = false;

MODIFY
HunterPie/Resources/Resources.xaml
HunterPie/Resources/Resources.xaml
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
+ <Cursor x:Key="CURSOR_MAGNIFY">pack://siteoforigin:,,,/HunterPie.Resources/UI/magnifying-glass-white.cur</Cursor>
<!-- Styles -->
<Style x:Key="WidgetStyle" TargetType="{x:Type Window}">
<Style.Triggers>

implemented zoom for plugin readme