From 6871d6952f46be292f3b27705d859a465aa49e17 Mon Sep 17 00:00:00 2001 From: Pilzinsel64 Date: Wed, 17 Mar 2021 10:24:34 +0100 Subject: [PATCH] . --- Pilz.Reflection.PluginSystem/PluginManager.vb | 12 +++++++++++- Pilz.UI/PaintingControl/PaintingControl.vb | 2 +- Pilz.UI/PaintingControl/PaintingObject.vb | 18 +++++++++++++++++- 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/Pilz.Reflection.PluginSystem/PluginManager.vb b/Pilz.Reflection.PluginSystem/PluginManager.vb index c7acaa8..9ec8df0 100644 --- a/Pilz.Reflection.PluginSystem/PluginManager.vb +++ b/Pilz.Reflection.PluginSystem/PluginManager.vb @@ -2,6 +2,12 @@ Public Class PluginManager + ''' + ''' Gets or sets an indicator if an exception should throw on error while loading a plugin. + ''' + ''' + Public Property ThrowOnError As Boolean = False + ''' ''' The name of the type where to search for Methods when loading a new Plugin. ''' @@ -79,7 +85,11 @@ Public Class PluginManager If addToList Then Plugins.Add(filePath, plugin) Return plugin Catch ex As Exception - Return Nothing + If ThrowOnError Then + Throw + Else + Return Nothing + End If End Try End Function diff --git a/Pilz.UI/PaintingControl/PaintingControl.vb b/Pilz.UI/PaintingControl/PaintingControl.vb index 33712b4..096f08b 100644 --- a/Pilz.UI/PaintingControl/PaintingControl.vb +++ b/Pilz.UI/PaintingControl/PaintingControl.vb @@ -314,7 +314,7 @@ Public Class PaintingControl Private Sub SaveObjectPositions(e As MouseEventArgs, objs As IList) For Each obj As PaintingObject In objs - If Not savedPos.ContainsKey(obj) Then + If Not obj.HardcodedLocation AndAlso Not savedPos.ContainsKey(obj) Then savedPos.Add(obj, New PointF(e.X - obj.Location.X + Offset.X, e.Y - obj.Location.Y + Offset.Y)) SaveObjectPositions(e, obj.PinnedObjects) End If diff --git a/Pilz.UI/PaintingControl/PaintingObject.vb b/Pilz.UI/PaintingControl/PaintingObject.vb index fa7b219..f0e45ac 100644 --- a/Pilz.UI/PaintingControl/PaintingObject.vb +++ b/Pilz.UI/PaintingControl/PaintingObject.vb @@ -42,7 +42,8 @@ Imports Newtonsoft.Json Public Property BufferedImage As Image = Nothing Public Property ImageSizeMode As ImageSizeMode Public Property ImageProperties As New PaintingObjectImageProperties - Public Property Tag As String = Nothing + + Public Property Tag As Object = Nothing Public Property Name As String = "" Public ReadOnly Property PinnedObjects As New List(Of PaintingObject) @@ -51,6 +52,7 @@ Imports Newtonsoft.Json Public ReadOnly Property DrawSelectionMethode As DelegateDrawPaintingObjectMethode = AddressOf DefaultDrawMethodes.DrawSelection Public Property Cursor As Cursor = Cursors.Default Public Property HardcodedSize As Boolean = False + Public Property HardcodedLocation As Boolean = False Private _Visible As Boolean = True @@ -421,6 +423,20 @@ Imports Newtonsoft.Json End Set End Property + + Public Property TagString As String + Get + If TypeOf Tag Is String Then + Return Tag + Else + Return String.Empty + End If + End Get + Set(value As String) + Tag = value + End Set + End Property + Public Property EnableResize As Boolean Get If resizeEngine Is Nothing Then