From fbe866f7b26c10bb54d72c029f8c628988a90be2 Mon Sep 17 00:00:00 2001 From: Dennis Brentjes Date: Tue, 24 Dec 2019 16:45:22 +0100 Subject: Started on the resizing step of the pipeline + pipeline design. --- Views/AvalarViewService.cs | 2 +- Views/Image/ImageControl.xaml.cs | 8 ++++++-- Views/Settings/Settings.xaml | 2 +- Views/Settings/Settings.xaml.cs | 4 ++-- 4 files changed, 10 insertions(+), 6 deletions(-) (limited to 'Views') diff --git a/Views/AvalarViewService.cs b/Views/AvalarViewService.cs index 994f88b..7b0cc0b 100644 --- a/Views/AvalarViewService.cs +++ b/Views/AvalarViewService.cs @@ -25,7 +25,7 @@ namespace Avalar.Views openFileDialog.Title = "Open Image"; - var result = await openFileDialog.ShowAsync(m_Window); + var result = await openFileDialog.ShowAsync(m_Window).ConfigureAwait(false); return result; } } diff --git a/Views/Image/ImageControl.xaml.cs b/Views/Image/ImageControl.xaml.cs index 2189bb0..e806d6f 100644 --- a/Views/Image/ImageControl.xaml.cs +++ b/Views/Image/ImageControl.xaml.cs @@ -21,7 +21,11 @@ namespace Avalar.Views.Image { InitializeComponent(); - Image = this.FindResource("ImageBrush") as ImageBrush ?? throw new System.ArgumentException("ImageBrush"); + var brushName = "ImageBrush"; + string message = $"The brush with name {brushName} could not be found in the Xaml Resources"; +#pragma warning disable CA1303 // Do not pass literals as localized parameters + Image = (this).FindResource(brushName) as ImageBrush ?? throw new ArgumentException(message); +#pragma warning restore CA1303 // Do not pass literals as localized parameters ImageCanvas = this.FindControl("ImageCanvas"); } @@ -73,7 +77,7 @@ namespace Avalar.Views.Image public void OnPointerWheelChanged(object sender, PointerWheelEventArgs e) { var invOldZoom = InvCurrentZoom; - var zoomFactor = e.Delta.Y * ZoomTick + 1.0; + var zoomFactor = (e?.Delta.Y ?? 0) * ZoomTick + 1.0; CurrentZoom = Math.Clamp(CurrentZoom * zoomFactor, 1, double.PositiveInfinity); var sourceRect = Image.SourceRect.Rect; diff --git a/Views/Settings/Settings.xaml b/Views/Settings/Settings.xaml index dfc8602..fb547e7 100644 --- a/Views/Settings/Settings.xaml +++ b/Views/Settings/Settings.xaml @@ -3,7 +3,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" - x:Class="Avalar.Views.Settings.Settings" + x:Class="Avalar.Views.Settings.SettingsControl" MinWidth="400"> Welcome to Avalonia! diff --git a/Views/Settings/Settings.xaml.cs b/Views/Settings/Settings.xaml.cs index 4504460..1197c39 100644 --- a/Views/Settings/Settings.xaml.cs +++ b/Views/Settings/Settings.xaml.cs @@ -3,9 +3,9 @@ using Avalonia.Markup.Xaml; namespace Avalar.Views.Settings { - public class Settings : UserControl + public class SettingsControl : UserControl { - public Settings() + public SettingsControl() { InitializeComponent(); } -- cgit v1.2.3-70-g09d2