more work on gtk & code cleanup

This commit is contained in:
2025-06-16 15:30:56 +02:00
parent 6f7bb5d92c
commit a49a3b2beb
69 changed files with 374 additions and 268 deletions

View File

@@ -10,7 +10,7 @@ public class ConfigurationManagerList : IList<ConfigurationManager>
public delegate void GettingParentManagerEventHandler(object sender, GetValueEventArgs<SimpleConfiguration> e); public delegate void GettingParentManagerEventHandler(object sender, GetValueEventArgs<SimpleConfiguration> e);
private readonly List<ConfigurationManager> myList = new List<ConfigurationManager>(); private readonly List<ConfigurationManager> myList = [];
private object GetParentManager() private object GetParentManager()
{ {

View File

@@ -7,7 +7,7 @@ namespace Pilz.Configuration;
public class SimpleConfiguration public class SimpleConfiguration
{ {
[JsonIgnore] [JsonIgnore]
public readonly ConfigurationManagerList Managers = new ConfigurationManagerList(); public readonly ConfigurationManagerList Managers = [];
public SimpleConfiguration() public SimpleConfiguration()
{ {

View File

@@ -44,8 +44,7 @@ public class SecureString
{ {
if (Crypter == null) if (Crypter == null)
{ {
if (DefaultCrypter == null) DefaultCrypter ??= new SimpleStringCrypter(string.Empty);
DefaultCrypter = new SimpleStringCrypter(string.Empty);
Crypter = DefaultCrypter; Crypter = DefaultCrypter;
} }
return Crypter; return Crypter;
@@ -66,7 +65,7 @@ public class SecureString
} }
public static implicit operator string(SecureString value) => value?.Value; public static implicit operator string(SecureString value) => value?.Value;
public static implicit operator SecureString(string value) => new SecureString(value, false); public static implicit operator SecureString(string value) => new(value, false);
public static bool operator ==(SecureString left, SecureString right) => left?.EncryptedValue == right?.EncryptedValue; public static bool operator ==(SecureString left, SecureString right) => left?.EncryptedValue == right?.EncryptedValue;
public static bool operator !=(SecureString left, SecureString right) => left?.EncryptedValue != right?.EncryptedValue; public static bool operator !=(SecureString left, SecureString right) => left?.EncryptedValue != right?.EncryptedValue;

View File

@@ -120,7 +120,7 @@ Namespace CameraN
Private Sub OrientateCam(ang As Single, ang2 As Single) Private Sub OrientateCam(ang As Single, ang2 As Single)
Dim CamLX As Single = CSng(Math.Sin(ang)) * CSng(Math.Sin(-ang2)) Dim CamLX As Single = CSng(Math.Sin(ang)) * CSng(Math.Sin(-ang2))
Dim CamLY As Single = CSng(Math.Cos(ang2)) Dim CamLY As Single = Math.Cos(ang2)
Dim CamLZ As Single = CSng(-Math.Cos(ang)) * CSng(Math.Sin(-ang2)) Dim CamLZ As Single = CSng(-Math.Cos(ang)) * CSng(Math.Sin(-ang2))
myLookat.X = pos.X + (-CamLX) * 100.0F myLookat.X = pos.X + (-CamLX) * 100.0F
@@ -131,11 +131,11 @@ Namespace CameraN
Private Sub OffsetCam(xAmt As Integer, yAmt As Integer, zAmt As Integer) Private Sub OffsetCam(xAmt As Integer, yAmt As Integer, zAmt As Integer)
Dim pitch_Renamed As Double = CamAngleY - (Math.PI / 2) Dim pitch_Renamed As Double = CamAngleY - (Math.PI / 2)
Dim CamLX As Single = CSng(Math.Sin(CamAngleX)) * CSng(Math.Cos(-pitch_Renamed)) Dim CamLX As Single = CSng(Math.Sin(CamAngleX)) * CSng(Math.Cos(-pitch_Renamed))
Dim CamLY As Single = CSng(Math.Sin(pitch_Renamed)) Dim CamLY As Single = Math.Sin(pitch_Renamed)
Dim CamLZ As Single = CSng(-Math.Cos(CamAngleX)) * CSng(Math.Cos(-pitch_Renamed)) Dim CamLZ As Single = CSng(-Math.Cos(CamAngleX)) * CSng(Math.Cos(-pitch_Renamed))
pos.X = pos.X + xAmt * (CamLX) * CamSpeedMultiplier pos.X += xAmt * (CamLX) * CamSpeedMultiplier
pos.Y = pos.Y + yAmt * (CamLY) * CamSpeedMultiplier pos.Y += yAmt * (CamLY) * CamSpeedMultiplier
pos.Z = pos.Z + zAmt * (CamLZ) * CamSpeedMultiplier pos.Z += zAmt * (CamLZ) * CamSpeedMultiplier
End Sub End Sub
Public Sub Move(y As Single, ByRef camMtx As Matrix4) Public Sub Move(y As Single, ByRef camMtx As Matrix4)
@@ -154,7 +154,7 @@ Namespace CameraN
Dim x_diff As Single = myLookat.X - pos.X Dim x_diff As Single = myLookat.X - pos.X
Dim y_diff As Single = myLookat.Y - pos.Y Dim y_diff As Single = myLookat.Y - pos.Y
Dim z_diff As Single = myLookat.Z - pos.Z Dim z_diff As Single = myLookat.Z - pos.Z
Dim dist As Single = CSng(Math.Sqrt(x_diff * x_diff + y_diff * y_diff + z_diff * z_diff)) Dim dist As Single = Math.Sqrt(x_diff * x_diff + y_diff * y_diff + z_diff * z_diff)
If z_diff = 0 Then If z_diff = 0 Then
z_diff = 0.001F z_diff = 0.001F
End If End If
@@ -210,32 +210,32 @@ Namespace CameraN
currentLookDirection = dir currentLookDirection = dir
Select Case currentLookDirection Select Case currentLookDirection
Case LookDirection.Top Case LookDirection.Top
pos = lookPositions(CInt(LookDirection.Top)) pos = lookPositions(LookDirection.Top)
myLookat = New Vector3(pos.X, -25000, pos.Z - 1) myLookat = New Vector3(pos.X, -25000, pos.Z - 1)
UpdateMatrix(cameraMatrix) UpdateMatrix(cameraMatrix)
SetRotationFromLookAt() SetRotationFromLookAt()
Case LookDirection.Bottom Case LookDirection.Bottom
pos = lookPositions(CInt(LookDirection.Bottom)) pos = lookPositions(LookDirection.Bottom)
myLookat = New Vector3(pos.X, 25000, pos.Z + 1) myLookat = New Vector3(pos.X, 25000, pos.Z + 1)
UpdateMatrix(cameraMatrix) UpdateMatrix(cameraMatrix)
SetRotationFromLookAt() SetRotationFromLookAt()
Case LookDirection.Left Case LookDirection.Left
pos = lookPositions(CInt(LookDirection.Left)) pos = lookPositions(LookDirection.Left)
myLookat = New Vector3(25000, pos.Y, pos.Z) myLookat = New Vector3(25000, pos.Y, pos.Z)
UpdateMatrix(cameraMatrix) UpdateMatrix(cameraMatrix)
SetRotationFromLookAt() SetRotationFromLookAt()
Case LookDirection.Right Case LookDirection.Right
pos = lookPositions(CInt(LookDirection.Right)) pos = lookPositions(LookDirection.Right)
myLookat = New Vector3(-25000, pos.Y, pos.Z) myLookat = New Vector3(-25000, pos.Y, pos.Z)
UpdateMatrix(cameraMatrix) UpdateMatrix(cameraMatrix)
SetRotationFromLookAt() SetRotationFromLookAt()
Case LookDirection.Front Case LookDirection.Front
pos = lookPositions(CInt(LookDirection.Front)) pos = lookPositions(LookDirection.Front)
myLookat = New Vector3(pos.X, pos.Y, -25000) myLookat = New Vector3(pos.X, pos.Y, -25000)
UpdateMatrix(cameraMatrix) UpdateMatrix(cameraMatrix)
SetRotationFromLookAt() SetRotationFromLookAt()
Case LookDirection.Back Case LookDirection.Back
pos = lookPositions(CInt(LookDirection.Back)) pos = lookPositions(LookDirection.Back)
myLookat = New Vector3(pos.X, pos.Y, 25000) myLookat = New Vector3(pos.X, pos.Y, 25000)
UpdateMatrix(cameraMatrix) UpdateMatrix(cameraMatrix)
SetRotationFromLookAt() SetRotationFromLookAt()
@@ -313,9 +313,9 @@ Namespace CameraN
Dim pitch_Renamed As Double = CamAngleY - (Math.PI / 2) Dim pitch_Renamed As Double = CamAngleY - (Math.PI / 2)
Dim yaw_Renamed As Double = CamAngleX - (Math.PI / 2) Dim yaw_Renamed As Double = CamAngleX - (Math.PI / 2)
Dim CamLX As Single = CSng(Math.Sin(yaw_Renamed)) Dim CamLX As Single = Math.Sin(yaw_Renamed)
Dim CamLY As Single = CSng(Math.Cos(pitch_Renamed)) Dim CamLY As Single = Math.Cos(pitch_Renamed)
Dim CamLZ As Single = CSng(-Math.Cos(yaw_Renamed)) Dim CamLZ As Single = -Math.Cos(yaw_Renamed)
Dim m As Single = 8.0F Dim m As Single = 8.0F
@@ -324,36 +324,36 @@ Namespace CameraN
pos.X = orgPos.X - ((MousePosX * CamSpeedMultiplier) * (CamLX) * m) - ((MousePosY * CamSpeedMultiplier) * (CamLZ) * m) pos.X = orgPos.X - ((MousePosX * CamSpeedMultiplier) * (CamLX) * m) - ((MousePosY * CamSpeedMultiplier) * (CamLZ) * m)
pos.Z = orgPos.Z - ((MousePosX * CamSpeedMultiplier) * (CamLZ) * m) - ((MousePosY * CamSpeedMultiplier) * (CamLX) * m) pos.Z = orgPos.Z - ((MousePosX * CamSpeedMultiplier) * (CamLZ) * m) - ((MousePosY * CamSpeedMultiplier) * (CamLX) * m)
cameraMatrix = Matrix4.LookAt(pos.X, pos.Y, pos.Z, pos.X, pos.Y - 1000, pos.Z - 1, 0, 1, 0) cameraMatrix = Matrix4.LookAt(pos.X, pos.Y, pos.Z, pos.X, pos.Y - 1000, pos.Z - 1, 0, 1, 0)
lookPositions(CInt(currentLookDirection)) = pos lookPositions(currentLookDirection) = pos
Case LookDirection.Bottom Case LookDirection.Bottom
pos.X = orgPos.X - ((MousePosX * CamSpeedMultiplier) * (CamLX) * m) + ((MousePosY * CamSpeedMultiplier) * (CamLZ) * m) pos.X = orgPos.X - ((MousePosX * CamSpeedMultiplier) * (CamLX) * m) + ((MousePosY * CamSpeedMultiplier) * (CamLZ) * m)
pos.Z = orgPos.Z - ((MousePosX * CamSpeedMultiplier) * (CamLZ) * m) + ((MousePosY * CamSpeedMultiplier) * (CamLX) * m) pos.Z = orgPos.Z - ((MousePosX * CamSpeedMultiplier) * (CamLZ) * m) + ((MousePosY * CamSpeedMultiplier) * (CamLX) * m)
cameraMatrix = Matrix4.LookAt(pos.X, pos.Y, pos.Z, pos.X, pos.Y + 1000, pos.Z + 1, 0, 1, 0) cameraMatrix = Matrix4.LookAt(pos.X, pos.Y, pos.Z, pos.X, pos.Y + 1000, pos.Z + 1, 0, 1, 0)
lookPositions(CInt(currentLookDirection)) = pos lookPositions(currentLookDirection) = pos
Case LookDirection.Left Case LookDirection.Left
pos.X = orgPos.X - ((MousePosX * CamSpeedMultiplier) * (CamLX) * m) pos.X = orgPos.X - ((MousePosX * CamSpeedMultiplier) * (CamLX) * m)
pos.Y = orgPos.Y - ((MousePosY * CamSpeedMultiplier) * (-1.0F) * m) pos.Y = orgPos.Y - ((MousePosY * CamSpeedMultiplier) * (-1.0F) * m)
pos.Z = orgPos.Z - ((MousePosX * CamSpeedMultiplier) * (CamLZ) * m) pos.Z = orgPos.Z - ((MousePosX * CamSpeedMultiplier) * (CamLZ) * m)
cameraMatrix = Matrix4.LookAt(pos.X, pos.Y, pos.Z, pos.X + 12500, pos.Y, pos.Z, 0, 1, 0) cameraMatrix = Matrix4.LookAt(pos.X, pos.Y, pos.Z, pos.X + 12500, pos.Y, pos.Z, 0, 1, 0)
lookPositions(CInt(currentLookDirection)) = pos lookPositions(currentLookDirection) = pos
Case LookDirection.Right Case LookDirection.Right
pos.X = orgPos.X - ((MousePosX * CamSpeedMultiplier) * (CamLX) * m) pos.X = orgPos.X - ((MousePosX * CamSpeedMultiplier) * (CamLX) * m)
pos.Y = orgPos.Y - ((MousePosY * CamSpeedMultiplier) * (-1.0F) * m) pos.Y = orgPos.Y - ((MousePosY * CamSpeedMultiplier) * (-1.0F) * m)
pos.Z = orgPos.Z - ((MousePosX * CamSpeedMultiplier) * (CamLZ) * m) pos.Z = orgPos.Z - ((MousePosX * CamSpeedMultiplier) * (CamLZ) * m)
cameraMatrix = Matrix4.LookAt(pos.X, pos.Y, pos.Z, pos.X - 12500, pos.Y, pos.Z, 0, 1, 0) cameraMatrix = Matrix4.LookAt(pos.X, pos.Y, pos.Z, pos.X - 12500, pos.Y, pos.Z, 0, 1, 0)
lookPositions(CInt(currentLookDirection)) = pos lookPositions(currentLookDirection) = pos
Case LookDirection.Front Case LookDirection.Front
pos.X = orgPos.X - ((MousePosX * CamSpeedMultiplier) * (CamLX) * m) pos.X = orgPos.X - ((MousePosX * CamSpeedMultiplier) * (CamLX) * m)
pos.Y = orgPos.Y - ((MousePosY * CamSpeedMultiplier) * (-1.0F) * m) pos.Y = orgPos.Y - ((MousePosY * CamSpeedMultiplier) * (-1.0F) * m)
pos.Z = orgPos.Z - ((MousePosX * CamSpeedMultiplier) * (CamLZ) * m) pos.Z = orgPos.Z - ((MousePosX * CamSpeedMultiplier) * (CamLZ) * m)
cameraMatrix = Matrix4.LookAt(pos.X, pos.Y, pos.Z, pos.X, pos.Y, pos.Z - 12500, 0, 1, 0) cameraMatrix = Matrix4.LookAt(pos.X, pos.Y, pos.Z, pos.X, pos.Y, pos.Z - 12500, 0, 1, 0)
lookPositions(CInt(currentLookDirection)) = pos lookPositions(currentLookDirection) = pos
Case LookDirection.Back Case LookDirection.Back
pos.X = orgPos.X - ((MousePosX * CamSpeedMultiplier) * (CamLX) * m) pos.X = orgPos.X - ((MousePosX * CamSpeedMultiplier) * (CamLX) * m)
pos.Y = orgPos.Y - ((MousePosY * CamSpeedMultiplier) * (-1.0F) * m) pos.Y = orgPos.Y - ((MousePosY * CamSpeedMultiplier) * (-1.0F) * m)
pos.Z = orgPos.Z - ((MousePosX * CamSpeedMultiplier) * (CamLZ) * m) pos.Z = orgPos.Z - ((MousePosX * CamSpeedMultiplier) * (CamLZ) * m)
cameraMatrix = Matrix4.LookAt(pos.X, pos.Y, pos.Z, pos.X, pos.Y, pos.Z + 12500, 0, 1, 0) cameraMatrix = Matrix4.LookAt(pos.X, pos.Y, pos.Z, pos.X, pos.Y, pos.Z + 12500, 0, 1, 0)
lookPositions(CInt(currentLookDirection)) = pos lookPositions(currentLookDirection) = pos
End Select End Select
RaisePerspectiveChanged() RaisePerspectiveChanged()
@@ -372,7 +372,7 @@ Namespace CameraN
End If End If
Dim MousePosX As Integer = mouseX - lastMouseX Dim MousePosX As Integer = mouseX - lastMouseX
Dim MousePosY As Integer = mouseY - lastMouseY Dim MousePosY As Integer = mouseY - lastMouseY
CamAngleX = CamAngleX + (0.01F * MousePosX) CamAngleX += (0.01F * MousePosX)
' This next part isn't neccessary, but it keeps the Yaw rotation value within [0, 2*pi] which makes debugging simpler. ' This next part isn't neccessary, but it keeps the Yaw rotation value within [0, 2*pi] which makes debugging simpler.
If CamAngleX > TAU Then If CamAngleX > TAU Then
CamAngleX -= TAU CamAngleX -= TAU
@@ -419,9 +419,9 @@ Namespace CameraN
'Console.WriteLine(MousePosX+","+ MousePosY); 'Console.WriteLine(MousePosX+","+ MousePosY);
Dim pitch_Renamed As Double = CamAngleY - (Math.PI / 2) Dim pitch_Renamed As Double = CamAngleY - (Math.PI / 2)
Dim yaw_Renamed As Double = CamAngleX - (Math.PI / 2) Dim yaw_Renamed As Double = CamAngleX - (Math.PI / 2)
Dim CamLX As Single = CSng(Math.Sin(yaw_Renamed)) Dim CamLX As Single = Math.Sin(yaw_Renamed)
' float CamLY = (float)Math.Cos(pitch); ' float CamLY = (float)Math.Cos(pitch);
Dim CamLZ As Single = CSng(-Math.Cos(yaw_Renamed)) Dim CamLZ As Single = -Math.Cos(yaw_Renamed)
pos.X += ((horz_amount * CamSpeedMultiplier) * (CamLX)) pos.X += ((horz_amount * CamSpeedMultiplier) * (CamLX))
pos.Y += ((vert_amount * CamSpeedMultiplier) * (-1.0F)) pos.Y += ((vert_amount * CamSpeedMultiplier) * (-1.0F))
pos.Z += ((horz_amount * CamSpeedMultiplier) * (CamLZ)) pos.Z += ((horz_amount * CamSpeedMultiplier) * (CamLZ))

View File

@@ -136,12 +136,13 @@ Namespace PreviewN
DoubleBuffered = True DoubleBuffered = True
'glControl1 'glControl1
Me.glControl1 = New GLControl Me.glControl1 = New GLControl With {
Me.glControl1.BackColor = Color.Black .BackColor = Color.Black,
Me.glControl1.Location = New Point(0, 0) .Location = New Point(0, 0),
Me.glControl1.MinimumSize = New Size(600, 120) .MinimumSize = New Size(600, 120),
Me.glControl1.Name = "glControl1" .Name = "glControl1",
Me.glControl1.Anchor = AnchorStyles.Left Or AnchorStyles.Top Or AnchorStyles.Right Or AnchorStyles.Bottom .Anchor = AnchorStyles.Left Or AnchorStyles.Top Or AnchorStyles.Right Or AnchorStyles.Bottom
}
Me.glControl1.Location = New Point(0, 0) Me.glControl1.Location = New Point(0, 0)
Me.glControl1.Size = Me.ClientSize Me.glControl1.Size = Me.ClientSize
Me.glControl1.TabIndex = 0 Me.glControl1.TabIndex = 0
@@ -268,7 +269,7 @@ Namespace PreviewN
Private Sub glControl1_Wheel(sender As Object, e As MouseEventArgs) Private Sub glControl1_Wheel(sender As Object, e As MouseEventArgs)
MyCamera.ResetMouseStuff() MyCamera.ResetMouseStuff()
MyCamera.UpdateCameraMatrixWithScrollWheel(CInt(Math.Truncate(e.Delta * (If(IsShiftPressed, 3.5F, 1.5F)))), camMtx) MyCamera.UpdateCameraMatrixWithScrollWheel(Math.Truncate(e.Delta * (If(IsShiftPressed, 3.5F, 1.5F))), camMtx)
savedCamPos = MyCamera.Position savedCamPos = MyCamera.Position
glControl1.Invalidate() glControl1.Invalidate()
End Sub End Sub

View File

@@ -1,9 +1,9 @@
Imports System.Drawing.Imaging Imports System.Drawing
Imports System.Drawing.Imaging
Imports OpenTK.Graphics.OpenGL Imports OpenTK.Graphics.OpenGL
Imports Bitmap = System.Drawing.Bitmap Imports Bitmap = System.Drawing.Bitmap
Imports System.Drawing
Namespace RenderingN Namespace RenderingN

View File

@@ -3,12 +3,12 @@
Public Module HelpfulDrawingFunctions Public Module HelpfulDrawingFunctions
Public Function IsPointInRectangle(p As PointF, rect As RectangleF) As Boolean Public Function IsPointInRectangle(p As PointF, rect As RectangleF) As Boolean
Dim bList As New List(Of Boolean) Dim bList As New List(Of Boolean) From {
p.X > rect.Left,
bList.Add(p.X > rect.Left) p.X < rect.Right,
bList.Add(p.X < rect.Right) p.Y > rect.Top,
bList.Add(p.Y > rect.Top) p.Y < rect.Bottom
bList.Add(p.Y < rect.Bottom) }
Return Not bList.Contains(False) Return Not bList.Contains(False)
End Function End Function

View File

@@ -6,7 +6,7 @@ namespace Pilz.IO;
public class EmbeddedFilesContainer public class EmbeddedFilesContainer
{ {
[JsonProperty("CompressedFiles")] [JsonProperty("CompressedFiles")]
private readonly Dictionary<string, byte[]> compressedFiles = new Dictionary<string, byte[]>(); private readonly Dictionary<string, byte[]> compressedFiles = [];
/// <summary> /// <summary>
/// Returns the names of all embedded files. /// Returns the names of all embedded files.

View File

@@ -7,7 +7,7 @@ public class ManagedPipeServer : ManagedPipe
{ {
// Pro Verbindung (Anfrage) wird ein Client-Objekt generiert, das den Datenaustausch dieser Verbindung abwickelt // Pro Verbindung (Anfrage) wird ein Client-Objekt generiert, das den Datenaustausch dieser Verbindung abwickelt
public List<ManagedPipeClient> Clients { get; private set; } = new List<ManagedPipeClient>(); public List<ManagedPipeClient> Clients { get; private set; } = [];
private readonly string pipeName = ""; private readonly string pipeName = "";
private readonly int maxNumbersOfServerInstances; private readonly int maxNumbersOfServerInstances;

View File

@@ -1,6 +1,4 @@
using Pilz.Net.CloudProviders.Nextcloud; using Pilz.Net.CloudProviders.Nextcloud.Client.Apps.FileRetention.Model;
using Pilz.Net.CloudProviders.Nextcloud.Client;
using Pilz.Net.CloudProviders.Nextcloud.Client.Apps.FileRetention.Model;
namespace Pilz.Net.CloudProviders.Nextcloud.Client.Apps.FileRetention; namespace Pilz.Net.CloudProviders.Nextcloud.Client.Apps.FileRetention;

View File

@@ -1,5 +1,4 @@
using Pilz.Net.CloudProviders.Nextcloud; using Pilz.Net.CloudProviders.Nextcloud.Client.Apps.FileRetention.Ocs;
using Pilz.Net.CloudProviders.Nextcloud.Client.Apps.FileRetention.Ocs;
using Pilz.Net.CloudProviders.Nextcloud.OCS; using Pilz.Net.CloudProviders.Nextcloud.OCS;
namespace Pilz.Net.CloudProviders.Nextcloud.Client.Apps.FileRetention; namespace Pilz.Net.CloudProviders.Nextcloud.Client.Apps.FileRetention;

View File

@@ -65,7 +65,7 @@ public class Column
public int? TextMaxLength { get; set; } public int? TextMaxLength { get; set; }
[JsonProperty("selectionOptions")] [JsonProperty("selectionOptions")]
public List<ColumnSelectionOption> SelectionOptions { get; } = new(); public List<ColumnSelectionOption> SelectionOptions { get; } = [];
[JsonProperty("selectionDefault")] [JsonProperty("selectionDefault")]
public int? SelectionDefault { get; set; } public int? SelectionDefault { get; set; }

View File

@@ -23,5 +23,5 @@ public class Row
public DateTime LastEditAt { get; set; } public DateTime LastEditAt { get; set; }
[JsonProperty("data")] [JsonProperty("data")]
public List<RowData> Data { get; set; } = new(); public List<RowData> Data { get; set; } = [];
} }

View File

@@ -5,5 +5,5 @@ namespace Pilz.Net.CloudProviders.Nextcloud.Client.Apps.Tables.Model;
public class RowUpdate public class RowUpdate
{ {
[JsonProperty("data")] [JsonProperty("data")]
public Dictionary<long, object?> Data { get; set; } = new(); public Dictionary<long, object?> Data { get; set; } = [];
} }

View File

@@ -1,5 +1,4 @@
using Pilz.Net.CloudProviders.Nextcloud; using Pilz.Net.CloudProviders.Nextcloud.Client.Apps.Tables.Model;
using Pilz.Net.CloudProviders.Nextcloud.Client.Apps.Tables.Model;
using Pilz.Net.CloudProviders.Nextcloud.OCS; using Pilz.Net.CloudProviders.Nextcloud.OCS;
namespace Pilz.Net.CloudProviders.Nextcloud.Client.Apps.Tables; namespace Pilz.Net.CloudProviders.Nextcloud.Client.Apps.Tables;

View File

@@ -1,6 +1,4 @@
using Pilz.Net.CloudProviders.Nextcloud; using Pilz.Net.CloudProviders.Nextcloud.Client.Apps.Tables.Model;
using Pilz.Net.CloudProviders.Nextcloud.Client;
using Pilz.Net.CloudProviders.Nextcloud.Client.Apps.Tables.Model;
namespace Pilz.Net.CloudProviders.Nextcloud.Client.Apps.Tables; namespace Pilz.Net.CloudProviders.Nextcloud.Client.Apps.Tables;

View File

@@ -1,5 +1,4 @@
using Pilz.Net.CloudProviders.Nextcloud.Client; using Pilz.Net.CloudProviders.Nextcloud.Client.Cloud.Model;
using Pilz.Net.CloudProviders.Nextcloud.Client.Cloud.Model;
namespace Pilz.Net.CloudProviders.Nextcloud.Client.Cloud; namespace Pilz.Net.CloudProviders.Nextcloud.Client.Cloud;

View File

@@ -1,5 +1,4 @@
using Pilz.Net.CloudProviders.Nextcloud; using Pilz.Net.CloudProviders.Nextcloud.Client.Cloud.Ocs;
using Pilz.Net.CloudProviders.Nextcloud.Client.Cloud.Ocs;
namespace Pilz.Net.CloudProviders.Nextcloud.Client.Cloud.Model; namespace Pilz.Net.CloudProviders.Nextcloud.Client.Cloud.Model;

View File

@@ -1,5 +1,4 @@
using Pilz.Net.CloudProviders.Nextcloud; using Pilz.Net.CloudProviders.Nextcloud.Client.Cloud.Ocs;
using Pilz.Net.CloudProviders.Nextcloud.Client.Cloud.Ocs;
using Pilz.Net.CloudProviders.Nextcloud.OCS; using Pilz.Net.CloudProviders.Nextcloud.OCS;
namespace Pilz.Net.CloudProviders.Nextcloud.Client.Cloud; namespace Pilz.Net.CloudProviders.Nextcloud.Client.Cloud;

View File

@@ -24,7 +24,7 @@ namespace Pilz.Net.CloudProviders.Nextcloud;
public class NextcloudClient : IDisposable public class NextcloudClient : IDisposable
{ {
private readonly List<ClientBase> clients = new(); private readonly List<ClientBase> clients = [];
private NextcloudLogin? currentLogin; private NextcloudLogin? currentLogin;
public OcsApi Ocs { get; init; } = new(); public OcsApi Ocs { get; init; } = new();

View File

@@ -13,7 +13,7 @@ public class OcsApi : IDisposable
public event GetOcsApiAuthCredentailsEventHandler? GetOcsApiAuthCredentails; public event GetOcsApiAuthCredentailsEventHandler? GetOcsApiAuthCredentails;
private readonly HttpClient client = new(); private readonly HttpClient client = new();
private readonly List<OcsApiBase> apis = new(); private readonly List<OcsApiBase> apis = [];
public string BaseUrl { get; set; } = string.Empty; public string BaseUrl { get; set; } = string.Empty;

View File

@@ -1,6 +1,4 @@
using Pilz.Extensions.Collections; using Pilz.Extensions.Collections;
using System.Collections.Specialized;
using System.Web;
namespace Pilz.Net.Api; namespace Pilz.Net.Api;

View File

@@ -1,5 +1,4 @@
using Pilz.Data; using Pilz.Data;
using Pilz.Net.Api.Messages;
namespace Pilz.Net.Api.Client; namespace Pilz.Net.Api.Client;

View File

@@ -1,7 +1,6 @@
using Pilz.Extensions.Reflection; using Pilz.Extensions.Reflection;
using Pilz.Net.Api.Messages; using Pilz.Net.Api.Messages;
using System.Diagnostics; using System.Diagnostics;
using System.Net;
namespace Pilz.Net.Api.Server; namespace Pilz.Net.Api.Server;

View File

@@ -122,13 +122,15 @@ public abstract class ConnectionManagerBase(int port)
finalBuffer.Add((byte)(value >> 16 & 0xFF)); finalBuffer.Add((byte)(value >> 16 & 0xFF));
finalBuffer.Add((byte)(value >> 8 & 0xFF)); finalBuffer.Add((byte)(value >> 8 & 0xFF));
finalBuffer.Add((byte)(value & 0xFF)); finalBuffer.Add((byte)(value & 0xFF));
}; }
;
void addHeader(int packageID, int packagesCount) void addHeader(int packageID, int packagesCount)
{ {
addInteger(dataID); // Data ID addInteger(dataID); // Data ID
addInteger(packageID); // Package ID addInteger(packageID); // Package ID
addInteger(packagesCount); // Packages Count addInteger(packagesCount); // Packages Count
}; }
;
// Send data (this if statement and else content might be useless) // Send data (this if statement and else content might be useless)
if (data.Length > maxDataSize) if (data.Length > maxDataSize)

View File

@@ -5,7 +5,7 @@ namespace Pilz.Net;
public class TCPManager(int port) : ConnectionManagerBase(port) public class TCPManager(int port) : ConnectionManagerBase(port)
{ {
private readonly TcpListener listener = new TcpListener(IPAddress.Any, port); private readonly TcpListener listener = new(IPAddress.Any, port);
public int BufferSize { get; set; } = 10240; public int BufferSize { get; set; } = 10240;
public override void Start() public override void Start()

View File

@@ -1,5 +1,5 @@
using Pilz.UI.Telerik.Dialogs; using Pilz.UI;
using Pilz.UI.WinForms; using Pilz.UI.Telerik.Dialogs;
namespace Pilz.Plugins.Advanced.UI.WinForms.Telerik; namespace Pilz.Plugins.Advanced.UI.WinForms.Telerik;

View File

@@ -2,7 +2,7 @@
public abstract class ControlListenerFeature : PluginFeature public abstract class ControlListenerFeature : PluginFeature
{ {
public string? ControlName { get; set; } public string? ControlName { get; set; }
public bool ControlNameRegEx { get; set; } public bool ControlNameRegEx { get; set; }

View File

@@ -1,4 +1,4 @@
using Pilz.UI.WinForms; using Pilz.UI;
using Pilz.UI.WinForms.Dialogs; using Pilz.UI.WinForms.Dialogs;
namespace Pilz.Plugins.Advanced.UI.WinForms; namespace Pilz.Plugins.Advanced.UI.WinForms;

View File

@@ -1,6 +1,4 @@
using System.Reflection.Metadata; namespace Pilz.Plugins.Advanced;
namespace Pilz.Plugins.Advanced;
public abstract class PluginFeature public abstract class PluginFeature
{ {

View File

@@ -1,5 +1,4 @@
using Microsoft.VisualBasic; using System.Reflection;
using System.Reflection;
namespace Pilz.Plugins.Advanced; namespace Pilz.Plugins.Advanced;

View File

@@ -118,12 +118,12 @@ Namespace Aspose3DModule
'Create Vertices 'Create Vertices
For Each vert As Vector4 In curMesh.ControlPoints For Each vert As Vector4 In curMesh.ControlPoints
'Create new Vertex 'Create new Vertex
Dim newVert As New Vertex
'Set Vertex Data 'Set Vertex Data
newVert.X = vert.x Dim newVert As New Vertex With {
newVert.Y = vert.y .X = vert.x,
newVert.Z = vert.z .Y = vert.y,
.Z = vert.z
}
'Add new Vertex 'Add new Vertex
newMesh.Vertices.Add(newVert) newMesh.Vertices.Add(newVert)
@@ -134,12 +134,12 @@ Namespace Aspose3DModule
If veNormals IsNot Nothing Then If veNormals IsNot Nothing Then
For Each n As Vector4 In veNormals.Data For Each n As Vector4 In veNormals.Data
'Create new Normal 'Create new Normal
Dim newNormal As New Normal
'Set Normal Data 'Set Normal Data
newNormal.X = n.x Dim newNormal As New Normal With {
newNormal.Y = n.y .X = n.x,
newNormal.Z = n.z .Y = n.y,
.Z = n.z
}
'Add new Normal 'Add new Normal
newMesh.Normals.Add(newNormal) newMesh.Normals.Add(newNormal)
@@ -151,11 +151,11 @@ Namespace Aspose3DModule
If veUVs IsNot Nothing Then If veUVs IsNot Nothing Then
For Each uv As Vector4 In veUVs.Data For Each uv As Vector4 In veUVs.Data
'Create new UV 'Create new UV
Dim newUV As New UV
'Set UV Data 'Set UV Data
newUV.U = uv.x Dim newUV As New UV With {
newUV.V = uv.y .U = uv.x,
.V = uv.y
}
'Add new UV 'Add new UV
newMesh.UVs.Add(newUV) newMesh.UVs.Add(newUV)
@@ -167,13 +167,13 @@ Namespace Aspose3DModule
If veVertexColor IsNot Nothing Then If veVertexColor IsNot Nothing Then
For Each n As Vector4 In veVertexColor.Data For Each n As Vector4 In veVertexColor.Data
'Create new Normal 'Create new Normal
Dim newVC As New VertexColor
'Set Normal Data 'Set Normal Data
newVC.R = n.x Dim newVC As New VertexColor With {
newVC.G = n.y .R = n.x,
newVC.B = n.z .G = n.y,
newVC.A = n.w .B = n.z,
.A = n.w
}
'Add new Normal 'Add new Normal
newMesh.VertexColors.Add(newVC) newMesh.VertexColors.Add(newVC)
@@ -203,10 +203,10 @@ Namespace Aspose3DModule
For Each index As Integer In poly For Each index As Integer In poly
'Create new Point 'Create new Point
Dim p As New Point
'Set Vertex 'Set Vertex
p.Vertex = newMesh.Vertices(index) Dim p As New Point With {
.Vertex = newMesh.Vertices(index)
}
'Set Normal 'Set Normal
If veNormals IsNot Nothing Then If veNormals IsNot Nothing Then

View File

@@ -68,7 +68,7 @@ Namespace AssimpModule
Dim dicUVs = pc.DicUVs Dim dicUVs = pc.DicUVs
Dim dicVertexColors = pc.DicVertexColors Dim dicVertexColors = pc.DicVertexColors
trafo = trafo * node.Transform trafo *= node.Transform
If node.HasMeshes Then If node.HasMeshes Then
For Each meshIndex In node.MeshIndices For Each meshIndex In node.MeshIndices
@@ -126,10 +126,10 @@ Namespace AssimpModule
For Each uvList As List(Of Vector3D) In m.TextureCoordinateChannels For Each uvList As List(Of Vector3D) In m.TextureCoordinateChannels
For Each uv As Vector3D In uvList For Each uv As Vector3D In uvList
If Not dicUVs.ContainsKey(uv) Then If Not dicUVs.ContainsKey(uv) Then
Dim newUV As New UV Dim newUV As New UV With {
.U = uv.X,
newUV.U = uv.X .V = uv.Y
newUV.V = uv.Y }
newMesh.UVs.Add(newUV) newMesh.UVs.Add(newUV)
dicUVs.Add(uv, newUV) dicUVs.Add(uv, newUV)
@@ -140,12 +140,12 @@ Namespace AssimpModule
For Each vcList As List(Of Color4D) In m.VertexColorChannels For Each vcList As List(Of Color4D) In m.VertexColorChannels
For Each vc As Color4D In vcList For Each vc As Color4D In vcList
If Not dicVertexColors.ContainsKey(vc) Then If Not dicVertexColors.ContainsKey(vc) Then
Dim newVC As New VertexColor Dim newVC As New VertexColor With {
.R = vc.R,
newVC.R = vc.R .G = vc.G,
newVC.G = vc.G .B = vc.B,
newVC.B = vc.B .A = vc.A
newVC.A = vc.A }
newMesh.VertexColors.Add(newVC) newMesh.VertexColors.Add(newVC)
dicVertexColors.Add(vc, newVC) dicVertexColors.Add(vc, newVC)
@@ -298,15 +298,16 @@ Namespace AssimpModule
End If End If
For Each kvp As KeyValuePair(Of String, Material) In obj.Materials For Each kvp As KeyValuePair(Of String, Material) In obj.Materials
Dim mat As New Assimp.Material Dim mat As New Assimp.Material With {
.Name = If(kvp.Key <> "", kvp.Key, "_" & mdl.Materials.Count)
mat.Name = If(kvp.Key <> "", kvp.Key, "_" & mdl.Materials.Count) }
mat.Opacity = mat.Opacity mat.Opacity = mat.Opacity
Dim texslot As New TextureSlot Dim texslot As New TextureSlot With {
texslot.TextureIndex = mdl.Textures.Count .TextureIndex = mdl.Textures.Count,
texslot.TextureType = TextureType.Diffuse .TextureType = TextureType.Diffuse,
texslot.UVIndex = 0 .UVIndex = 0
}
Dim ms As New MemoryStream Dim ms As New MemoryStream
kvp.Value.Image.Save(ms, Imaging.ImageFormat.Png) kvp.Value.Image.Save(ms, Imaging.ImageFormat.Png)
@@ -342,8 +343,9 @@ Namespace AssimpModule
If dicTexMesh.ContainsKey(f.Material) Then If dicTexMesh.ContainsKey(f.Material) Then
m = dicTexMesh(f.Material) m = dicTexMesh(f.Material)
Else Else
m = New Assimp.Mesh("Mesh_" & mdl.MeshCount + 1) m = New Assimp.Mesh("Mesh_" & mdl.MeshCount + 1) With {
m.PrimitiveType = PrimitiveType.Triangle .PrimitiveType = PrimitiveType.Triangle
}
If dicMatIndex.ContainsKey(f.Material) Then If dicMatIndex.ContainsKey(f.Material) Then
m.MaterialIndex = dicMatIndex(f.Material) m.MaterialIndex = dicMatIndex(f.Material)
End If End If
@@ -359,20 +361,22 @@ Namespace AssimpModule
newFace.Indices.Add(dicCounter(m)) newFace.Indices.Add(dicCounter(m))
If p.Vertex IsNot Nothing Then If p.Vertex IsNot Nothing Then
Dim vert As New Vector3D Dim vert As New Vector3D With {
vert.X = p.Vertex.X .X = p.Vertex.X,
vert.Y = p.Vertex.Y .Y = p.Vertex.Y,
vert.Z = p.Vertex.Z .Z = p.Vertex.Z
}
m.Vertices.Add(vert) m.Vertices.Add(vert)
Else Else
m.Vertices.Add(New Vector3D(0, 0, 0)) m.Vertices.Add(New Vector3D(0, 0, 0))
End If End If
If p.Normal IsNot Nothing Then If p.Normal IsNot Nothing Then
Dim norm As New Vector3D Dim norm As New Vector3D With {
norm.X = p.Normal.X .X = p.Normal.X,
norm.Y = p.Normal.Y .Y = p.Normal.Y,
norm.Z = p.Normal.Z .Z = p.Normal.Z
}
m.Normals.Add(norm) m.Normals.Add(norm)
Else Else
m.Normals.Add(New Vector3D(0, 0, 0)) m.Normals.Add(New Vector3D(0, 0, 0))

View File

@@ -68,11 +68,11 @@ Public Class File3DLoaderModule
End Property End Property
Private Shared Function GetLoaderModules() As File3DLoaderModule() Private Shared Function GetLoaderModules() As File3DLoaderModule()
Dim list As New List(Of File3DLoaderModule) Dim list As New List(Of File3DLoaderModule) From {
New File3DLoaderModule("Simple File Parser",
list.Add(New File3DLoaderModule("Simple File Parser",
AddressOf LoadViaSimpleFileParser, AddressOf LoadViaSimpleFileParser,
New Dictionary(Of String, String) From {{"obj", "OBJ"}})) New Dictionary(Of String, String) From {{"obj", "OBJ"}})
}
AssimpModule.AssimpLoader.LoadAssimpLibs() AssimpModule.AssimpLoader.LoadAssimpLibs()
Dim exts As New Dictionary(Of String, String) Dim exts As New Dictionary(Of String, String)
@@ -111,11 +111,11 @@ Public Class File3DLoaderModule
End Function End Function
Private Shared Function GetExporterModules() As File3DLoaderModule() Private Shared Function GetExporterModules() As File3DLoaderModule()
Dim list As New List(Of File3DLoaderModule) Dim list As New List(Of File3DLoaderModule) From {
New File3DLoaderModule("Simple File Parser",
list.Add(New File3DLoaderModule("Simple File Parser",
AddressOf ExportViaSimpleFileParser, AddressOf ExportViaSimpleFileParser,
New Dictionary(Of String, String) From {{"obj", "OBJ"}})) New Dictionary(Of String, String) From {{"obj", "OBJ"}})
}
AssimpModule.AssimpLoader.LoadAssimpLibs() AssimpModule.AssimpLoader.LoadAssimpLibs()
Dim exts As New Dictionary(Of String, String) Dim exts As New Dictionary(Of String, String)

View File

@@ -0,0 +1,34 @@
using Gtk;
namespace Pilz.UI.Gtk.Dialogs;
public class GtkContent : Box
{
public GtkDialogBase Dialog { get; internal set; } = null!;
public ResponseType Result { get; set; } = ResponseType.Cancel;
public bool RegisterDialogAccept { get; set; } = true;
public bool RegisterDialogCancel { get; set; } = true;
protected void Close(ResponseType result)
{
Result = result;
Dialog.Destroy();
}
protected virtual bool ValidateOK()
{
return true;
}
protected virtual void Button_Confirm_Clicked(object? sender, EventArgs e)
{
if (ValidateOK())
Close(ResponseType.Ok);
}
protected virtual void Button_Cancel_Clicked(object? sender, EventArgs e)
{
Close(ResponseType.Cancel);
}
}

View File

@@ -0,0 +1,33 @@
using Gtk;
namespace Pilz.UI.Gtk.Dialogs;
public partial class GtkDialogBase
{
private static GtkDialogBase CreateDialog<TContent>(TContent content, string title) where TContent : Widget
{
var dialog = new GtkDialogBase
{
Title = title,
};
dialog.ContentArea.Add(content);
content.Show();
return dialog;
}
public static TContent Show<TContent>(TContent content, string title) where TContent : Widget
{
var dialog = CreateDialog(content, title);
dialog.Show();
dialog.Destroy();
return content;
}
public static TContent ShowDialog<TContent>(TContent content, string title) where TContent : Widget
{
var dialog = CreateDialog(content, title);
dialog.Run();
dialog.Destroy();
return content;
}
}

View File

@@ -0,0 +1,20 @@
using Gtk;
namespace Pilz.UI.Gtk.Dialogs;
public partial class GtkDialogBase : Dialog
{
public GtkDialogBase() : this(new Builder("GtkDialogBase.glade")) { }
private GtkDialogBase(Builder builder) : base(builder.GetRawOwnedObject("GtkDialogBase"))
{
builder.Autoconnect(this);
DefaultResponse = ResponseType.Cancel;
Response += Dialog_Response;
}
protected virtual void Dialog_Response(object o, ResponseArgs args)
{
Hide();
}
}

View File

@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.40.0 -->
<interface>
<requires lib="gtk+" version="3.18"/>
<object class="GtkDialog" id="GtkDialogBase">
<property name="can-focus">False</property>
<property name="window-position">center-on-parent</property>
<property name="type-hint">dialog</property>
<child internal-child="vbox">
<object class="GtkBox">
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child internal-child="action_area">
<object class="GtkButtonBox">
<property name="can-focus">False</property>
<property name="layout-style">end</property>
<child>
<object class="GtkButton" id="buttonOkay">
<property name="label">gtk-apply</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="use-stock">True</property>
<property name="always-show-image">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="buttonCancel">
<property name="label">gtk-cancel</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="use-stock">True</property>
<property name="always-show-image">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
<action-widgets>
<action-widget response="-5">buttonOkay</action-widget>
<action-widget response="-6">buttonCancel</action-widget>
</action-widgets>
</object>
</interface>

View File

@@ -11,6 +11,14 @@
<Version>1.0.0</Version> <Version>1.0.0</Version>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<None Remove="**\*.glade" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="**\*.glade" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="GtkSharp" Version="3.24.24.95" /> <PackageReference Include="GtkSharp" Version="3.24.24.95" />
</ItemGroup> </ItemGroup>

View File

@@ -1,5 +1,5 @@
using Pilz.SymbolPacks.Sets; using Pilz.SymbolPacks.Sets;
using Pilz.UI.Telerik.Symbols.Factories; using Pilz.UI.WinForms.Telerik.Symbols.Factories;
namespace Pilz.UI.WinForms.Telerik.Symbols; namespace Pilz.UI.WinForms.Telerik.Symbols;

View File

@@ -1,5 +1,4 @@
using System.Collections; using System.Collections;
using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Drawing.Design; using System.Drawing.Design;
using System.Globalization; using System.Globalization;

View File

@@ -1,5 +1,4 @@
using System.ComponentModel; using System.ComponentModel;
using Telerik.WinControls.Data;
//using System.Linq; //using System.Linq;
namespace Pilz.UI.WinForms.Telerik.Controls.RadValidationProvider; namespace Pilz.UI.WinForms.Telerik.Controls.RadValidationProvider;

View File

@@ -1,4 +1,4 @@
using Pilz.UI.WinForms; using Pilz.UI.WinForms.Telerik.Dialogs;
using Telerik.WinControls.UI; using Telerik.WinControls.UI;
namespace Pilz.UI.Telerik.Dialogs; namespace Pilz.UI.Telerik.Dialogs;
@@ -30,6 +30,6 @@ public partial class RadDialogBase : RadForm
private void DialogBaseForm_FormClosed(object? sender, FormClosedEventArgs e) private void DialogBaseForm_FormClosed(object? sender, FormClosedEventArgs e)
{ {
DialogClosed?.Invoke(new DialogClosedEventArgs(this)); DialogClosed?.Invoke(new WinForms.Telerik.Dialogs.DialogClosedEventArgs(this));
} }
} }

View File

@@ -1,5 +1,4 @@
using Pilz.UI.WinForms; using Pilz.UI.WinForms.Telerik.Dialogs;
using Pilz.UI.WinForms.Telerik.Dialogs;
using Telerik.WinControls; using Telerik.WinControls;
using Telerik.WinControls.UI; using Telerik.WinControls.UI;
using Telerik.WinControls.UI.SplashScreen; using Telerik.WinControls.UI.SplashScreen;
@@ -9,7 +8,7 @@ namespace Pilz.UI.Telerik.Dialogs;
partial class RadFlyoutBase partial class RadFlyoutBase
{ {
public delegate void FlyoutCreatedEventHandler(FlyoutCreatedEventArgs e); public delegate void FlyoutCreatedEventHandler(FlyoutCreatedEventArgs e);
public delegate void FlyoutClosedEventHandler(FlyoutClosedEventArgs e); public delegate void FlyoutClosedEventHandler(global::Telerik.WinControls.UI.SplashScreen.FlyoutClosedEventArgs e);
public static event FlyoutCreatedEventHandler FlyoutCreated public static event FlyoutCreatedEventHandler FlyoutCreated
{ {
@@ -72,7 +71,7 @@ partial class RadFlyoutBase
{ {
if (e.Content is RadFlyoutBase dialogBase) if (e.Content is RadFlyoutBase dialogBase)
{ {
var eventArgs = new FlyoutClosedEventArgs((RadFlyoutBase)e.Content); var eventArgs = new global::Telerik.WinControls.UI.SplashScreen.FlyoutClosedEventArgs((RadFlyoutBase)e.Content);
foreach (var args in flyoutCloseHandlers.ToArray()) foreach (var args in flyoutCloseHandlers.ToArray())
{ {

View File

@@ -1,7 +1,6 @@
using Pilz.UI.WinForms.Telerik.Controls.RadValidationProvider; using Pilz.UI.WinForms.Telerik.Controls.RadValidationProvider;
using System.ComponentModel; using System.ComponentModel;
using Telerik.WinControls; using Telerik.WinControls;
using Telerik.WinControls.Data;
using Telerik.WinControls.UI; using Telerik.WinControls.UI;
namespace Pilz.UI.Telerik.Dialogs; namespace Pilz.UI.Telerik.Dialogs;

View File

@@ -1,5 +1,4 @@
using Pilz.UI.WinForms; using Pilz.UI.WinForms.Dialogs;
using Pilz.UI.WinForms.Dialogs;
namespace Pilz.UI.Dialogs; namespace Pilz.UI.Dialogs;

View File

@@ -1,6 +1,5 @@
using Pilz.UI.Dialogs; using Pilz.UI.Dialogs;
using System.ComponentModel; using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
namespace Pilz.UI.WinForms.Dialogs; namespace Pilz.UI.WinForms.Dialogs;

View File

@@ -1,5 +1,4 @@
using System.Drawing; using System.Drawing.Drawing2D;
using System.Drawing.Drawing2D;
namespace Pilz.UI.WinForms; namespace Pilz.UI.WinForms;
@@ -61,9 +60,11 @@ public class DisplayHelp
else else
{ {
using var brush = CreateLinearGradientBrush(r, color1, color2, gradientAngle); using var brush = CreateLinearGradientBrush(r, color1, color2, gradientAngle);
var blend = new Blend(factors.Length); var blend = new Blend(factors.Length)
blend.Factors = factors; {
blend.Positions = positions; Factors = factors,
Positions = positions
};
brush.Blend = blend; brush.Blend = blend;
g.FillRectangle(brush, r); g.FillRectangle(brush, r);
} }

View File

@@ -1,5 +1,4 @@
using Pilz.UI.WinForms.Dialogs; using Pilz.UI.WinForms.Dialogs;
using System.Diagnostics.CodeAnalysis;
namespace Pilz.UI.WinForms.Extensions; namespace Pilz.UI.WinForms.Extensions;

View File

@@ -1,5 +1,4 @@
using System.Diagnostics; using System.Diagnostics;
using System.Windows.Forms;
namespace Pilz.UI.WinForms; namespace Pilz.UI.WinForms;

View File

@@ -1,16 +1,11 @@
using System; namespace Pilz.UI.WinForms;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
namespace Pilz.UI.WinForms;
internal class HighlightPanel : Control internal class HighlightPanel : Control
{ {
private Dictionary<Control, eHighlightColor> _Highlights = null; private Dictionary<Control, eHighlightColor> _Highlights = null;
private List<HighlightRegion> _HighlightRegions = new List<HighlightRegion>(); private List<HighlightRegion> _HighlightRegions = [];
public HighlightPanel(Dictionary<Control, eHighlightColor> highlights) public HighlightPanel(Dictionary<Control, eHighlightColor> highlights)
{ {

View File

@@ -1,7 +1,4 @@
using System; using System.ComponentModel;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
// Nicht gemergte Änderung aus Projekt "Pilz.UI (net8.0-windows)" // Nicht gemergte Änderung aus Projekt "Pilz.UI (net8.0-windows)"
// Vor: // Vor:
// Imports System.Windows.Forms // Imports System.Windows.Forms
@@ -9,7 +6,6 @@ using System.Drawing;
// Nach: // Nach:
// Imports System.Drawing // Imports System.Drawing
// Imports System.Windows.Forms // Imports System.Windows.Forms
using System.Windows.Forms;
namespace Pilz.UI.WinForms; namespace Pilz.UI.WinForms;
@@ -17,8 +13,8 @@ namespace Pilz.UI.WinForms;
public class Highlighter : Component public class Highlighter : Component
{ {
private Dictionary<Control, eHighlightColor> _Highlights = new Dictionary<Control, eHighlightColor>(); private Dictionary<Control, eHighlightColor> _Highlights = [];
private Dictionary<Control, bool> _HighlightOnFocus = new Dictionary<Control, bool>(); private Dictionary<Control, bool> _HighlightOnFocus = [];
protected override void Dispose(bool disposing) protected override void Dispose(bool disposing)
{ {
@@ -143,8 +139,8 @@ public class Highlighter : Component
} }
} }
private Dictionary<TabControl, int> _TabControl2 = new Dictionary<TabControl, int>(); private Dictionary<TabControl, int> _TabControl2 = [];
private Dictionary<Panel, int> _ParentPanel = new Dictionary<Panel, int>(); private Dictionary<Panel, int> _ParentPanel = [];
private void AddHighlight(Dictionary<Control, eHighlightColor> highlights, Control c, eHighlightColor highlightColor) private void AddHighlight(Dictionary<Control, eHighlightColor> highlights, Control c, eHighlightColor highlightColor)
{ {
@@ -386,15 +382,14 @@ public class Highlighter : Component
if (_ContainerControl is not null) if (_ContainerControl is not null)
{ {
if (_HighlightPanel is null) _HighlightPanel ??= new HighlightPanel(_Highlights)
{ {
_HighlightPanel = new HighlightPanel(_Highlights); FocusHighlightColor = _FocusHighlightColor,
_HighlightPanel.FocusHighlightColor = _FocusHighlightColor; Margin = new Padding(0),
_HighlightPanel.Margin = new Padding(0); Padding = new Padding(0),
_HighlightPanel.Padding = new Padding(0); CustomHighlightColors = _CustomHighlightColors,
_HighlightPanel.CustomHighlightColors = _CustomHighlightColors; Visible = false
_HighlightPanel.Visible = false; };
}
_ContainerControl.SizeChanged += ContainerControlSizeChanged; _ContainerControl.SizeChanged += ContainerControlSizeChanged;
_ContainerControl.HandleCreated += ContainerControlHandleCreated; _ContainerControl.HandleCreated += ContainerControlHandleCreated;
@@ -452,8 +447,10 @@ public class Highlighter : Component
if (_DelayTimer is null) if (_DelayTimer is null)
{ {
_DelayTimer = new(); _DelayTimer = new()
_DelayTimer.Interval = 100; {
Interval = 100
};
_DelayTimer.Tick += new EventHandler(DelayTimerTick); _DelayTimer.Tick += new EventHandler(DelayTimerTick);
_DelayTimer.Start(); _DelayTimer.Start();
} }

View File

@@ -1,5 +1,4 @@
using System.Drawing; using System.Drawing.Drawing2D;
using System.Drawing.Drawing2D;
namespace Pilz.UI.WinForms.PaintingControl; namespace Pilz.UI.WinForms.PaintingControl;

View File

@@ -1,9 +1,5 @@
using Pilz.Drawing; using Pilz.Drawing;
using Pilz.UI.WinForms.PaintingControl.EventArgs;
using System;
using System.Drawing;
using System.Drawing.Drawing2D; using System.Drawing.Drawing2D;
using System.Windows.Forms;
namespace Pilz.UI.WinForms.PaintingControl; namespace Pilz.UI.WinForms.PaintingControl;
@@ -35,7 +31,7 @@ public class DefaultDrawMethodes
e.Graphics.DrawString(obj.Text, new Font(obj.TextFont.FontFamily, obj.TextFont.Size * zoomFactor, obj.TextFont.Style), b, rect, f); e.Graphics.DrawString(obj.Text, new Font(obj.TextFont.FontFamily, obj.TextFont.Size * zoomFactor, obj.TextFont.Style), b, rect, f);
} }
private static object _DrawPicture_newSyncObj = new object(); private static object _DrawPicture_newSyncObj = new();
public static void DrawPicture(PaintingObjectPaintEventArgs e) public static void DrawPicture(PaintingObjectPaintEventArgs e)
{ {
@@ -276,9 +272,11 @@ public class DefaultDrawMethodes
public static void DrawAreaSelection(PaintEventArgs e, PaintingControl pc, PointF startMousePos, PointF lastMousePos) public static void DrawAreaSelection(PaintEventArgs e, PaintingControl pc, PointF startMousePos, PointF lastMousePos)
{ {
var rectToDraw = HelpfulDrawingFunctions.GetRectangle(startMousePos, lastMousePos); var rectToDraw = HelpfulDrawingFunctions.GetRectangle(startMousePos, lastMousePos);
var p = new Pen(pc.AreaSelectionColor); var p = new Pen(pc.AreaSelectionColor)
p.DashStyle = startMousePos.X >= lastMousePos.X ? DashStyle.DashDot : DashStyle.Solid; {
p.Width = 3f; DashStyle = startMousePos.X >= lastMousePos.X ? DashStyle.DashDot : DashStyle.Solid,
Width = 3f
};
e.Graphics.DrawRectangle(p, rectToDraw.X, rectToDraw.Y, rectToDraw.Width, rectToDraw.Height); e.Graphics.DrawRectangle(p, rectToDraw.X, rectToDraw.Y, rectToDraw.Width, rectToDraw.Height);
} }

View File

@@ -1,6 +1,4 @@
using System; namespace Pilz.UI.WinForms.PaintingControl;
namespace Pilz.UI.WinForms.PaintingControl.EventArgs;
public class PaintingObjectEventArgs(PaintingObject[] paintingObjects) : EventArgs public class PaintingObjectEventArgs(PaintingObject[] paintingObjects) : EventArgs
{ {

View File

@@ -1,7 +1,4 @@
using System; namespace Pilz.UI.WinForms.PaintingControl;
using System.Drawing;
namespace Pilz.UI.WinForms.PaintingControl.EventArgs;
public class PaintingObjectPaintEventArgs(PaintingObject obj, Graphics g, PointF offset) : EventArgs public class PaintingObjectPaintEventArgs(PaintingObject obj, Graphics g, PointF offset) : EventArgs
{ {
@@ -45,7 +42,7 @@ public class PaintingObjectPaintEventArgs(PaintingObject obj, Graphics g, PointF
/// The rectangle of the PaintingObject on Screen. /// The rectangle of the PaintingObject on Screen.
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public RectangleF Rectangle => new RectangleF(X, Y, PaintingObject.Width, PaintingObject.Height); public RectangleF Rectangle => new(X, Y, PaintingObject.Width, PaintingObject.Height);
public PaintingObjectPaintEventArgs(PaintingObject obj, Graphics g) : this(obj, g, obj.Parent.Offset) public PaintingObjectPaintEventArgs(PaintingObject obj, Graphics g) : this(obj, g, obj.Parent.Offset)
{ {

View File

@@ -1,15 +1,9 @@
using Pilz.Drawing; using Pilz.Drawing;
using Pilz.UI.WinForms.PaintingControl.EventArgs;
using Pilz.UI.WinForms.Utilities; using Pilz.UI.WinForms.Utilities;
using System;
using System.Collections; using System.Collections;
using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Data; using System.Data;
using System.Drawing;
using System.Drawing.Drawing2D; using System.Drawing.Drawing2D;
using System.Linq;
using System.Windows.Forms;
namespace Pilz.UI.WinForms.PaintingControl; namespace Pilz.UI.WinForms.PaintingControl;
@@ -48,7 +42,7 @@ public class PaintingControl : UserControl, IPaintingObjectContainer
public Color GridColor { get; set; } = Color.LightGray; public Color GridColor { get; set; } = Color.LightGray;
public DelegateDrawPaintingControlGridMethode DrawGridMethode { get; set; } = DefaultDrawMethodes.DrawGrid; public DelegateDrawPaintingControlGridMethode DrawGridMethode { get; set; } = DefaultDrawMethodes.DrawGrid;
public DelegateDrawPaintingControlAreaSelectionMethode DrawAreaSelectionMethode { get; set; } = DefaultDrawMethodes.DrawAreaSelection; public DelegateDrawPaintingControlAreaSelectionMethode DrawAreaSelectionMethode { get; set; } = DefaultDrawMethodes.DrawAreaSelection;
private SizeF _ZoomFactor = new SizeF(1f, 1f); private SizeF _ZoomFactor = new(1f, 1f);
private int _stopDrawing = -1; private int _stopDrawing = -1;
private Image bufferedImg = null; private Image bufferedImg = null;
@@ -57,7 +51,7 @@ public class PaintingControl : UserControl, IPaintingObjectContainer
private bool pressedControl = false; private bool pressedControl = false;
private bool pressedAlt = false; private bool pressedAlt = false;
private Dictionary<PaintingObject, PointF> savedPos = new Dictionary<PaintingObject, PointF>(); private Dictionary<PaintingObject, PointF> savedPos = [];
public event SelectionChangedEventHandler SelectionChanged; public event SelectionChangedEventHandler SelectionChanged;
@@ -413,8 +407,7 @@ public class PaintingControl : UserControl, IPaintingObjectContainer
{ {
if (IsResizingObjs(objs)) if (IsResizingObjs(objs))
return; return;
if (movedObjs is null) movedObjs ??= [];
movedObjs = new List<PaintingObject>();
SuspendDrawing(); SuspendDrawing();
@@ -663,7 +656,8 @@ public class PaintingControl : UserControl, IPaintingObjectContainer
{ {
obj2.X -= modLeft; obj2.X -= modLeft;
} }
}; }
;
zoomLocation(obj); zoomLocation(obj);
@@ -674,7 +668,8 @@ public class PaintingControl : UserControl, IPaintingObjectContainer
var modW = (int)Math.Round(obj.Width % zoomedGridChunkSize.Width); var modW = (int)Math.Round(obj.Width % zoomedGridChunkSize.Width);
void zoomSize(PaintingObject obj2) { if (obj2.EnableResize && !obj2.HardcodedSize) { if (modH > halfHeight) obj2.Height += zoomedGridChunkSize.Height - modH; else { obj2.Height -= modH; } if (modW > halfWidth) obj2.Width += zoomedGridChunkSize.Width - modW; else { obj2.Width -= modW; } } }; void zoomSize(PaintingObject obj2) { if (obj2.EnableResize && !obj2.HardcodedSize) { if (modH > halfHeight) obj2.Height += zoomedGridChunkSize.Height - modH; else { obj2.Height -= modH; } if (modW > halfWidth) obj2.Width += zoomedGridChunkSize.Width - modW; else { obj2.Width -= modW; } } }
;
zoomSize(obj); zoomSize(obj);

View File

@@ -1,8 +1,4 @@
using Pilz.UI.WinForms.PaintingControl.EventArgs; namespace Pilz.UI.WinForms.PaintingControl;
using System.Drawing;
using System.Windows.Forms;
namespace Pilz.UI.WinForms.PaintingControl;
public delegate void DelegateDrawPaintingObjectMethode(PaintingObjectPaintEventArgs e); public delegate void DelegateDrawPaintingObjectMethode(PaintingObjectPaintEventArgs e);

View File

@@ -1,12 +1,7 @@
using Newtonsoft.Json; using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D; using System.Drawing.Drawing2D;
using System.Linq;
using System.Reflection; using System.Reflection;
using System.Windows.Forms;
namespace Pilz.UI.WinForms.PaintingControl; namespace Pilz.UI.WinForms.PaintingControl;
@@ -33,9 +28,9 @@ public class PaintingObject : ICloneable, IPaintingObjectContainer
public Font TextFont { get; set; } = new Font(FontFamily.GenericSansSerif, 8.25f); public Font TextFont { get; set; } = new Font(FontFamily.GenericSansSerif, 8.25f);
public Color TextColor { get; set; } = Color.Black; public Color TextColor { get; set; } = Color.Black;
[JsonProperty] [JsonProperty]
private PointF _Location = new PointF(50f, 50f); private PointF _Location = new(50f, 50f);
[JsonProperty] [JsonProperty]
private SizeF _Size = new SizeF(50f, 80f); private SizeF _Size = new(50f, 80f);
public bool EnableFill { get; set; } = true; public bool EnableFill { get; set; } = true;
public bool EnableOutline { get; set; } = true; public bool EnableOutline { get; set; } = true;
public Color SelectionColor { get; set; } = Color.CornflowerBlue; public Color SelectionColor { get; set; } = Color.CornflowerBlue;
@@ -50,9 +45,9 @@ public class PaintingObject : ICloneable, IPaintingObjectContainer
[JsonIgnore] [JsonIgnore]
public object Tag { get; set; } = null; public object Tag { get; set; } = null;
public string Name { get; set; } = ""; public string Name { get; set; } = "";
public List<PaintingObject> PinnedObjects { get; private set; } = new List<PaintingObject>(); public List<PaintingObject> PinnedObjects { get; private set; } = [];
[JsonIgnore] [JsonIgnore]
public List<DelegateDrawPaintingObjectMethode> DrawMethodes { get; private set; } = new List<DelegateDrawPaintingObjectMethode>(); public List<DelegateDrawPaintingObjectMethode> DrawMethodes { get; private set; } = [];
[JsonIgnore] [JsonIgnore]
public DelegateDrawPaintingObjectMethode DrawSelectionMethode { get; private set; } = DefaultDrawMethodes.DrawSelection; public DelegateDrawPaintingObjectMethode DrawSelectionMethode { get; private set; } = DefaultDrawMethodes.DrawSelection;
public Cursor Cursor { get; set; } = Cursors.Default; public Cursor Cursor { get; set; } = Cursors.Default;
@@ -165,32 +160,32 @@ public class PaintingObject : ICloneable, IPaintingObjectContainer
{ {
case "DrawPicture": case "DrawPicture":
{ {
tt = tt | PaintingObjectType.Picture; tt |= PaintingObjectType.Picture;
break; break;
} }
case "DrawText": case "DrawText":
{ {
tt = tt | PaintingObjectType.Text; tt |= PaintingObjectType.Text;
break; break;
} }
case "DrawRectangle": case "DrawRectangle":
{ {
tt = tt | PaintingObjectType.Rectangle; tt |= PaintingObjectType.Rectangle;
break; break;
} }
case "DrawEllipse": case "DrawEllipse":
{ {
tt = tt | PaintingObjectType.Elipse; tt |= PaintingObjectType.Elipse;
break; break;
} }
case "DrawTriangle": case "DrawTriangle":
{ {
tt = tt | PaintingObjectType.Triangle; tt |= PaintingObjectType.Triangle;
break; break;
} }
case "DrawLine": case "DrawLine":
{ {
tt = tt | PaintingObjectType.Line; tt |= PaintingObjectType.Line;
break; break;
} }
} }
@@ -699,7 +694,8 @@ public class PaintingObject : ICloneable, IPaintingObjectContainer
if (!blackFields.Contains(@field.Name)) if (!blackFields.Contains(@field.Name))
@field.SetValue(dest, @field.GetValue(source)); @field.SetValue(dest, @field.GetValue(source));
} }
}; }
;
copyFields(this, obj, blackField, metype); copyFields(this, obj, blackField, metype);
copyFields(ImageProperties, obj.ImageProperties, Array.Empty<string>(), ImageProperties.GetType()); copyFields(ImageProperties, obj.ImageProperties, Array.Empty<string>(), ImageProperties.GetType());

View File

@@ -1,7 +1,4 @@
using System; using System.Data;
using System.Collections.Generic;
using System.Data;
using System.Linq;
namespace Pilz.UI.WinForms.PaintingControl; namespace Pilz.UI.WinForms.PaintingControl;
@@ -10,7 +7,7 @@ public class PaintingObjectListLayering
public PaintingObjectList ObjectList { get; private set; } public PaintingObjectList ObjectList { get; private set; }
public Dictionary<int, Func<PaintingObject, bool>> Conditions { get; private set; } = new Dictionary<int, Func<PaintingObject, bool>>(); public Dictionary<int, Func<PaintingObject, bool>> Conditions { get; private set; } = [];
/// <summary> /// <summary>
/// Get the order function will checkout the conditions. /// Get the order function will checkout the conditions.

View File

@@ -1,8 +1,5 @@
using Pilz.Drawing; using Pilz.Drawing;
using System;
using System.Drawing;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Windows.Forms;
namespace Pilz.UI.WinForms.PaintingControl; namespace Pilz.UI.WinForms.PaintingControl;
@@ -95,7 +92,7 @@ internal class PaintingObjectResizing
private EdgeEnum mEdge = EdgeEnum.None; private EdgeEnum mEdge = EdgeEnum.None;
private int mWidth = 4; private int mWidth = 4;
private int qWidth = 4 * 4; private int qWidth = 4 * 4;
private Rectangle rect = new Rectangle(); private Rectangle rect = new();
public bool Enabled { get; set; } = true; public bool Enabled { get; set; } = true;
public SizeF MinimumSize { get; set; } = new SizeF(15f, 15f); public SizeF MinimumSize { get; set; } = new SizeF(15f, 15f);
@@ -239,11 +236,13 @@ internal class PaintingObjectResizing
RectangleF extRect = mObj.RectangleExtended; RectangleF extRect = mObj.RectangleExtended;
var oldRect = mObj.Rectangle; var oldRect = mObj.Rectangle;
var newRect = new RectangleF(); var newRect = new RectangleF
newRect.X = extRect.X - oldRect.X; {
newRect.Y = extRect.Y - oldRect.Y; X = extRect.X - oldRect.X,
newRect.Width = (extRect.Width - oldRect.Width) / 2f; Y = extRect.Y - oldRect.Y,
newRect.Height = (extRect.Height - oldRect.Height) / 2f; Width = (extRect.Width - oldRect.Width) / 2f,
Height = (extRect.Height - oldRect.Height) / 2f
};
var setToNone = false; var setToNone = false;
var isOnTop = ReferenceEquals(mObj.Parent.GetObject(new PointF(realX, realY), true), mObj); var isOnTop = ReferenceEquals(mObj.Parent.GetObject(new PointF(realX, realY), true), mObj);

View File

@@ -1,5 +1,4 @@
using Pilz.UI.Symbols; using Pilz.UI.Symbols;
using System.Reflection;
namespace Pilz.UI.WinForms.Symbols; namespace Pilz.UI.WinForms.Symbols;

View File

@@ -1,14 +1,11 @@
using System.Collections.Generic; namespace Pilz.UI.WinForms.Utilities;
using System.Windows.Forms;
namespace Pilz.UI.WinForms.Utilities;
public static class DrawingControl public static class DrawingControl
{ {
private const int WM_SETREDRAW = 11; private const int WM_SETREDRAW = 11;
private readonly static Dictionary<nint, int> dicSuspendCount = new Dictionary<nint, int>(); private readonly static Dictionary<nint, int> dicSuspendCount = [];
public static void SuspendDrawing(this Control control) public static void SuspendDrawing(this Control control)
{ {

View File

@@ -1,4 +1,4 @@
namespace Pilz.UI.WinForms; namespace Pilz.UI;
public interface ILoadContent public interface ILoadContent
{ {

View File

@@ -1,4 +1,4 @@
namespace Pilz.UI.WinForms; namespace Pilz.UI;
public interface ILoadContentAsync public interface ILoadContentAsync
{ {