diff --git a/NuGet.Config b/NuGet.Config new file mode 100644 index 0000000..e5056d3 --- /dev/null +++ b/NuGet.Config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Pilz.Collections/Pilz.Collections.vbproj b/Pilz.Collections/Pilz.Collections.vbproj index 2d25955..9b746c0 100644 --- a/Pilz.Collections/Pilz.Collections.vbproj +++ b/Pilz.Collections/Pilz.Collections.vbproj @@ -26,6 +26,9 @@ On + True + 1.yyyy.Mdd.Hmm + 1.2023.914.856 true diff --git a/Pilz.Configuration/Pilz.Configuration.vbproj b/Pilz.Configuration/Pilz.Configuration.vbproj index c0b8974..9641056 100644 --- a/Pilz.Configuration/Pilz.Configuration.vbproj +++ b/Pilz.Configuration/Pilz.Configuration.vbproj @@ -24,12 +24,17 @@ On + + True + 1.yyyy.Mdd.Hmm + 1.2023.914.856 + - + diff --git a/Pilz.Cryptography/IUniquieID.cs b/Pilz.Cryptography/IUniquieID.cs index 34bc49e..b5ffa1d 100644 --- a/Pilz.Cryptography/IUniquieID.cs +++ b/Pilz.Cryptography/IUniquieID.cs @@ -1,9 +1,11 @@ -using System; +using Newtonsoft.Json; +using System; using System.Collections.Generic; using System.Text; namespace Pilz.Cryptography { + [JsonConverter(typeof(Json.Converters.UniquieIDStringJsonConverter))] public interface IUniquieID { bool HasID { get; } diff --git a/Pilz.Cryptography/Json.Converters/UniquieIDStringJsonConverter.cs b/Pilz.Cryptography/Json.Converters/UniquieIDStringJsonConverter.cs index f3725ab..0afabc9 100644 --- a/Pilz.Cryptography/Json.Converters/UniquieIDStringJsonConverter.cs +++ b/Pilz.Cryptography/Json.Converters/UniquieIDStringJsonConverter.cs @@ -12,7 +12,7 @@ namespace Pilz.Json.Converters public override bool CanConvert(Type objectType) { - return typeof(UniquieID).IsAssignableFrom(objectType); + return typeof(IUniquieID).IsAssignableFrom(objectType); } public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) diff --git a/Pilz.Cryptography/Pilz.Cryptography.csproj b/Pilz.Cryptography/Pilz.Cryptography.csproj index 6d5344e..c467cf8 100644 --- a/Pilz.Cryptography/Pilz.Cryptography.csproj +++ b/Pilz.Cryptography/Pilz.Cryptography.csproj @@ -5,13 +5,18 @@ Pilz.Cryptography Copyright © 2020 + + True + 1.yyyy.Mdd.Hmm + 1.2023.918.846 + - + - + \ No newline at end of file diff --git a/Pilz.Drawing.Drawing3D.OpenGLRenderer/Camera/Camera.vb b/Pilz.Drawing.Drawing3D.OpenGLRenderer/Camera/Camera.vb index e0e25e7..8d56858 100644 --- a/Pilz.Drawing.Drawing3D.OpenGLRenderer/Camera/Camera.vb +++ b/Pilz.Drawing.Drawing3D.OpenGLRenderer/Camera/Camera.vb @@ -1,5 +1,7 @@ Imports System.Windows.Forms + Imports OpenTK +Imports OpenTK.Mathematics Namespace CameraN diff --git a/Pilz.Drawing.Drawing3D.OpenGLRenderer/Pilz.Drawing.Drawing3D.OpenGLFactory.vbproj b/Pilz.Drawing.Drawing3D.OpenGLRenderer/Pilz.Drawing.Drawing3D.OpenGLFactory.vbproj index ce4505e..a9d2930 100644 --- a/Pilz.Drawing.Drawing3D.OpenGLRenderer/Pilz.Drawing.Drawing3D.OpenGLFactory.vbproj +++ b/Pilz.Drawing.Drawing3D.OpenGLRenderer/Pilz.Drawing.Drawing3D.OpenGLFactory.vbproj @@ -1,10 +1,11 @@  Windows - net48 + net6.0-windows 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 Pilz.Drawing.Drawing3D.OpenGLFactory.xml true + true true @@ -24,19 +25,21 @@ On + + True + 1.yyyy.Mdd.Hmm + 1.2023.914.856 + + + - - + - - - - @@ -52,9 +55,7 @@ ModelPreview.vb - - Form - + True Application.myapp @@ -98,4 +99,9 @@ + + + ..\Shared Libs\OpenTK3.dll + + \ No newline at end of file diff --git a/Pilz.Drawing.Drawing3D.OpenGLRenderer/Preview/ModelPreview.vb b/Pilz.Drawing.Drawing3D.OpenGLRenderer/Preview/ModelPreview.vb index a973f11..5257761 100644 --- a/Pilz.Drawing.Drawing3D.OpenGLRenderer/Preview/ModelPreview.vb +++ b/Pilz.Drawing.Drawing3D.OpenGLRenderer/Preview/ModelPreview.vb @@ -6,10 +6,12 @@ Imports OpenTK Imports OpenTK.Graphics.OpenGL Imports Pilz.S3DFileParser Imports Point = System.Drawing.Point -Imports KeyboardState = OpenTK.Input.KeyboardState -Imports Keyboard = OpenTK.Input.Keyboard -Imports Key = OpenTK.Input.Key Imports Color = System.Drawing.Color +Imports OpenTK.Mathematics +Imports OpenTK.WinForms +Imports OpenTK.Input +Imports OpenTK.Windowing.GraphicsLibraryFramework +Imports Key = OpenTK3.Input.Key Namespace PreviewN @@ -30,6 +32,12 @@ Namespace PreviewN Public Property Scaling As Single = 500.0F Public Property ClearColor As Color = Color.CornflowerBlue + Public ReadOnly Property Keyboard As OpenTK3.Input.KeyboardState + Get + Return OpenTK3.Input.Keyboard.GetState + End Get + End Property + Public Property EnableCameraControlling As Boolean Get Return _EnableCameraControlling @@ -81,14 +89,14 @@ Namespace PreviewN Private ReadOnly Property IsStrgPressed As Boolean Get - Dim state As KeyboardState = Keyboard.GetState() + Dim state = Keyboard Return state(Key.ControlLeft) OrElse state(Key.ControlRight) End Get End Property Private ReadOnly Property IsShiftPressed As Boolean Get - Dim state As KeyboardState = Keyboard.GetState() + Dim state = Keyboard Return state(Key.ShiftLeft) OrElse state(Key.ShiftRight) End Get End Property @@ -132,7 +140,6 @@ Namespace PreviewN Me.glControl1.Size = Me.ClientSize Me.glControl1.TabIndex = 0 Me.glControl1.TabStop = False - Me.glControl1.VSync = False Me.Controls.Add(Me.glControl1) Me.ResumeLayout(False) @@ -247,7 +254,7 @@ Namespace PreviewN End Sub Private Sub glControl1_Resize(sender As Object, e As EventArgs) Handles glControl1.Resize - glControl1.Context.Update(glControl1.WindowInfo) + 'glControl1.Context.Update(glControl1.WindowInfo) GL.Viewport(0, 0, glControl1.Width, glControl1.Height) ProjMatrix = Matrix4.CreatePerspectiveFieldOfView(FOV, glControl1.Width / glControl1.Height, 100.0F, 100000.0F) glControl1.Invalidate() @@ -286,7 +293,7 @@ Namespace PreviewN Dim allowCamMove As Boolean = Not (IsMouseDown AndAlso IsShiftPressed) If allowCamMove Then - Dim state As KeyboardState = Keyboard.GetState + Dim state = Keyboard If state(Key.W) Then 'camera.Move(moveSpeed, moveSpeed, camMtx) diff --git a/Pilz.Drawing.Drawing3D.OpenGLRenderer/Rendering/Renderer.vb b/Pilz.Drawing.Drawing3D.OpenGLRenderer/Rendering/Renderer.vb index 6e071c6..8319ed9 100644 --- a/Pilz.Drawing.Drawing3D.OpenGLRenderer/Rendering/Renderer.vb +++ b/Pilz.Drawing.Drawing3D.OpenGLRenderer/Rendering/Renderer.vb @@ -1,9 +1,13 @@ Imports System.Drawing Imports System.Threading Imports System.Windows.Forms + Imports OpenTK Imports OpenTK.Graphics.OpenGL +Imports OpenTK.Mathematics + Imports Pilz.S3DFileParser + Imports Bitmap = System.Drawing.Bitmap Imports Color = System.Drawing.Color Imports Image = System.Drawing.Image diff --git a/Pilz.Drawing/Pilz.Drawing.vbproj b/Pilz.Drawing/Pilz.Drawing.vbproj index 0e80179..57deb31 100644 --- a/Pilz.Drawing/Pilz.Drawing.vbproj +++ b/Pilz.Drawing/Pilz.Drawing.vbproj @@ -1,10 +1,11 @@  Windows - net48 + net6.0-windows 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 Pilz.Drawing.xml true + true true @@ -24,6 +25,11 @@ On + + True + 1.yyyy.Mdd.Hmm + 1.2023.914.856 + diff --git a/Pilz.IO/Pilz.IO.csproj b/Pilz.IO/Pilz.IO.csproj index 3b9bcb2..0dd5b2f 100644 --- a/Pilz.IO/Pilz.IO.csproj +++ b/Pilz.IO/Pilz.IO.csproj @@ -1,7 +1,7 @@  Windows - netstandard2.0 + net6.0-windows $(DefaultItemExcludes);$(ProjectDir)**\*.vb latest NamedPipeManaging @@ -43,12 +43,17 @@ 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 MinimumRecommendedRules.ruleset + + True + 1.yyyy.Mdd.Hmm + 1.2023.914.856 + - + diff --git a/Pilz.LicenseHelper/Pilz.LicenseHelper.csproj b/Pilz.LicenseHelper/Pilz.LicenseHelper.csproj index fb1ab72..9255fab 100644 --- a/Pilz.LicenseHelper/Pilz.LicenseHelper.csproj +++ b/Pilz.LicenseHelper/Pilz.LicenseHelper.csproj @@ -7,6 +7,11 @@ Copyright © DRSN 2018 true + + True + 1.yyyy.Mdd.Hmm + 1.2023.914.1955 + diff --git a/Pilz.Networking/Pilz.Networking.vbproj b/Pilz.Networking/Pilz.Networking.vbproj index a0904db..a43d1c8 100644 --- a/Pilz.Networking/Pilz.Networking.vbproj +++ b/Pilz.Networking/Pilz.Networking.vbproj @@ -1,10 +1,11 @@  Windows - net48 + net6.0-windows 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 Pilz.Networking.xml true + true true @@ -24,12 +25,18 @@ On + + True + 1.yyyy.Mdd.Hmm + 1.2023.914.856 + + - + diff --git a/Pilz.Reflection.PluginSystem/Pilz.Reflection.PluginSystem.vbproj b/Pilz.Reflection.PluginSystem/Pilz.Reflection.PluginSystem.vbproj index 43d8bca..31126bc 100644 --- a/Pilz.Reflection.PluginSystem/Pilz.Reflection.PluginSystem.vbproj +++ b/Pilz.Reflection.PluginSystem/Pilz.Reflection.PluginSystem.vbproj @@ -24,6 +24,11 @@ On + + True + 1.yyyy.Mdd.Hmm + 1.2023.914.856 + diff --git a/Pilz.Simple3DFileParser/Pilz.Simple3DFileParser.vbproj b/Pilz.Simple3DFileParser/Pilz.Simple3DFileParser.vbproj index 4ed138b..2041cb7 100644 --- a/Pilz.Simple3DFileParser/Pilz.Simple3DFileParser.vbproj +++ b/Pilz.Simple3DFileParser/Pilz.Simple3DFileParser.vbproj @@ -26,9 +26,14 @@ On + + True + 1.yyyy.Mdd.Hmm + 1.2023.914.1955 + - + diff --git a/Pilz.Threading/Pilz.Threading.vbproj b/Pilz.Threading/Pilz.Threading.vbproj index 16c2449..41d149e 100644 --- a/Pilz.Threading/Pilz.Threading.vbproj +++ b/Pilz.Threading/Pilz.Threading.vbproj @@ -1,10 +1,11 @@  Windows - net48 + net6.0-windows 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 Pilz.Threading.xml true + true true @@ -34,13 +35,16 @@ bin\$(Platform)\$(Configuration)\ MinimumRecommendedRules.ruleset + + True + 1.yyyy.Mdd.Hmm + 1.2023.914.856 + + - - - diff --git a/Pilz.UI.Telerik.SymbolFactory/Pilz - Backup.UI.Telerik.SymbolFactory.csproj b/Pilz.UI.Telerik.SymbolFactory/Pilz - Backup.UI.Telerik.SymbolFactory.csproj new file mode 100644 index 0000000..4ed218b --- /dev/null +++ b/Pilz.UI.Telerik.SymbolFactory/Pilz - Backup.UI.Telerik.SymbolFactory.csproj @@ -0,0 +1,10 @@ + + + + net6.0 + enable + enable + Pilz.UI.Telerik + + + diff --git a/Pilz.UI.Telerik.SymbolFactory/Pilz.UI.Telerik.SymbolFactory.csproj b/Pilz.UI.Telerik.SymbolFactory/Pilz.UI.Telerik.SymbolFactory.csproj new file mode 100644 index 0000000..b5732c2 --- /dev/null +++ b/Pilz.UI.Telerik.SymbolFactory/Pilz.UI.Telerik.SymbolFactory.csproj @@ -0,0 +1,21 @@ + + + + net6.0-windows + enable + enable + Pilz.UI.Telerik + + + + True + 1.yyyy.Mdd.Hmm + 1.2023.914.1955 + + + + + + + + diff --git a/Pilz.UI.Telerik.SymbolFactory/SvgImageSize.cs b/Pilz.UI.Telerik.SymbolFactory/SvgImageSize.cs new file mode 100644 index 0000000..905d4ed --- /dev/null +++ b/Pilz.UI.Telerik.SymbolFactory/SvgImageSize.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Pilz.UI.Telerik +{ + public enum SvgImageSize + { + Default, + Small, + Medium, + Large + } +} diff --git a/Pilz.UI.Telerik.SymbolFactory/SymbolFactory.cs b/Pilz.UI.Telerik.SymbolFactory/SymbolFactory.cs new file mode 100644 index 0000000..dce2f64 --- /dev/null +++ b/Pilz.UI.Telerik.SymbolFactory/SymbolFactory.cs @@ -0,0 +1,87 @@ +using System.Drawing; +using System.Reflection; +using Telerik.WinControls; +using Telerik.WinControls.Svg; + +namespace Pilz.UI.Telerik +{ + public abstract class SymbolFactory where TSvgSymbols : Enum + { + public abstract string GetSvgImageRessourcePath(TSvgSymbols svgImage); + public abstract Assembly GetSvgImageResourceAssembly(); + + protected virtual Size ResolveCommonSize(SvgImageSize size) + { + return size switch + { + SvgImageSize.Small => new Size(16, 16), + SvgImageSize.Medium => new Size(20, 20), + SvgImageSize.Large => new Size(32, 32), + _ => Size.Empty, + }; + } + + public virtual Stream? GetSvgImageRessourceStream(TSvgSymbols svgImage) + { + var asm = GetSvgImageResourceAssembly(); + var path = GetSvgImageRessourcePath(svgImage); + return asm.GetManifestResourceStream(path); + } + + public virtual RadSvgImage GetSvgImage(TSvgSymbols svgImage, SvgImageSize size) + { + return GetSvgImage(svgImage, ResolveCommonSize(size)); + } + + public virtual RadSvgImage GetSvgImage(TSvgSymbols svgImage, Size size) + { + using var stream = GetSvgImageRessourceStream(svgImage); + var img = RadSvgImage.FromStream(stream); + + if (!size.IsEmpty) + img.Size = size; + + return img; + } + + public virtual RadSvgImage GetSvgImageColored(TSvgSymbols svgImage, SvgImageSize size, Color color) + { + return GetSvgImageColored(svgImage, ResolveCommonSize(size), color); + } + + public virtual RadSvgImage GetSvgImageColored(TSvgSymbols svgImage, Size size, Color color) + { + var img = GetSvgImage(svgImage, size); + + img.Document.Fill = new SvgColourServer(color); + img.ClearCache(); + + return img; + } + + public virtual Image GetImage(TSvgSymbols svgImage, SvgImageSize size) + { + return GetImage(svgImage, ResolveCommonSize(size)); + } + + public virtual Image GetImage(TSvgSymbols svgImage, Size size) + { + return GetImageFromSvg(GetSvgImage(svgImage, size)); + } + + public virtual Image GetImageColored(TSvgSymbols svgImage, SvgImageSize size, Color color) + { + return GetImageColored(svgImage, ResolveCommonSize(size), color); + } + + public virtual Image GetImageColored(TSvgSymbols svgImage, Size size, Color color) + { + return GetImageFromSvg(GetSvgImageColored(svgImage, size, color)); + } + + public virtual Image GetImageFromSvg(RadSvgImage svg) + { + return svg.Document.Draw(svg.Width, svg.Height); + } + } +} \ No newline at end of file diff --git a/Pilz.UI.Telerik/Dialogs/DialogBaseForm.Statics.cs b/Pilz.UI.Telerik/Dialogs/DialogBaseForm.Statics.cs new file mode 100644 index 0000000..6bc58a7 --- /dev/null +++ b/Pilz.UI.Telerik/Dialogs/DialogBaseForm.Statics.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Pilz.UI.Telerik.Dialogs +{ + partial class DialogBaseForm + { + public delegate void DialogLoadingEventHandler(DialogLoadingEventArgs e); + public delegate void DialogClosedEventHandler(DialogClosedEventArgs e); + + public static event DialogLoadingEventHandler? DialogLoading; + public static event DialogClosedEventHandler? DialogClosed; + + public static T ShowDialog(string title, Icon icon, object? tag = null) where T : FlyoutDialogBase + { + return ShowDialog(null, title, icon, tag); + } + + public static T ShowDialog(IWin32Window? parent, string title, Icon icon, object? tag = null) where T : FlyoutDialogBase + { + var dialogPanel = Activator.CreateInstance(); + dialogPanel.Dock = DockStyle.Fill; + dialogPanel.Tag = tag; + + var dialog = new DialogBaseForm + { + DialogPanel = dialogPanel, + Text = title, + Icon = icon, + StartPosition = parent == null ? FormStartPosition.CenterScreen : FormStartPosition.CenterParent, + ClientSize = dialogPanel.Size + }; + dialog.Controls.Add(dialogPanel); + dialog.ShowDialog(parent); + + return dialogPanel; + } + } +} diff --git a/Pilz.UI.Telerik/Dialogs/DialogBaseForm.cs b/Pilz.UI.Telerik/Dialogs/DialogBaseForm.cs new file mode 100644 index 0000000..06a6ef3 --- /dev/null +++ b/Pilz.UI.Telerik/Dialogs/DialogBaseForm.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using Telerik.WinControls.UI; + +namespace Pilz.UI.Telerik.Dialogs +{ + public partial class DialogBaseForm : RadForm + { + public FlyoutDialogBase? DialogPanel { get; private set; } + + private DialogBaseForm() + { + Load += DialogBaseForm_Load; + FormClosed += DialogBaseForm_FormClosed; + } + + private void DialogBaseForm_Load(object? sender, EventArgs e) + { + if (DialogPanel is ILoadContent iLoadContent) + iLoadContent.LoadContent(); + + DialogLoading?.Invoke(new DialogLoadingEventArgs(this)); + } + + private void DialogBaseForm_FormClosed(object? sender, FormClosedEventArgs e) + { + DialogClosed?.Invoke(new DialogClosedEventArgs(this)); + } + } +} diff --git a/Pilz.UI.Telerik/Dialogs/DialogClosedEventArgs.cs b/Pilz.UI.Telerik/Dialogs/DialogClosedEventArgs.cs new file mode 100644 index 0000000..8f0b05d --- /dev/null +++ b/Pilz.UI.Telerik/Dialogs/DialogClosedEventArgs.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Pilz.UI.Telerik.Dialogs +{ + public class DialogClosedEventArgs : EventArgs + { + public DialogBaseForm Parent { get; private set; } + public FlyoutDialogBase? Content => Parent?.DialogPanel; + + public DialogClosedEventArgs(DialogBaseForm dialog) + { + Parent = dialog; + } + } +} diff --git a/Pilz.UI.Telerik/Dialogs/DialogLoadingEventArgs.cs b/Pilz.UI.Telerik/Dialogs/DialogLoadingEventArgs.cs new file mode 100644 index 0000000..2e47dbf --- /dev/null +++ b/Pilz.UI.Telerik/Dialogs/DialogLoadingEventArgs.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using System.Windows.Forms.Design; + +namespace Pilz.UI.Telerik.Dialogs +{ + public class DialogLoadingEventArgs : EventArgs + { + public DialogBaseForm Parent { get; private set; } + public FlyoutDialogBase? Content => Parent?.DialogPanel; + + public DialogLoadingEventArgs(DialogBaseForm dialog) + { + Parent = dialog; + } + } +} diff --git a/Pilz.UI.Telerik/Dialogs/FlyoutClosedEventArgs.cs b/Pilz.UI.Telerik/Dialogs/FlyoutClosedEventArgs.cs new file mode 100644 index 0000000..3c310d4 --- /dev/null +++ b/Pilz.UI.Telerik/Dialogs/FlyoutClosedEventArgs.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Pilz.UI.Telerik.Dialogs +{ + public class FlyoutClosedEventArgs : global::Telerik.WinControls.UI.SplashScreen.FlyoutClosedEventArgs + { + public new FlyoutDialogBase? Content => base.Content as FlyoutDialogBase; + + public FlyoutClosedEventArgs(FlyoutDialogBase content) : base(content) + { + } + } +} diff --git a/Pilz.UI.Telerik/Dialogs/FlyoutCreatedEventArgs.cs b/Pilz.UI.Telerik/Dialogs/FlyoutCreatedEventArgs.cs new file mode 100644 index 0000000..e39597c --- /dev/null +++ b/Pilz.UI.Telerik/Dialogs/FlyoutCreatedEventArgs.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using Telerik.WinControls.UI.SplashScreen; + +namespace Pilz.UI.Telerik.Dialogs +{ + public class FlyoutCreatedEventArgs : ContentCreatedEventArgs + { + public new FlyoutDialogBase? Content => base.Content as FlyoutDialogBase; + + public FlyoutCreatedEventArgs(FlyoutDialogBase content) : base(content) + { + } + } +} diff --git a/Pilz.UI.Telerik/Dialogs/FlyoutDialogBase.Designer.cs b/Pilz.UI.Telerik/Dialogs/FlyoutDialogBase.Designer.cs new file mode 100644 index 0000000..385c2ea --- /dev/null +++ b/Pilz.UI.Telerik/Dialogs/FlyoutDialogBase.Designer.cs @@ -0,0 +1,77 @@ +namespace Pilz.UI.Telerik.Dialogs +{ + partial class FlyoutDialogBase + { + /// + /// Erforderliche Designervariable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Verwendete Ressourcen bereinigen. + /// + /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Vom Komponenten-Designer generierter Code + + /// + /// Erforderliche Methode für die Designerunterstützung. + /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden. + /// + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FlyoutDialogBase)); + radButton_Cancel = new global::Telerik.WinControls.UI.RadButton(); + radButton_Confirm = new global::Telerik.WinControls.UI.RadButton(); + panel_ActionButtons = new System.Windows.Forms.Panel(); + ((System.ComponentModel.ISupportInitialize)radButton_Cancel).BeginInit(); + ((System.ComponentModel.ISupportInitialize)radButton_Confirm).BeginInit(); + panel_ActionButtons.SuspendLayout(); + SuspendLayout(); + // + // radButton_Cancel + // + resources.ApplyResources(radButton_Cancel, "radButton_Cancel"); + radButton_Cancel.Name = "radButton_Cancel"; + radButton_Cancel.Click += RadButton_Cancel_Click; + // + // radButton_Confirm + // + resources.ApplyResources(radButton_Confirm, "radButton_Confirm"); + radButton_Confirm.Name = "radButton_Confirm"; + radButton_Confirm.Click += RadButton_Confirm_Click; + // + // panel_ActionButtons + // + panel_ActionButtons.Controls.Add(radButton_Cancel); + panel_ActionButtons.Controls.Add(radButton_Confirm); + resources.ApplyResources(panel_ActionButtons, "panel_ActionButtons"); + panel_ActionButtons.Name = "panel_ActionButtons"; + // + // FlyoutDialogBase + // + resources.ApplyResources(this, "$this"); + AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + Controls.Add(panel_ActionButtons); + Name = "FlyoutDialogBase"; + ((System.ComponentModel.ISupportInitialize)radButton_Cancel).EndInit(); + ((System.ComponentModel.ISupportInitialize)radButton_Confirm).EndInit(); + panel_ActionButtons.ResumeLayout(false); + ResumeLayout(false); + } + + #endregion + + private global::Telerik.WinControls.UI.RadButton radButton_Cancel; + private global::Telerik.WinControls.UI.RadButton radButton_Confirm; + private System.Windows.Forms.Panel panel_ActionButtons; + } +} diff --git a/Pilz.UI.Telerik/Dialogs/FlyoutDialogBase.Statics.cs b/Pilz.UI.Telerik/Dialogs/FlyoutDialogBase.Statics.cs new file mode 100644 index 0000000..25b1c3b --- /dev/null +++ b/Pilz.UI.Telerik/Dialogs/FlyoutDialogBase.Statics.cs @@ -0,0 +1,101 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Telerik.WinControls.UI.SplashScreen; +using Telerik.WinControls.UI; +using System.Windows.Forms; + +namespace Pilz.UI.Telerik.Dialogs +{ + partial class FlyoutDialogBase + { + public delegate void FlyoutCreatedEventHandler(FlyoutCreatedEventArgs e); + public delegate void FlyoutClosedEventHandler(FlyoutClosedEventArgs e); + + public static event FlyoutCreatedEventHandler FlyoutCreated + { + add => flyoutCreatedHandlers.Add(value); + remove => flyoutCreatedHandlers.Remove(value); + } + + public static event FlyoutClosedEventHandler FlyoutClosed + { + add => flyoutCloseHandlers.Add(value); + remove => flyoutCloseHandlers.Remove(value); + } + + private static readonly List flyoutCreatedHandlers = new(); + private static readonly List flyoutCloseHandlers = new(); + + private static object? tagToAssign = null; + public static Control? ParentContext { get; private set; } = null; + + static FlyoutDialogBase() + { + RadFlyoutManager.ContentCreated += RadFlyoutManager_ContentCreated; + RadFlyoutManager.FlyoutClosed += RadFlyoutManager_FlyoutClosed; + } + + private static void RadFlyoutManager_ContentCreated(ContentCreatedEventArgs e) + { + if (e.Content is FlyoutDialogBase dialogBase) + { + if (tagToAssign != null) + dialogBase.Tag = tagToAssign; + + var eventArgs = new FlyoutCreatedEventArgs((FlyoutDialogBase)e.Content); + + if (dialogBase is ILoadContent iLoadContent) + iLoadContent.LoadContent(); + + foreach (var args in flyoutCreatedHandlers) + { + if (ParentContext != null) + ParentContext?.Invoke(args, eventArgs); + else + args.Invoke(eventArgs); + } + } + } + + private static void RadFlyoutManager_FlyoutClosed(global::Telerik.WinControls.UI.SplashScreen.FlyoutClosedEventArgs e) + { + if (e.Content is FlyoutDialogBase dialogBase) + { + var eventArgs = new FlyoutClosedEventArgs((FlyoutDialogBase)e.Content); + + foreach (var args in flyoutCloseHandlers) + { + if (ParentContext != null) + ParentContext?.Invoke(args, eventArgs); + else + args.Invoke(eventArgs); + } + } + + ParentContext = null; + } + + public static void Show(Control controlToAssociate, object? tag = null) + { + Show(controlToAssociate, typeof(T), tag); + } + + public static void Show(Control controlToAssociate, Type flyoutContentType, object? tag = null) + { + tagToAssign = tag; + ParentContext = controlToAssociate; + RadFlyoutManager.Show(controlToAssociate, flyoutContentType); + } + + protected static void CloseFlyout() + { + if (ParentContext == null) + throw new NullReferenceException(nameof(ParentContext)); + + ParentContext.BeginInvoke(RadFlyoutManager.Close); + } + } +} diff --git a/Pilz.UI.Telerik/Dialogs/FlyoutDialogBase.cs b/Pilz.UI.Telerik/Dialogs/FlyoutDialogBase.cs new file mode 100644 index 0000000..6dff35e --- /dev/null +++ b/Pilz.UI.Telerik/Dialogs/FlyoutDialogBase.cs @@ -0,0 +1,86 @@ +using Pilz.UI.Telerik; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using Telerik.WinControls; +using Telerik.WinControls.UI; +using Telerik.WinControls.UI.SplashScreen; +using static Telerik.WinControls.UI.PopupEditorNotificationData; + +namespace Pilz.UI.Telerik.Dialogs +{ + public partial class FlyoutDialogBase : UserControl + { + public static RadSvgImage? CancelSvg { get; set; } = null; + public static RadSvgImage? ConfirmSvg { get; set; } = null; + + public DialogResult Result { get; protected set; } + + protected bool ActionPanelVisible + { + get => panel_ActionButtons.Visible; + set => panel_ActionButtons.Visible = value; + } + + protected bool CancelButtonEnable + { + get => radButton_Cancel.Enabled; + set => radButton_Cancel.Enabled = value; + } + + protected bool ConfirmButtonEnable + { + get => radButton_Confirm.Enabled; + set => radButton_Confirm.Enabled = value; + } + + protected FlyoutDialogBase() + { + InitializeComponent(); + ParentChanged += FlyoutDialogBase_ParentChanged; + + // SVG Symbols + radButton_Cancel.SvgImage = CancelSvg; + radButton_Confirm.SvgImage = ConfirmSvg; + } + + private void FlyoutDialogBase_ParentChanged(object? sender, EventArgs e) + { + var frm = FindForm(); + if (frm != null) + frm.AcceptButton = radButton_Confirm; + } + + protected void Close(DialogResult result) + { + Result = result; + + if (FindForm() is DialogBaseForm dialogForm) + dialogForm.Close(); + else + CloseFlyout(); + } + + private void RadButton_Confirm_Click(object sender, EventArgs e) + { + if (ValidateOK()) + Close(DialogResult.OK); + } + + private void RadButton_Cancel_Click(object sender, EventArgs e) + { + Close(DialogResult.Cancel); + } + + protected virtual bool ValidateOK() + { + return true; + } + } +} diff --git a/Pilz.UI.Telerik/Dialogs/FlyoutDialogBase.resx b/Pilz.UI.Telerik/Dialogs/FlyoutDialogBase.resx new file mode 100644 index 0000000..ce650cc --- /dev/null +++ b/Pilz.UI.Telerik/Dialogs/FlyoutDialogBase.resx @@ -0,0 +1,234 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + Top, Right + + + + MiddleRight + + + 187, 3 + + + 110, 24 + + + + 0 + + + Cancel + + + MiddleLeft + + + ImageBeforeText + + + radButton_Cancel + + + Telerik.WinControls.UI.RadButton, Telerik.WinControls.UI, Culture=neutral, PublicKeyToken=5bb2a467cbec794e + + + panel_ActionButtons + + + 0 + + + Top, Right + + + MiddleRight + + + 71, 3 + + + 110, 24 + + + 1 + + + Okay + + + MiddleLeft + + + ImageBeforeText + + + radButton_Confirm + + + Telerik.WinControls.UI.RadButton, Telerik.WinControls.UI, Culture=neutral, PublicKeyToken=5bb2a467cbec794e + + + panel_ActionButtons + + + 1 + + + Bottom + + + 0, 120 + + + 300, 30 + + + 2 + + + panel_ActionButtons + + + System.Windows.Forms.Panel, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 0 + + + True + + + 7, 15 + + + 300, 150 + + + FlyoutDialogBase + + + System.Windows.Forms.UserControl, System.Windows.Forms, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Pilz.UI.Telerik/Dialogs/ILoadContent.cs b/Pilz.UI.Telerik/Dialogs/ILoadContent.cs new file mode 100644 index 0000000..6ab549c --- /dev/null +++ b/Pilz.UI.Telerik/Dialogs/ILoadContent.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Pilz.UI.Telerik.Dialogs +{ + public interface ILoadContent + { + void LoadContent(); + } +} diff --git a/Pilz.UI.Telerik/Pilz.UI.Telerik.csproj b/Pilz.UI.Telerik/Pilz.UI.Telerik.csproj new file mode 100644 index 0000000..e6dfa26 --- /dev/null +++ b/Pilz.UI.Telerik/Pilz.UI.Telerik.csproj @@ -0,0 +1,20 @@ + + + + net6.0-windows + enable + enable + true + + + + True + 1.yyyy.Mdd.Hmm + 1.2023.914.856 + + + + + + + diff --git a/Pilz.UI/DisplayHelp.vb b/Pilz.UI/DisplayHelp.vb index 46b238d..1f7899e 100644 --- a/Pilz.UI/DisplayHelp.vb +++ b/Pilz.UI/DisplayHelp.vb @@ -149,6 +149,12 @@ Public Class DisplayHelp If cornerSize = 0 Then path.AddRectangle(r) + Else + AddCornerArc(path, r, cornerSize, eCornerArc.TopLeft) + AddCornerArc(path, r, cornerSize, eCornerArc.TopRight) + AddCornerArc(path, r, cornerSize, eCornerArc.BottomRight) + AddCornerArc(path, r, cornerSize, eCornerArc.BottomLeft) + path.CloseAllFigures() End If Return path @@ -160,4 +166,67 @@ Public Class DisplayHelp Return New LinearGradientBrush(New Rectangle(r.X, r.Y - 1, r.Width, r.Height + 1), color1, color2, gradientAngle) End Function + Public Shared Sub AddCornerArc(ByVal path As GraphicsPath, ByVal bounds As Rectangle, ByVal cornerDiameter As Integer, ByVal corner As eCornerArc) + If cornerDiameter > 0 Then + Dim a As ArcData = GetCornerArc(bounds, cornerDiameter, corner) + path.AddArc(a.X, a.Y, a.Width, a.Height, a.StartAngle, a.SweepAngle) + Else + + If corner = eCornerArc.TopLeft Then + path.AddLine(bounds.X, bounds.Y + 2, bounds.X, bounds.Y) + ElseIf corner = eCornerArc.BottomLeft Then + path.AddLine(bounds.X + 2, bounds.Bottom, bounds.X, bounds.Bottom) + ElseIf corner = eCornerArc.TopRight Then + path.AddLine(bounds.Right - 2, bounds.Y, bounds.Right, bounds.Y) + ElseIf corner = eCornerArc.BottomRight Then + path.AddLine(bounds.Right, bounds.Bottom - 2, bounds.Right, bounds.Bottom) + End If + End If + End Sub + + Friend Shared Function GetCornerArc(ByVal bounds As Rectangle, ByVal cornerDiameter As Integer, ByVal corner As eCornerArc) As ArcData + Dim a As ArcData + If cornerDiameter = 0 Then cornerDiameter = 1 + Dim diameter As Integer = cornerDiameter * 2 + + Select Case corner + Case eCornerArc.TopLeft + a = New ArcData(bounds.X, bounds.Y, diameter, diameter, 180, 90) + Case eCornerArc.TopRight + a = New ArcData(bounds.Right - diameter, bounds.Y, diameter, diameter, 270, 90) + Case eCornerArc.BottomLeft + a = New ArcData(bounds.X, bounds.Bottom - diameter, diameter, diameter, 90, 90) + Case Else + a = New ArcData(bounds.Right - diameter, bounds.Bottom - diameter, diameter, diameter, 0, 90) + End Select + + Return a + End Function + + Public Enum eCornerArc + TopLeft + TopRight + BottomLeft + BottomRight + End Enum + + + Friend Structure ArcData + Public X As Integer + Public Y As Integer + Public Width As Integer + Public Height As Integer + Public StartAngle As Single + Public SweepAngle As Single + + Public Sub New(ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal startAngle As Single, ByVal sweepAngle As Single) + Me.X = x + Me.Y = y + Me.Width = width + Me.Height = height + Me.StartAngle = startAngle + Me.SweepAngle = sweepAngle + End Sub + End Structure + End Class diff --git a/Pilz.UI/Highlighter.vb b/Pilz.UI/Highlighter.vb index 00d69fd..db56865 100644 --- a/Pilz.UI/Highlighter.vb +++ b/Pilz.UI/Highlighter.vb @@ -320,24 +320,26 @@ Public Class Highlighter Private Sub UpdateHighlightPanelBounds() Dim bounds As Rectangle = New Rectangle(0, 0, _ContainerControl.ClientRectangle.Width, _ContainerControl.ClientRectangle.Height) - If TypeOf _HighlightPanel.Parent Is Form Then - Dim form As Form = TryCast(_HighlightPanel.Parent, Form) + If _HighlightPanel IsNot Nothing Then + If TypeOf _HighlightPanel.Parent Is Form Then + Dim form As Form = TryCast(_HighlightPanel.Parent, Form) - If form.AutoSize Then - bounds.X += form.Padding.Left - bounds.Y += form.Padding.Top - bounds.Width -= form.Padding.Horizontal - bounds.Height -= form.Padding.Vertical + If form.AutoSize Then + bounds.X += form.Padding.Left + bounds.Y += form.Padding.Top + bounds.Width -= form.Padding.Horizontal + bounds.Height -= form.Padding.Vertical + End If End If - End If - If _HighlightPanel.Bounds.Equals(bounds) Then - _HighlightPanel.UpdateRegion() - Else - _HighlightPanel.Bounds = bounds - End If + If _HighlightPanel.Bounds.Equals(bounds) Then + _HighlightPanel.UpdateRegion() + Else + _HighlightPanel.Bounds = bounds + End If - _HighlightPanel.BringToFront() + _HighlightPanel.BringToFront() + End If End Sub Private _DelayTimer As Timer = Nothing @@ -386,17 +388,6 @@ Public Class Highlighter End Set End Property - Public Function CanExtend(ByVal extendee As Object) As Boolean - Return (TypeOf extendee Is Control) - End Function - - Private Sub SetError(ByVal control As Control, ByVal value As String) - Me.SetHighlightColor(control, eHighlightColor.Red) - End Sub - - Private Sub ClearError(ByVal control As Control) - Me.SetHighlightColor(control, eHighlightColor.None) - End Sub End Class Public Enum eHighlightColor diff --git a/Pilz.UI/Pilz.UI.vbproj b/Pilz.UI/Pilz.UI.vbproj index 425919f..59a9ac3 100644 --- a/Pilz.UI/Pilz.UI.vbproj +++ b/Pilz.UI/Pilz.UI.vbproj @@ -1,10 +1,11 @@  Windows - net48 + net6.0-windows 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 Pilz.UI.xml true + true true @@ -36,15 +37,17 @@ true MinimumRecommendedRules.ruleset + + True + 1.yyyy.Mdd.Hmm + 1.2023.914.856 + - - - - + @@ -58,9 +61,7 @@ - - UserControl - + True Application.myapp diff --git a/Pilz.Win32/Pilz.Win32.vbproj b/Pilz.Win32/Pilz.Win32.vbproj index cab3346..ca7bff4 100644 --- a/Pilz.Win32/Pilz.Win32.vbproj +++ b/Pilz.Win32/Pilz.Win32.vbproj @@ -1,10 +1,11 @@  Windows - net48 + net6.0-windows 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 Pilz.Win32.xml true + true true @@ -24,6 +25,11 @@ On + + True + 1.yyyy.Mdd.Hmm + 1.2023.914.856 + diff --git a/Pilz.sln b/Pilz.sln index 6271f04..20a2f6a 100644 --- a/Pilz.sln +++ b/Pilz.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.28307.329 +# Visual Studio Version 17 +VisualStudioVersion = 17.7.34018.315 MinimumVisualStudioVersion = 10.0.40219.1 Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Pilz", "Pilz\Pilz.vbproj", "{277D2B83-7613-4C49-9CAB-E080195A6E0C}" EndProject @@ -31,6 +31,10 @@ Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Pilz.Networking", "Pilz.Net EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pilz.Cryptography", "Pilz.Cryptography\Pilz.Cryptography.csproj", "{3F5988E6-439E-4A9D-B2C6-47EFFB161AC6}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pilz.UI.Telerik.SymbolFactory", "Pilz.UI.Telerik.SymbolFactory\Pilz.UI.Telerik.SymbolFactory.csproj", "{2B3B8161-29FF-4526-9082-4410AB5144A5}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Pilz.UI.Telerik", "Pilz.UI.Telerik\Pilz.UI.Telerik.csproj", "{DF674119-CC28-40AA-968F-1E23D184A491}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -151,6 +155,22 @@ Global {3F5988E6-439E-4A9D-B2C6-47EFFB161AC6}.Release|Any CPU.Build.0 = Release|Any CPU {3F5988E6-439E-4A9D-B2C6-47EFFB161AC6}.Release|x86.ActiveCfg = Release|Any CPU {3F5988E6-439E-4A9D-B2C6-47EFFB161AC6}.Release|x86.Build.0 = Release|Any CPU + {2B3B8161-29FF-4526-9082-4410AB5144A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2B3B8161-29FF-4526-9082-4410AB5144A5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2B3B8161-29FF-4526-9082-4410AB5144A5}.Debug|x86.ActiveCfg = Debug|Any CPU + {2B3B8161-29FF-4526-9082-4410AB5144A5}.Debug|x86.Build.0 = Debug|Any CPU + {2B3B8161-29FF-4526-9082-4410AB5144A5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2B3B8161-29FF-4526-9082-4410AB5144A5}.Release|Any CPU.Build.0 = Release|Any CPU + {2B3B8161-29FF-4526-9082-4410AB5144A5}.Release|x86.ActiveCfg = Release|Any CPU + {2B3B8161-29FF-4526-9082-4410AB5144A5}.Release|x86.Build.0 = Release|Any CPU + {DF674119-CC28-40AA-968F-1E23D184A491}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DF674119-CC28-40AA-968F-1E23D184A491}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DF674119-CC28-40AA-968F-1E23D184A491}.Debug|x86.ActiveCfg = Debug|Any CPU + {DF674119-CC28-40AA-968F-1E23D184A491}.Debug|x86.Build.0 = Debug|Any CPU + {DF674119-CC28-40AA-968F-1E23D184A491}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DF674119-CC28-40AA-968F-1E23D184A491}.Release|Any CPU.Build.0 = Release|Any CPU + {DF674119-CC28-40AA-968F-1E23D184A491}.Release|x86.ActiveCfg = Release|Any CPU + {DF674119-CC28-40AA-968F-1E23D184A491}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Pilz/Pilz.vbproj b/Pilz/Pilz.vbproj index c0a2614..9299ed3 100644 --- a/Pilz/Pilz.vbproj +++ b/Pilz/Pilz.vbproj @@ -6,7 +6,7 @@ true latest Pilz - DRSN + Pilzinsel64 Pilz Copyright © Pilzinsel64 2019 - 2020 Pilz.xml @@ -30,6 +30,9 @@ On + True + 1.yyyy.Mdd.Hmm + 1.2023.914.856 diff --git a/Shared Libs/OpenTK3.dll b/Shared Libs/OpenTK3.dll new file mode 100644 index 0000000..5028d1b Binary files /dev/null and b/Shared Libs/OpenTK3.dll differ