summaryrefslogtreecommitdiff
path: root/Views
diff options
context:
space:
mode:
authorDennis Brentjes <d.brentjes@gmail.com>2019-12-24 16:45:22 +0100
committerDennis Brentjes <d.brentjes@gmail.com>2019-12-24 16:45:22 +0100
commitfbe866f7b26c10bb54d72c029f8c628988a90be2 (patch)
tree7617f1209333ff40c31aa156d541e8ea59e991ed /Views
parent0f98b398520a3f5cc6a299e7fd3b8fab494480d7 (diff)
downloadavalar-fbe866f7b26c10bb54d72c029f8c628988a90be2.tar.gz
avalar-fbe866f7b26c10bb54d72c029f8c628988a90be2.tar.bz2
avalar-fbe866f7b26c10bb54d72c029f8c628988a90be2.zip
Started on the resizing step of the pipeline + pipeline design.
Diffstat (limited to 'Views')
-rw-r--r--Views/AvalarViewService.cs2
-rw-r--r--Views/Image/ImageControl.xaml.cs8
-rw-r--r--Views/Settings/Settings.xaml2
-rw-r--r--Views/Settings/Settings.xaml.cs4
4 files changed, 10 insertions, 6 deletions
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<Canvas>("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!
</UserControl>
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();
}