diff --git a/Pilz.Collections/SimpleHistory/ObjectBase.cs b/Pilz.Collections/SimpleHistory/ObjectBase.cs index 67a7148..91090b1 100644 --- a/Pilz.Collections/SimpleHistory/ObjectBase.cs +++ b/Pilz.Collections/SimpleHistory/ObjectBase.cs @@ -5,6 +5,6 @@ public class ObjectBase public static int DefaultPriorityValue { get; set; } = 1000; public int UndoPriority { get; set; } = DefaultPriorityValue; - + public int RedoPriority { get; set; } = DefaultPriorityValue; } \ No newline at end of file diff --git a/Pilz.Configuration/ConfigurationManagerList.cs b/Pilz.Configuration/ConfigurationManagerList.cs index 6d935cd..d681f70 100644 --- a/Pilz.Configuration/ConfigurationManagerList.cs +++ b/Pilz.Configuration/ConfigurationManagerList.cs @@ -10,7 +10,7 @@ public class ConfigurationManagerList : IList public delegate void GettingParentManagerEventHandler(object sender, GetValueEventArgs e); - private readonly List myList = new List(); + private readonly List myList = []; private object GetParentManager() { diff --git a/Pilz.Configuration/SimpleConfiguration.cs b/Pilz.Configuration/SimpleConfiguration.cs index 3aad7fa..fa86e16 100644 --- a/Pilz.Configuration/SimpleConfiguration.cs +++ b/Pilz.Configuration/SimpleConfiguration.cs @@ -7,7 +7,7 @@ namespace Pilz.Configuration; public class SimpleConfiguration { [JsonIgnore] - public readonly ConfigurationManagerList Managers = new ConfigurationManagerList(); + public readonly ConfigurationManagerList Managers = []; public SimpleConfiguration() { diff --git a/Pilz.Cryptography/SecureString.cs b/Pilz.Cryptography/SecureString.cs index 88f4e8f..5ab0e86 100644 --- a/Pilz.Cryptography/SecureString.cs +++ b/Pilz.Cryptography/SecureString.cs @@ -44,8 +44,7 @@ public class SecureString { if (Crypter == null) { - if (DefaultCrypter == null) - DefaultCrypter = new SimpleStringCrypter(string.Empty); + DefaultCrypter ??= new SimpleStringCrypter(string.Empty); Crypter = DefaultCrypter; } return Crypter; @@ -66,7 +65,7 @@ public class SecureString } 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; diff --git a/Pilz.Drawing.Drawing3D.OpenGLRenderer/Camera/Camera.vb b/Pilz.Drawing.Drawing3D.OpenGLRenderer/Camera/Camera.vb index e87f868..22db3c5 100644 --- a/Pilz.Drawing.Drawing3D.OpenGLRenderer/Camera/Camera.vb +++ b/Pilz.Drawing.Drawing3D.OpenGLRenderer/Camera/Camera.vb @@ -120,7 +120,7 @@ Namespace CameraN Private Sub OrientateCam(ang As Single, ang2 As Single) 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)) 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) Dim pitch_Renamed As Double = CamAngleY - (Math.PI / 2) 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)) - pos.X = pos.X + xAmt * (CamLX) * CamSpeedMultiplier - pos.Y = pos.Y + yAmt * (CamLY) * CamSpeedMultiplier - pos.Z = pos.Z + zAmt * (CamLZ) * CamSpeedMultiplier + pos.X += xAmt * (CamLX) * CamSpeedMultiplier + pos.Y += yAmt * (CamLY) * CamSpeedMultiplier + pos.Z += zAmt * (CamLZ) * CamSpeedMultiplier End Sub 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 y_diff As Single = myLookat.Y - pos.Y 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 z_diff = 0.001F End If @@ -210,32 +210,32 @@ Namespace CameraN currentLookDirection = dir Select Case currentLookDirection Case LookDirection.Top - pos = lookPositions(CInt(LookDirection.Top)) + pos = lookPositions(LookDirection.Top) myLookat = New Vector3(pos.X, -25000, pos.Z - 1) UpdateMatrix(cameraMatrix) SetRotationFromLookAt() Case LookDirection.Bottom - pos = lookPositions(CInt(LookDirection.Bottom)) + pos = lookPositions(LookDirection.Bottom) myLookat = New Vector3(pos.X, 25000, pos.Z + 1) UpdateMatrix(cameraMatrix) SetRotationFromLookAt() Case LookDirection.Left - pos = lookPositions(CInt(LookDirection.Left)) + pos = lookPositions(LookDirection.Left) myLookat = New Vector3(25000, pos.Y, pos.Z) UpdateMatrix(cameraMatrix) SetRotationFromLookAt() Case LookDirection.Right - pos = lookPositions(CInt(LookDirection.Right)) + pos = lookPositions(LookDirection.Right) myLookat = New Vector3(-25000, pos.Y, pos.Z) UpdateMatrix(cameraMatrix) SetRotationFromLookAt() Case LookDirection.Front - pos = lookPositions(CInt(LookDirection.Front)) + pos = lookPositions(LookDirection.Front) myLookat = New Vector3(pos.X, pos.Y, -25000) UpdateMatrix(cameraMatrix) SetRotationFromLookAt() Case LookDirection.Back - pos = lookPositions(CInt(LookDirection.Back)) + pos = lookPositions(LookDirection.Back) myLookat = New Vector3(pos.X, pos.Y, 25000) UpdateMatrix(cameraMatrix) SetRotationFromLookAt() @@ -313,9 +313,9 @@ Namespace CameraN Dim pitch_Renamed As Double = CamAngleY - (Math.PI / 2) Dim yaw_Renamed As Double = CamAngleX - (Math.PI / 2) - Dim CamLX As Single = CSng(Math.Sin(yaw_Renamed)) - Dim CamLY As Single = CSng(Math.Cos(pitch_Renamed)) - Dim CamLZ As Single = CSng(-Math.Cos(yaw_Renamed)) + Dim CamLX As Single = Math.Sin(yaw_Renamed) + Dim CamLY As Single = Math.Cos(pitch_Renamed) + Dim CamLZ As Single = -Math.Cos(yaw_Renamed) 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.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) - lookPositions(CInt(currentLookDirection)) = pos + lookPositions(currentLookDirection) = pos Case LookDirection.Bottom pos.X = orgPos.X - ((MousePosX * CamSpeedMultiplier) * (CamLX) * m) + ((MousePosY * CamSpeedMultiplier) * (CamLZ) * 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) - lookPositions(CInt(currentLookDirection)) = pos + lookPositions(currentLookDirection) = pos Case LookDirection.Left pos.X = orgPos.X - ((MousePosX * CamSpeedMultiplier) * (CamLX) * m) pos.Y = orgPos.Y - ((MousePosY * CamSpeedMultiplier) * (-1.0F) * 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) - lookPositions(CInt(currentLookDirection)) = pos + lookPositions(currentLookDirection) = pos Case LookDirection.Right pos.X = orgPos.X - ((MousePosX * CamSpeedMultiplier) * (CamLX) * m) pos.Y = orgPos.Y - ((MousePosY * CamSpeedMultiplier) * (-1.0F) * 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) - lookPositions(CInt(currentLookDirection)) = pos + lookPositions(currentLookDirection) = pos Case LookDirection.Front pos.X = orgPos.X - ((MousePosX * CamSpeedMultiplier) * (CamLX) * m) pos.Y = orgPos.Y - ((MousePosY * CamSpeedMultiplier) * (-1.0F) * 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) - lookPositions(CInt(currentLookDirection)) = pos + lookPositions(currentLookDirection) = pos Case LookDirection.Back pos.X = orgPos.X - ((MousePosX * CamSpeedMultiplier) * (CamLX) * m) pos.Y = orgPos.Y - ((MousePosY * CamSpeedMultiplier) * (-1.0F) * 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) - lookPositions(CInt(currentLookDirection)) = pos + lookPositions(currentLookDirection) = pos End Select RaisePerspectiveChanged() @@ -372,7 +372,7 @@ Namespace CameraN End If Dim MousePosX As Integer = mouseX - lastMouseX 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. If CamAngleX > TAU Then CamAngleX -= TAU @@ -419,9 +419,9 @@ Namespace CameraN 'Console.WriteLine(MousePosX+","+ MousePosY); Dim pitch_Renamed As Double = CamAngleY - (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); - Dim CamLZ As Single = CSng(-Math.Cos(yaw_Renamed)) + Dim CamLZ As Single = -Math.Cos(yaw_Renamed) pos.X += ((horz_amount * CamSpeedMultiplier) * (CamLX)) pos.Y += ((vert_amount * CamSpeedMultiplier) * (-1.0F)) pos.Z += ((horz_amount * CamSpeedMultiplier) * (CamLZ)) diff --git a/Pilz.Drawing.Drawing3D.OpenGLRenderer/Preview/ModelPreview.vb b/Pilz.Drawing.Drawing3D.OpenGLRenderer/Preview/ModelPreview.vb index c07dad3..5687635 100644 --- a/Pilz.Drawing.Drawing3D.OpenGLRenderer/Preview/ModelPreview.vb +++ b/Pilz.Drawing.Drawing3D.OpenGLRenderer/Preview/ModelPreview.vb @@ -136,12 +136,13 @@ Namespace PreviewN DoubleBuffered = True 'glControl1 - Me.glControl1 = New GLControl - Me.glControl1.BackColor = Color.Black - Me.glControl1.Location = New Point(0, 0) - Me.glControl1.MinimumSize = New Size(600, 120) - Me.glControl1.Name = "glControl1" - Me.glControl1.Anchor = AnchorStyles.Left Or AnchorStyles.Top Or AnchorStyles.Right Or AnchorStyles.Bottom + Me.glControl1 = New GLControl With { + .BackColor = Color.Black, + .Location = New Point(0, 0), + .MinimumSize = New Size(600, 120), + .Name = "glControl1", + .Anchor = AnchorStyles.Left Or AnchorStyles.Top Or AnchorStyles.Right Or AnchorStyles.Bottom + } Me.glControl1.Location = New Point(0, 0) Me.glControl1.Size = Me.ClientSize Me.glControl1.TabIndex = 0 @@ -268,7 +269,7 @@ Namespace PreviewN Private Sub glControl1_Wheel(sender As Object, e As MouseEventArgs) 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 glControl1.Invalidate() End Sub diff --git a/Pilz.Drawing.Drawing3D.OpenGLRenderer/Rendering/ContentPipe.vb b/Pilz.Drawing.Drawing3D.OpenGLRenderer/Rendering/ContentPipe.vb index a317f5f..8597231 100644 --- a/Pilz.Drawing.Drawing3D.OpenGLRenderer/Rendering/ContentPipe.vb +++ b/Pilz.Drawing.Drawing3D.OpenGLRenderer/Rendering/ContentPipe.vb @@ -1,9 +1,9 @@ -Imports System.Drawing.Imaging +Imports System.Drawing +Imports System.Drawing.Imaging Imports OpenTK.Graphics.OpenGL Imports Bitmap = System.Drawing.Bitmap -Imports System.Drawing Namespace RenderingN diff --git a/Pilz.Drawing/HelpfulDrawingFunctions.vb b/Pilz.Drawing/HelpfulDrawingFunctions.vb index aedafa4..eb23075 100644 --- a/Pilz.Drawing/HelpfulDrawingFunctions.vb +++ b/Pilz.Drawing/HelpfulDrawingFunctions.vb @@ -3,12 +3,12 @@ Public Module HelpfulDrawingFunctions Public Function IsPointInRectangle(p As PointF, rect As RectangleF) As Boolean - Dim bList As New List(Of Boolean) - - bList.Add(p.X > rect.Left) - bList.Add(p.X < rect.Right) - bList.Add(p.Y > rect.Top) - bList.Add(p.Y < rect.Bottom) + Dim bList As New List(Of Boolean) From { + p.X > rect.Left, + p.X < rect.Right, + p.Y > rect.Top, + p.Y < rect.Bottom + } Return Not bList.Contains(False) End Function diff --git a/Pilz.IO/EmbeddedFilesContainer.cs b/Pilz.IO/EmbeddedFilesContainer.cs index f87fe53..ff9a965 100644 --- a/Pilz.IO/EmbeddedFilesContainer.cs +++ b/Pilz.IO/EmbeddedFilesContainer.cs @@ -6,7 +6,7 @@ namespace Pilz.IO; public class EmbeddedFilesContainer { [JsonProperty("CompressedFiles")] - private readonly Dictionary compressedFiles = new Dictionary(); + private readonly Dictionary compressedFiles = []; /// /// Returns the names of all embedded files. diff --git a/Pilz.IO/ManagedPipes/ManagedPipeServer.cs b/Pilz.IO/ManagedPipes/ManagedPipeServer.cs index 5f90005..5023d5e 100644 --- a/Pilz.IO/ManagedPipes/ManagedPipeServer.cs +++ b/Pilz.IO/ManagedPipes/ManagedPipeServer.cs @@ -7,7 +7,7 @@ public class ManagedPipeServer : ManagedPipe { // Pro Verbindung (Anfrage) wird ein Client-Objekt generiert, das den Datenaustausch dieser Verbindung abwickelt - public List Clients { get; private set; } = new List(); + public List Clients { get; private set; } = []; private readonly string pipeName = ""; private readonly int maxNumbersOfServerInstances; diff --git a/Pilz.Net.CloudProviders.Nextcloud/Client/Apps/FileRetention/FilesRetentionClient.cs b/Pilz.Net.CloudProviders.Nextcloud/Client/Apps/FileRetention/FilesRetentionClient.cs index 54ffe58..ee5ac62 100644 --- a/Pilz.Net.CloudProviders.Nextcloud/Client/Apps/FileRetention/FilesRetentionClient.cs +++ b/Pilz.Net.CloudProviders.Nextcloud/Client/Apps/FileRetention/FilesRetentionClient.cs @@ -1,6 +1,4 @@ -using Pilz.Net.CloudProviders.Nextcloud; -using Pilz.Net.CloudProviders.Nextcloud.Client; -using Pilz.Net.CloudProviders.Nextcloud.Client.Apps.FileRetention.Model; +using Pilz.Net.CloudProviders.Nextcloud.Client.Apps.FileRetention.Model; namespace Pilz.Net.CloudProviders.Nextcloud.Client.Apps.FileRetention; diff --git a/Pilz.Net.CloudProviders.Nextcloud/Client/Apps/FileRetention/OcsApiFilesRetention.cs b/Pilz.Net.CloudProviders.Nextcloud/Client/Apps/FileRetention/OcsApiFilesRetention.cs index 4702bd7..b0578f5 100644 --- a/Pilz.Net.CloudProviders.Nextcloud/Client/Apps/FileRetention/OcsApiFilesRetention.cs +++ b/Pilz.Net.CloudProviders.Nextcloud/Client/Apps/FileRetention/OcsApiFilesRetention.cs @@ -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; namespace Pilz.Net.CloudProviders.Nextcloud.Client.Apps.FileRetention; diff --git a/Pilz.Net.CloudProviders.Nextcloud/Client/Apps/Tables/Model/Column.cs b/Pilz.Net.CloudProviders.Nextcloud/Client/Apps/Tables/Model/Column.cs index d3b3839..3804aaa 100644 --- a/Pilz.Net.CloudProviders.Nextcloud/Client/Apps/Tables/Model/Column.cs +++ b/Pilz.Net.CloudProviders.Nextcloud/Client/Apps/Tables/Model/Column.cs @@ -65,7 +65,7 @@ public class Column public int? TextMaxLength { get; set; } [JsonProperty("selectionOptions")] - public List SelectionOptions { get; } = new(); + public List SelectionOptions { get; } = []; [JsonProperty("selectionDefault")] public int? SelectionDefault { get; set; } diff --git a/Pilz.Net.CloudProviders.Nextcloud/Client/Apps/Tables/Model/Row.cs b/Pilz.Net.CloudProviders.Nextcloud/Client/Apps/Tables/Model/Row.cs index 763b7da..4174a95 100644 --- a/Pilz.Net.CloudProviders.Nextcloud/Client/Apps/Tables/Model/Row.cs +++ b/Pilz.Net.CloudProviders.Nextcloud/Client/Apps/Tables/Model/Row.cs @@ -23,5 +23,5 @@ public class Row public DateTime LastEditAt { get; set; } [JsonProperty("data")] - public List Data { get; set; } = new(); + public List Data { get; set; } = []; } diff --git a/Pilz.Net.CloudProviders.Nextcloud/Client/Apps/Tables/Model/RowUpdate.cs b/Pilz.Net.CloudProviders.Nextcloud/Client/Apps/Tables/Model/RowUpdate.cs index 389efea..b86a418 100644 --- a/Pilz.Net.CloudProviders.Nextcloud/Client/Apps/Tables/Model/RowUpdate.cs +++ b/Pilz.Net.CloudProviders.Nextcloud/Client/Apps/Tables/Model/RowUpdate.cs @@ -5,5 +5,5 @@ namespace Pilz.Net.CloudProviders.Nextcloud.Client.Apps.Tables.Model; public class RowUpdate { [JsonProperty("data")] - public Dictionary Data { get; set; } = new(); + public Dictionary Data { get; set; } = []; } diff --git a/Pilz.Net.CloudProviders.Nextcloud/Client/Apps/Tables/OcsApiTables.cs b/Pilz.Net.CloudProviders.Nextcloud/Client/Apps/Tables/OcsApiTables.cs index ad5c70a..129964d 100644 --- a/Pilz.Net.CloudProviders.Nextcloud/Client/Apps/Tables/OcsApiTables.cs +++ b/Pilz.Net.CloudProviders.Nextcloud/Client/Apps/Tables/OcsApiTables.cs @@ -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; namespace Pilz.Net.CloudProviders.Nextcloud.Client.Apps.Tables; diff --git a/Pilz.Net.CloudProviders.Nextcloud/Client/Apps/Tables/TablesClient.cs b/Pilz.Net.CloudProviders.Nextcloud/Client/Apps/Tables/TablesClient.cs index f979d95..9598cc6 100644 --- a/Pilz.Net.CloudProviders.Nextcloud/Client/Apps/Tables/TablesClient.cs +++ b/Pilz.Net.CloudProviders.Nextcloud/Client/Apps/Tables/TablesClient.cs @@ -1,6 +1,4 @@ -using Pilz.Net.CloudProviders.Nextcloud; -using Pilz.Net.CloudProviders.Nextcloud.Client; -using Pilz.Net.CloudProviders.Nextcloud.Client.Apps.Tables.Model; +using Pilz.Net.CloudProviders.Nextcloud.Client.Apps.Tables.Model; namespace Pilz.Net.CloudProviders.Nextcloud.Client.Apps.Tables; diff --git a/Pilz.Net.CloudProviders.Nextcloud/Client/Cloud/CloudClient.cs b/Pilz.Net.CloudProviders.Nextcloud/Client/Cloud/CloudClient.cs index a10b612..75dc605 100644 --- a/Pilz.Net.CloudProviders.Nextcloud/Client/Cloud/CloudClient.cs +++ b/Pilz.Net.CloudProviders.Nextcloud/Client/Cloud/CloudClient.cs @@ -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; diff --git a/Pilz.Net.CloudProviders.Nextcloud/Client/Cloud/Model/UserInfo.cs b/Pilz.Net.CloudProviders.Nextcloud/Client/Cloud/Model/UserInfo.cs index 9fb0fe8..dc2c8b1 100644 --- a/Pilz.Net.CloudProviders.Nextcloud/Client/Cloud/Model/UserInfo.cs +++ b/Pilz.Net.CloudProviders.Nextcloud/Client/Cloud/Model/UserInfo.cs @@ -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; diff --git a/Pilz.Net.CloudProviders.Nextcloud/Client/Cloud/OcsApiCloud.cs b/Pilz.Net.CloudProviders.Nextcloud/Client/Cloud/OcsApiCloud.cs index f0621c4..54d49d5 100644 --- a/Pilz.Net.CloudProviders.Nextcloud/Client/Cloud/OcsApiCloud.cs +++ b/Pilz.Net.CloudProviders.Nextcloud/Client/Cloud/OcsApiCloud.cs @@ -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; namespace Pilz.Net.CloudProviders.Nextcloud.Client.Cloud; diff --git a/Pilz.Net.CloudProviders.Nextcloud/NextcloudClient.cs b/Pilz.Net.CloudProviders.Nextcloud/NextcloudClient.cs index 1914b38..46865a2 100644 --- a/Pilz.Net.CloudProviders.Nextcloud/NextcloudClient.cs +++ b/Pilz.Net.CloudProviders.Nextcloud/NextcloudClient.cs @@ -24,7 +24,7 @@ namespace Pilz.Net.CloudProviders.Nextcloud; public class NextcloudClient : IDisposable { - private readonly List clients = new(); + private readonly List clients = []; private NextcloudLogin? currentLogin; public OcsApi Ocs { get; init; } = new(); diff --git a/Pilz.Net.CloudProviders.Nextcloud/OCS/OcsApi.cs b/Pilz.Net.CloudProviders.Nextcloud/OCS/OcsApi.cs index ed7c3dc..b324b36 100644 --- a/Pilz.Net.CloudProviders.Nextcloud/OCS/OcsApi.cs +++ b/Pilz.Net.CloudProviders.Nextcloud/OCS/OcsApi.cs @@ -13,7 +13,7 @@ public class OcsApi : IDisposable public event GetOcsApiAuthCredentailsEventHandler? GetOcsApiAuthCredentails; private readonly HttpClient client = new(); - private readonly List apis = new(); + private readonly List apis = []; public string BaseUrl { get; set; } = string.Empty; diff --git a/Pilz.Net/Api/ApiParameterCollection.cs b/Pilz.Net/Api/ApiParameterCollection.cs index f677642..c966ec9 100644 --- a/Pilz.Net/Api/ApiParameterCollection.cs +++ b/Pilz.Net/Api/ApiParameterCollection.cs @@ -1,6 +1,4 @@ using Pilz.Extensions.Collections; -using System.Collections.Specialized; -using System.Web; namespace Pilz.Net.Api; diff --git a/Pilz.Net/Api/ApiServer.cs b/Pilz.Net/Api/ApiServer.cs index 459ac5a..a5443f3 100644 --- a/Pilz.Net/Api/ApiServer.cs +++ b/Pilz.Net/Api/ApiServer.cs @@ -96,7 +96,7 @@ public class ApiServer : IApiServer var httpListener = new HttpListener(); httpListener.TimeoutManager.IdleConnection = new TimeSpan(0, 2, 0); - + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { httpListener.TimeoutManager.RequestQueue = new TimeSpan(0, 2, 0); diff --git a/Pilz.Net/Api/Client/BaseChildItemClient.cs b/Pilz.Net/Api/Client/BaseChildItemClient.cs index fcddd37..a09f627 100644 --- a/Pilz.Net/Api/Client/BaseChildItemClient.cs +++ b/Pilz.Net/Api/Client/BaseChildItemClient.cs @@ -9,7 +9,7 @@ public abstract class BaseChildItemClient(IApiClient client) : BaseClient( public abstract string ApiEndpointParent { get; } public abstract string ApiEndpointChild { get; } - public virtual async Task> GetAll(int parentId) + public virtual async Task> GetAll(int parentId) { return (await client.SendRequest.Items>($"{ApiEndpointParent}/{parentId}{ApiEndpointChild}", HttpMethod.Get)).EnsureOk().Items; } diff --git a/Pilz.Net/Api/Client/BaseItemClient.cs b/Pilz.Net/Api/Client/BaseItemClient.cs index f37e324..1e176e5 100644 --- a/Pilz.Net/Api/Client/BaseItemClient.cs +++ b/Pilz.Net/Api/Client/BaseItemClient.cs @@ -1,5 +1,4 @@ using Pilz.Data; -using Pilz.Net.Api.Messages; namespace Pilz.Net.Api.Client; diff --git a/Pilz.Net/Api/Server/MaintenanceHandler.cs b/Pilz.Net/Api/Server/MaintenanceHandler.cs index 4e8c5e6..a663ba5 100644 --- a/Pilz.Net/Api/Server/MaintenanceHandler.cs +++ b/Pilz.Net/Api/Server/MaintenanceHandler.cs @@ -1,7 +1,6 @@ using Pilz.Extensions.Reflection; using Pilz.Net.Api.Messages; using System.Diagnostics; -using System.Net; namespace Pilz.Net.Api.Server; @@ -41,7 +40,7 @@ public class MaintenanceHandler : IApiHandlerInitializer { if (MaintenanceEnabled) { - + // ... } } diff --git a/Pilz.Net/ConnectionManagerBase.cs b/Pilz.Net/ConnectionManagerBase.cs index 72dda84..e120340 100644 --- a/Pilz.Net/ConnectionManagerBase.cs +++ b/Pilz.Net/ConnectionManagerBase.cs @@ -7,7 +7,7 @@ namespace Pilz.Net; public abstract class ConnectionManagerBase(int port) { private const int HEADER_LENGTH = 12; - + private bool listening = false; private readonly Dictionary> dicData = []; @@ -122,13 +122,15 @@ public abstract class ConnectionManagerBase(int port) finalBuffer.Add((byte)(value >> 16 & 0xFF)); finalBuffer.Add((byte)(value >> 8 & 0xFF)); finalBuffer.Add((byte)(value & 0xFF)); - }; + } + ; void addHeader(int packageID, int packagesCount) { addInteger(dataID); // Data ID addInteger(packageID); // Package ID addInteger(packagesCount); // Packages Count - }; + } + ; // Send data (this if statement and else content might be useless) if (data.Length > maxDataSize) diff --git a/Pilz.Net/TCPManager.cs b/Pilz.Net/TCPManager.cs index 5662ee4..ea91609 100644 --- a/Pilz.Net/TCPManager.cs +++ b/Pilz.Net/TCPManager.cs @@ -5,7 +5,7 @@ namespace Pilz.Net; 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 override void Start() diff --git a/Pilz.Plugins.Advanced.UI.WinForms.Telerik/RadPluginModuleUI.cs b/Pilz.Plugins.Advanced.UI.WinForms.Telerik/RadPluginModuleUI.cs index 37e05a5..03e2aa4 100644 --- a/Pilz.Plugins.Advanced.UI.WinForms.Telerik/RadPluginModuleUI.cs +++ b/Pilz.Plugins.Advanced.UI.WinForms.Telerik/RadPluginModuleUI.cs @@ -1,5 +1,5 @@ -using Pilz.UI.Telerik.Dialogs; -using Pilz.UI.WinForms; +using Pilz.UI; +using Pilz.UI.Telerik.Dialogs; namespace Pilz.Plugins.Advanced.UI.WinForms.Telerik; diff --git a/Pilz.Plugins.Advanced.UI.WinForms/ControlListenerFeature.cs b/Pilz.Plugins.Advanced.UI.WinForms/ControlListenerFeature.cs index 477518c..8c6a021 100644 --- a/Pilz.Plugins.Advanced.UI.WinForms/ControlListenerFeature.cs +++ b/Pilz.Plugins.Advanced.UI.WinForms/ControlListenerFeature.cs @@ -2,7 +2,7 @@ public abstract class ControlListenerFeature : PluginFeature { - public string? ControlName { get; set; } + public string? ControlName { get; set; } public bool ControlNameRegEx { get; set; } diff --git a/Pilz.Plugins.Advanced.UI.WinForms/PluginModuleUI.cs b/Pilz.Plugins.Advanced.UI.WinForms/PluginModuleUI.cs index b14bca2..e5e115a 100644 --- a/Pilz.Plugins.Advanced.UI.WinForms/PluginModuleUI.cs +++ b/Pilz.Plugins.Advanced.UI.WinForms/PluginModuleUI.cs @@ -1,4 +1,4 @@ -using Pilz.UI.WinForms; +using Pilz.UI; using Pilz.UI.WinForms.Dialogs; namespace Pilz.Plugins.Advanced.UI.WinForms; diff --git a/Pilz.Plugins.Advanced/PluginFeature.cs b/Pilz.Plugins.Advanced/PluginFeature.cs index 098b18e..e049b55 100644 --- a/Pilz.Plugins.Advanced/PluginFeature.cs +++ b/Pilz.Plugins.Advanced/PluginFeature.cs @@ -1,6 +1,4 @@ -using System.Reflection.Metadata; - -namespace Pilz.Plugins.Advanced; +namespace Pilz.Plugins.Advanced; public abstract class PluginFeature { diff --git a/Pilz.Plugins.Advanced/PluginFeatureController.cs b/Pilz.Plugins.Advanced/PluginFeatureController.cs index 8713972..024cd56 100644 --- a/Pilz.Plugins.Advanced/PluginFeatureController.cs +++ b/Pilz.Plugins.Advanced/PluginFeatureController.cs @@ -1,5 +1,4 @@ -using Microsoft.VisualBasic; -using System.Reflection; +using System.Reflection; namespace Pilz.Plugins.Advanced; diff --git a/Pilz.Simple3DFileParser/FileParser/Aspose3DLoader.vb b/Pilz.Simple3DFileParser/FileParser/Aspose3DLoader.vb index 2878251..2782552 100644 --- a/Pilz.Simple3DFileParser/FileParser/Aspose3DLoader.vb +++ b/Pilz.Simple3DFileParser/FileParser/Aspose3DLoader.vb @@ -118,12 +118,12 @@ Namespace Aspose3DModule 'Create Vertices For Each vert As Vector4 In curMesh.ControlPoints 'Create new Vertex - Dim newVert As New Vertex - 'Set Vertex Data - newVert.X = vert.x - newVert.Y = vert.y - newVert.Z = vert.z + Dim newVert As New Vertex With { + .X = vert.x, + .Y = vert.y, + .Z = vert.z + } 'Add new Vertex newMesh.Vertices.Add(newVert) @@ -134,12 +134,12 @@ Namespace Aspose3DModule If veNormals IsNot Nothing Then For Each n As Vector4 In veNormals.Data 'Create new Normal - Dim newNormal As New Normal - 'Set Normal Data - newNormal.X = n.x - newNormal.Y = n.y - newNormal.Z = n.z + Dim newNormal As New Normal With { + .X = n.x, + .Y = n.y, + .Z = n.z + } 'Add new Normal newMesh.Normals.Add(newNormal) @@ -151,11 +151,11 @@ Namespace Aspose3DModule If veUVs IsNot Nothing Then For Each uv As Vector4 In veUVs.Data 'Create new UV - Dim newUV As New UV - 'Set UV Data - newUV.U = uv.x - newUV.V = uv.y + Dim newUV As New UV With { + .U = uv.x, + .V = uv.y + } 'Add new UV newMesh.UVs.Add(newUV) @@ -167,13 +167,13 @@ Namespace Aspose3DModule If veVertexColor IsNot Nothing Then For Each n As Vector4 In veVertexColor.Data 'Create new Normal - Dim newVC As New VertexColor - 'Set Normal Data - newVC.R = n.x - newVC.G = n.y - newVC.B = n.z - newVC.A = n.w + Dim newVC As New VertexColor With { + .R = n.x, + .G = n.y, + .B = n.z, + .A = n.w + } 'Add new Normal newMesh.VertexColors.Add(newVC) @@ -203,10 +203,10 @@ Namespace Aspose3DModule For Each index As Integer In poly 'Create new Point - Dim p As New Point - 'Set Vertex - p.Vertex = newMesh.Vertices(index) + Dim p As New Point With { + .Vertex = newMesh.Vertices(index) + } 'Set Normal If veNormals IsNot Nothing Then diff --git a/Pilz.Simple3DFileParser/FileParser/AssimpLoader.vb b/Pilz.Simple3DFileParser/FileParser/AssimpLoader.vb index c60d484..b6430f0 100644 --- a/Pilz.Simple3DFileParser/FileParser/AssimpLoader.vb +++ b/Pilz.Simple3DFileParser/FileParser/AssimpLoader.vb @@ -68,7 +68,7 @@ Namespace AssimpModule Dim dicUVs = pc.DicUVs Dim dicVertexColors = pc.DicVertexColors - trafo = trafo * node.Transform + trafo *= node.Transform If node.HasMeshes Then For Each meshIndex In node.MeshIndices @@ -126,10 +126,10 @@ Namespace AssimpModule For Each uvList As List(Of Vector3D) In m.TextureCoordinateChannels For Each uv As Vector3D In uvList If Not dicUVs.ContainsKey(uv) Then - Dim newUV As New UV - - newUV.U = uv.X - newUV.V = uv.Y + Dim newUV As New UV With { + .U = uv.X, + .V = uv.Y + } newMesh.UVs.Add(newUV) dicUVs.Add(uv, newUV) @@ -140,12 +140,12 @@ Namespace AssimpModule For Each vcList As List(Of Color4D) In m.VertexColorChannels For Each vc As Color4D In vcList If Not dicVertexColors.ContainsKey(vc) Then - Dim newVC As New VertexColor - - newVC.R = vc.R - newVC.G = vc.G - newVC.B = vc.B - newVC.A = vc.A + Dim newVC As New VertexColor With { + .R = vc.R, + .G = vc.G, + .B = vc.B, + .A = vc.A + } newMesh.VertexColors.Add(newVC) dicVertexColors.Add(vc, newVC) @@ -298,15 +298,16 @@ Namespace AssimpModule End If For Each kvp As KeyValuePair(Of String, Material) In obj.Materials - Dim mat As New Assimp.Material - - mat.Name = If(kvp.Key <> "", kvp.Key, "_" & mdl.Materials.Count) + Dim mat As New Assimp.Material With { + .Name = If(kvp.Key <> "", kvp.Key, "_" & mdl.Materials.Count) + } mat.Opacity = mat.Opacity - Dim texslot As New TextureSlot - texslot.TextureIndex = mdl.Textures.Count - texslot.TextureType = TextureType.Diffuse - texslot.UVIndex = 0 + Dim texslot As New TextureSlot With { + .TextureIndex = mdl.Textures.Count, + .TextureType = TextureType.Diffuse, + .UVIndex = 0 + } Dim ms As New MemoryStream kvp.Value.Image.Save(ms, Imaging.ImageFormat.Png) @@ -342,8 +343,9 @@ Namespace AssimpModule If dicTexMesh.ContainsKey(f.Material) Then m = dicTexMesh(f.Material) Else - m = New Assimp.Mesh("Mesh_" & mdl.MeshCount + 1) - m.PrimitiveType = PrimitiveType.Triangle + m = New Assimp.Mesh("Mesh_" & mdl.MeshCount + 1) With { + .PrimitiveType = PrimitiveType.Triangle + } If dicMatIndex.ContainsKey(f.Material) Then m.MaterialIndex = dicMatIndex(f.Material) End If @@ -359,20 +361,22 @@ Namespace AssimpModule newFace.Indices.Add(dicCounter(m)) If p.Vertex IsNot Nothing Then - Dim vert As New Vector3D - vert.X = p.Vertex.X - vert.Y = p.Vertex.Y - vert.Z = p.Vertex.Z + Dim vert As New Vector3D With { + .X = p.Vertex.X, + .Y = p.Vertex.Y, + .Z = p.Vertex.Z + } m.Vertices.Add(vert) Else m.Vertices.Add(New Vector3D(0, 0, 0)) End If If p.Normal IsNot Nothing Then - Dim norm As New Vector3D - norm.X = p.Normal.X - norm.Y = p.Normal.Y - norm.Z = p.Normal.Z + Dim norm As New Vector3D With { + .X = p.Normal.X, + .Y = p.Normal.Y, + .Z = p.Normal.Z + } m.Normals.Add(norm) Else m.Normals.Add(New Vector3D(0, 0, 0)) diff --git a/Pilz.Simple3DFileParser/Other/LoaderModule.vb b/Pilz.Simple3DFileParser/Other/LoaderModule.vb index 8f71d86..92584c7 100644 --- a/Pilz.Simple3DFileParser/Other/LoaderModule.vb +++ b/Pilz.Simple3DFileParser/Other/LoaderModule.vb @@ -68,11 +68,11 @@ Public Class File3DLoaderModule End Property Private Shared Function GetLoaderModules() As File3DLoaderModule() - Dim list As New List(Of File3DLoaderModule) - - list.Add(New File3DLoaderModule("Simple File Parser", + Dim list As New List(Of File3DLoaderModule) From { + New File3DLoaderModule("Simple File Parser", AddressOf LoadViaSimpleFileParser, - New Dictionary(Of String, String) From {{"obj", "OBJ"}})) + New Dictionary(Of String, String) From {{"obj", "OBJ"}}) + } AssimpModule.AssimpLoader.LoadAssimpLibs() Dim exts As New Dictionary(Of String, String) @@ -111,11 +111,11 @@ Public Class File3DLoaderModule End Function Private Shared Function GetExporterModules() As File3DLoaderModule() - Dim list As New List(Of File3DLoaderModule) - - list.Add(New File3DLoaderModule("Simple File Parser", + Dim list As New List(Of File3DLoaderModule) From { + New File3DLoaderModule("Simple File Parser", AddressOf ExportViaSimpleFileParser, - New Dictionary(Of String, String) From {{"obj", "OBJ"}})) + New Dictionary(Of String, String) From {{"obj", "OBJ"}}) + } AssimpModule.AssimpLoader.LoadAssimpLibs() Dim exts As New Dictionary(Of String, String) diff --git a/Pilz.UI.Gtk/Dialogs/GtkContent.cs b/Pilz.UI.Gtk/Dialogs/GtkContent.cs new file mode 100644 index 0000000..914468b --- /dev/null +++ b/Pilz.UI.Gtk/Dialogs/GtkContent.cs @@ -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); + } +} diff --git a/Pilz.UI.Gtk/Dialogs/GtkDialogBase.Statics.cs b/Pilz.UI.Gtk/Dialogs/GtkDialogBase.Statics.cs new file mode 100644 index 0000000..cea742b --- /dev/null +++ b/Pilz.UI.Gtk/Dialogs/GtkDialogBase.Statics.cs @@ -0,0 +1,33 @@ +using Gtk; + +namespace Pilz.UI.Gtk.Dialogs; + +public partial class GtkDialogBase +{ + private static GtkDialogBase CreateDialog(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 content, string title) where TContent : Widget + { + var dialog = CreateDialog(content, title); + dialog.Show(); + dialog.Destroy(); + return content; + } + + public static TContent ShowDialog(TContent content, string title) where TContent : Widget + { + var dialog = CreateDialog(content, title); + dialog.Run(); + dialog.Destroy(); + return content; + } +} diff --git a/Pilz.UI.Gtk/Dialogs/GtkDialogBase.cs b/Pilz.UI.Gtk/Dialogs/GtkDialogBase.cs new file mode 100644 index 0000000..3f9bf59 --- /dev/null +++ b/Pilz.UI.Gtk/Dialogs/GtkDialogBase.cs @@ -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(); + } +} diff --git a/Pilz.UI.Gtk/Dialogs/GtkDialogBase.glade b/Pilz.UI.Gtk/Dialogs/GtkDialogBase.glade new file mode 100644 index 0000000..1ca2644 --- /dev/null +++ b/Pilz.UI.Gtk/Dialogs/GtkDialogBase.glade @@ -0,0 +1,65 @@ + + + + + + False + center-on-parent + dialog + + + False + vertical + 2 + + + False + end + + + gtk-apply + True + True + True + True + True + + + True + True + 0 + + + + + gtk-cancel + True + True + True + True + True + + + True + True + 1 + + + + + False + False + 0 + + + + + + + + + buttonOkay + buttonCancel + + + diff --git a/Pilz.UI.Gtk/Pilz.UI.Gtk.csproj b/Pilz.UI.Gtk/Pilz.UI.Gtk.csproj index 86bac70..bd516d1 100644 --- a/Pilz.UI.Gtk/Pilz.UI.Gtk.csproj +++ b/Pilz.UI.Gtk/Pilz.UI.Gtk.csproj @@ -11,6 +11,14 @@ 1.0.0 + + + + + + + + diff --git a/Pilz.UI.Gtk/Symbols/GtkSymbolFactory.cs b/Pilz.UI.Gtk/Symbols/GtkSymbolFactory.cs index 7f107da..67132bb 100644 --- a/Pilz.UI.Gtk/Symbols/GtkSymbolFactory.cs +++ b/Pilz.UI.Gtk/Symbols/GtkSymbolFactory.cs @@ -24,7 +24,7 @@ public abstract class GtkSymbolFactory : BaseSymbolFactory, pixbuf = new(stream); else pixbuf = new(stream, size.Width, size.Height); - + return GetImageFromPixbuf(pixbuf); } diff --git a/Pilz.UI.WinForms.Telerik.Symbols/RadSymbols.cs b/Pilz.UI.WinForms.Telerik.Symbols/RadSymbols.cs index cca8464..3a0b32a 100644 --- a/Pilz.UI.WinForms.Telerik.Symbols/RadSymbols.cs +++ b/Pilz.UI.WinForms.Telerik.Symbols/RadSymbols.cs @@ -1,5 +1,5 @@ using Pilz.SymbolPacks.Sets; -using Pilz.UI.Telerik.Symbols.Factories; +using Pilz.UI.WinForms.Telerik.Symbols.Factories; namespace Pilz.UI.WinForms.Telerik.Symbols; diff --git a/Pilz.UI.WinForms.Telerik/Controls/RadValidationProvider/RadValidationProviderEx.cs b/Pilz.UI.WinForms.Telerik/Controls/RadValidationProvider/RadValidationProviderEx.cs index 61b1725..6659818 100644 --- a/Pilz.UI.WinForms.Telerik/Controls/RadValidationProvider/RadValidationProviderEx.cs +++ b/Pilz.UI.WinForms.Telerik/Controls/RadValidationProvider/RadValidationProviderEx.cs @@ -1,5 +1,4 @@ using System.Collections; -using System.Collections.Generic; using System.ComponentModel; using System.Drawing.Design; using System.Globalization; diff --git a/Pilz.UI.WinForms.Telerik/Controls/RadValidationProvider/RadValidationRuleWithTargetControlEx.cs b/Pilz.UI.WinForms.Telerik/Controls/RadValidationProvider/RadValidationRuleWithTargetControlEx.cs index a181d67..143d641 100644 --- a/Pilz.UI.WinForms.Telerik/Controls/RadValidationProvider/RadValidationRuleWithTargetControlEx.cs +++ b/Pilz.UI.WinForms.Telerik/Controls/RadValidationProvider/RadValidationRuleWithTargetControlEx.cs @@ -1,5 +1,4 @@ using System.ComponentModel; -using Telerik.WinControls.Data; //using System.Linq; namespace Pilz.UI.WinForms.Telerik.Controls.RadValidationProvider; diff --git a/Pilz.UI.WinForms.Telerik/Dialogs/RadDialogBase.cs b/Pilz.UI.WinForms.Telerik/Dialogs/RadDialogBase.cs index eae2b3a..bcd3a1d 100644 --- a/Pilz.UI.WinForms.Telerik/Dialogs/RadDialogBase.cs +++ b/Pilz.UI.WinForms.Telerik/Dialogs/RadDialogBase.cs @@ -1,4 +1,4 @@ -using Pilz.UI.WinForms; +using Pilz.UI.WinForms.Telerik.Dialogs; using Telerik.WinControls.UI; namespace Pilz.UI.Telerik.Dialogs; @@ -30,6 +30,6 @@ public partial class RadDialogBase : RadForm private void DialogBaseForm_FormClosed(object? sender, FormClosedEventArgs e) { - DialogClosed?.Invoke(new DialogClosedEventArgs(this)); + DialogClosed?.Invoke(new WinForms.Telerik.Dialogs.DialogClosedEventArgs(this)); } } diff --git a/Pilz.UI.WinForms.Telerik/Dialogs/RadFlyoutBase.Statics.cs b/Pilz.UI.WinForms.Telerik/Dialogs/RadFlyoutBase.Statics.cs index e3c98e1..1ad7953 100644 --- a/Pilz.UI.WinForms.Telerik/Dialogs/RadFlyoutBase.Statics.cs +++ b/Pilz.UI.WinForms.Telerik/Dialogs/RadFlyoutBase.Statics.cs @@ -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.UI; using Telerik.WinControls.UI.SplashScreen; @@ -9,7 +8,7 @@ namespace Pilz.UI.Telerik.Dialogs; partial class RadFlyoutBase { 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 { @@ -72,7 +71,7 @@ partial class RadFlyoutBase { 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()) { diff --git a/Pilz.UI.WinForms.Telerik/Dialogs/RadFlyoutBase.cs b/Pilz.UI.WinForms.Telerik/Dialogs/RadFlyoutBase.cs index 92faab6..758234e 100644 --- a/Pilz.UI.WinForms.Telerik/Dialogs/RadFlyoutBase.cs +++ b/Pilz.UI.WinForms.Telerik/Dialogs/RadFlyoutBase.cs @@ -1,7 +1,6 @@ using Pilz.UI.WinForms.Telerik.Controls.RadValidationProvider; using System.ComponentModel; using Telerik.WinControls; -using Telerik.WinControls.Data; using Telerik.WinControls.UI; namespace Pilz.UI.Telerik.Dialogs; diff --git a/Pilz.UI.WinForms/Dialogs/DialogBase.cs b/Pilz.UI.WinForms/Dialogs/DialogBase.cs index f681ee0..4dbed25 100644 --- a/Pilz.UI.WinForms/Dialogs/DialogBase.cs +++ b/Pilz.UI.WinForms/Dialogs/DialogBase.cs @@ -1,5 +1,4 @@ -using Pilz.UI.WinForms; -using Pilz.UI.WinForms.Dialogs; +using Pilz.UI.WinForms.Dialogs; namespace Pilz.UI.Dialogs; diff --git a/Pilz.UI.WinForms/Dialogs/FlyoutBase.cs b/Pilz.UI.WinForms/Dialogs/FlyoutBase.cs index a98f889..f2deebd 100644 --- a/Pilz.UI.WinForms/Dialogs/FlyoutBase.cs +++ b/Pilz.UI.WinForms/Dialogs/FlyoutBase.cs @@ -1,6 +1,5 @@ using Pilz.UI.Dialogs; using System.ComponentModel; -using System.Diagnostics.CodeAnalysis; namespace Pilz.UI.WinForms.Dialogs; @@ -150,7 +149,7 @@ public partial class FlyoutBase : UserControl tableLayoutPanel_ActionPanel.RowStyles.Add(new RowStyle()); tableLayoutPanel_ActionPanel.Controls.Add(button_Cancel, 2, 0); tableLayoutPanel_ActionPanel.Controls.Add(button_Accept, 1, 0); - + // FlyoutBase AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleMode = AutoScaleMode.Font; diff --git a/Pilz.UI.WinForms/DisplayHelp.cs b/Pilz.UI.WinForms/DisplayHelp.cs index fcb34f9..4b8cad7 100644 --- a/Pilz.UI.WinForms/DisplayHelp.cs +++ b/Pilz.UI.WinForms/DisplayHelp.cs @@ -1,5 +1,4 @@ -using System.Drawing; -using System.Drawing.Drawing2D; +using System.Drawing.Drawing2D; namespace Pilz.UI.WinForms; @@ -61,9 +60,11 @@ public class DisplayHelp else { using var brush = CreateLinearGradientBrush(r, color1, color2, gradientAngle); - var blend = new Blend(factors.Length); - blend.Factors = factors; - blend.Positions = positions; + var blend = new Blend(factors.Length) + { + Factors = factors, + Positions = positions + }; brush.Blend = blend; g.FillRectangle(brush, r); } diff --git a/Pilz.UI.WinForms/Extensions/FlyoutBaseExtensions.cs b/Pilz.UI.WinForms/Extensions/FlyoutBaseExtensions.cs index 90306e3..895a0a5 100644 --- a/Pilz.UI.WinForms/Extensions/FlyoutBaseExtensions.cs +++ b/Pilz.UI.WinForms/Extensions/FlyoutBaseExtensions.cs @@ -1,5 +1,4 @@ using Pilz.UI.WinForms.Dialogs; -using System.Diagnostics.CodeAnalysis; namespace Pilz.UI.WinForms.Extensions; diff --git a/Pilz.UI.WinForms/HelpfulFunctions.cs b/Pilz.UI.WinForms/HelpfulFunctions.cs index 1c682de..16a4498 100644 --- a/Pilz.UI.WinForms/HelpfulFunctions.cs +++ b/Pilz.UI.WinForms/HelpfulFunctions.cs @@ -1,5 +1,4 @@ using System.Diagnostics; -using System.Windows.Forms; namespace Pilz.UI.WinForms; diff --git a/Pilz.UI.WinForms/HighlightPanel.cs b/Pilz.UI.WinForms/HighlightPanel.cs index 1cac074..85899c1 100644 --- a/Pilz.UI.WinForms/HighlightPanel.cs +++ b/Pilz.UI.WinForms/HighlightPanel.cs @@ -1,16 +1,11 @@ -using System; -using System.Collections.Generic; -using System.Drawing; -using System.Windows.Forms; - -namespace Pilz.UI.WinForms; +namespace Pilz.UI.WinForms; internal class HighlightPanel : Control { private Dictionary _Highlights = null; - private List _HighlightRegions = new List(); + private List _HighlightRegions = []; public HighlightPanel(Dictionary highlights) { diff --git a/Pilz.UI.WinForms/Highlighter.cs b/Pilz.UI.WinForms/Highlighter.cs index 4c6254a..dd2a143 100644 --- a/Pilz.UI.WinForms/Highlighter.cs +++ b/Pilz.UI.WinForms/Highlighter.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; +using System.ComponentModel; // Nicht gemergte Änderung aus Projekt "Pilz.UI (net8.0-windows)" // Vor: // Imports System.Windows.Forms @@ -9,7 +6,6 @@ using System.Drawing; // Nach: // Imports System.Drawing // Imports System.Windows.Forms -using System.Windows.Forms; namespace Pilz.UI.WinForms; @@ -17,8 +13,8 @@ namespace Pilz.UI.WinForms; public class Highlighter : Component { - private Dictionary _Highlights = new Dictionary(); - private Dictionary _HighlightOnFocus = new Dictionary(); + private Dictionary _Highlights = []; + private Dictionary _HighlightOnFocus = []; protected override void Dispose(bool disposing) { @@ -143,8 +139,8 @@ public class Highlighter : Component } } - private Dictionary _TabControl2 = new Dictionary(); - private Dictionary _ParentPanel = new Dictionary(); + private Dictionary _TabControl2 = []; + private Dictionary _ParentPanel = []; private void AddHighlight(Dictionary highlights, Control c, eHighlightColor highlightColor) { @@ -386,15 +382,14 @@ public class Highlighter : Component if (_ContainerControl is not null) { - if (_HighlightPanel is null) + _HighlightPanel ??= new HighlightPanel(_Highlights) { - _HighlightPanel = new HighlightPanel(_Highlights); - _HighlightPanel.FocusHighlightColor = _FocusHighlightColor; - _HighlightPanel.Margin = new Padding(0); - _HighlightPanel.Padding = new Padding(0); - _HighlightPanel.CustomHighlightColors = _CustomHighlightColors; - _HighlightPanel.Visible = false; - } + FocusHighlightColor = _FocusHighlightColor, + Margin = new Padding(0), + Padding = new Padding(0), + CustomHighlightColors = _CustomHighlightColors, + Visible = false + }; _ContainerControl.SizeChanged += ContainerControlSizeChanged; _ContainerControl.HandleCreated += ContainerControlHandleCreated; @@ -452,8 +447,10 @@ public class Highlighter : Component if (_DelayTimer is null) { - _DelayTimer = new(); - _DelayTimer.Interval = 100; + _DelayTimer = new() + { + Interval = 100 + }; _DelayTimer.Tick += new EventHandler(DelayTimerTick); _DelayTimer.Start(); } diff --git a/Pilz.UI.WinForms/PaintingControl/ArrowLineCapProps.cs b/Pilz.UI.WinForms/PaintingControl/ArrowLineCapProps.cs index 306c55f..3657d15 100644 --- a/Pilz.UI.WinForms/PaintingControl/ArrowLineCapProps.cs +++ b/Pilz.UI.WinForms/PaintingControl/ArrowLineCapProps.cs @@ -1,5 +1,4 @@ -using System.Drawing; -using System.Drawing.Drawing2D; +using System.Drawing.Drawing2D; namespace Pilz.UI.WinForms.PaintingControl; diff --git a/Pilz.UI.WinForms/PaintingControl/DefaultDrawMethodes.cs b/Pilz.UI.WinForms/PaintingControl/DefaultDrawMethodes.cs index f9dc903..c397f0f 100644 --- a/Pilz.UI.WinForms/PaintingControl/DefaultDrawMethodes.cs +++ b/Pilz.UI.WinForms/PaintingControl/DefaultDrawMethodes.cs @@ -1,9 +1,5 @@ using Pilz.Drawing; -using Pilz.UI.WinForms.PaintingControl.EventArgs; -using System; -using System.Drawing; using System.Drawing.Drawing2D; -using System.Windows.Forms; 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); } - private static object _DrawPicture_newSyncObj = new object(); + private static object _DrawPicture_newSyncObj = new(); 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) { var rectToDraw = HelpfulDrawingFunctions.GetRectangle(startMousePos, lastMousePos); - var p = new Pen(pc.AreaSelectionColor); - p.DashStyle = startMousePos.X >= lastMousePos.X ? DashStyle.DashDot : DashStyle.Solid; - p.Width = 3f; + var p = new Pen(pc.AreaSelectionColor) + { + DashStyle = startMousePos.X >= lastMousePos.X ? DashStyle.DashDot : DashStyle.Solid, + Width = 3f + }; e.Graphics.DrawRectangle(p, rectToDraw.X, rectToDraw.Y, rectToDraw.Width, rectToDraw.Height); } diff --git a/Pilz.UI.WinForms/PaintingControl/EventArgs/PaintingObjectEventArgs.cs b/Pilz.UI.WinForms/PaintingControl/EventArgs/PaintingObjectEventArgs.cs index 1996508..97c0758 100644 --- a/Pilz.UI.WinForms/PaintingControl/EventArgs/PaintingObjectEventArgs.cs +++ b/Pilz.UI.WinForms/PaintingControl/EventArgs/PaintingObjectEventArgs.cs @@ -1,6 +1,4 @@ -using System; - -namespace Pilz.UI.WinForms.PaintingControl.EventArgs; +namespace Pilz.UI.WinForms.PaintingControl; public class PaintingObjectEventArgs(PaintingObject[] paintingObjects) : EventArgs { diff --git a/Pilz.UI.WinForms/PaintingControl/EventArgs/PaintingObjectPaintEventArgs.cs b/Pilz.UI.WinForms/PaintingControl/EventArgs/PaintingObjectPaintEventArgs.cs index 13f5a18..5b37091 100644 --- a/Pilz.UI.WinForms/PaintingControl/EventArgs/PaintingObjectPaintEventArgs.cs +++ b/Pilz.UI.WinForms/PaintingControl/EventArgs/PaintingObjectPaintEventArgs.cs @@ -1,7 +1,4 @@ -using System; -using System.Drawing; - -namespace Pilz.UI.WinForms.PaintingControl.EventArgs; +namespace Pilz.UI.WinForms.PaintingControl; 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. /// /// - 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) { diff --git a/Pilz.UI.WinForms/PaintingControl/PaintingControl.cs b/Pilz.UI.WinForms/PaintingControl/PaintingControl.cs index f70b27a..64dc544 100644 --- a/Pilz.UI.WinForms/PaintingControl/PaintingControl.cs +++ b/Pilz.UI.WinForms/PaintingControl/PaintingControl.cs @@ -1,15 +1,9 @@ using Pilz.Drawing; -using Pilz.UI.WinForms.PaintingControl.EventArgs; using Pilz.UI.WinForms.Utilities; -using System; using System.Collections; -using System.Collections.Generic; using System.ComponentModel; using System.Data; -using System.Drawing; using System.Drawing.Drawing2D; -using System.Linq; -using System.Windows.Forms; namespace Pilz.UI.WinForms.PaintingControl; @@ -48,7 +42,7 @@ public class PaintingControl : UserControl, IPaintingObjectContainer public Color GridColor { get; set; } = Color.LightGray; public DelegateDrawPaintingControlGridMethode DrawGridMethode { get; set; } = DefaultDrawMethodes.DrawGrid; 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 Image bufferedImg = null; @@ -57,7 +51,7 @@ public class PaintingControl : UserControl, IPaintingObjectContainer private bool pressedControl = false; private bool pressedAlt = false; - private Dictionary savedPos = new Dictionary(); + private Dictionary savedPos = []; public event SelectionChangedEventHandler SelectionChanged; @@ -413,8 +407,7 @@ public class PaintingControl : UserControl, IPaintingObjectContainer { if (IsResizingObjs(objs)) return; - if (movedObjs is null) - movedObjs = new List(); + movedObjs ??= []; SuspendDrawing(); @@ -663,7 +656,8 @@ public class PaintingControl : UserControl, IPaintingObjectContainer { obj2.X -= modLeft; } - }; + } + ; zoomLocation(obj); @@ -674,7 +668,8 @@ public class PaintingControl : UserControl, IPaintingObjectContainer 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); diff --git a/Pilz.UI.WinForms/PaintingControl/PaintingControlDelegates.cs b/Pilz.UI.WinForms/PaintingControl/PaintingControlDelegates.cs index 3b6b86c..67d085b 100644 --- a/Pilz.UI.WinForms/PaintingControl/PaintingControlDelegates.cs +++ b/Pilz.UI.WinForms/PaintingControl/PaintingControlDelegates.cs @@ -1,8 +1,4 @@ -using Pilz.UI.WinForms.PaintingControl.EventArgs; -using System.Drawing; -using System.Windows.Forms; - -namespace Pilz.UI.WinForms.PaintingControl; +namespace Pilz.UI.WinForms.PaintingControl; public delegate void DelegateDrawPaintingObjectMethode(PaintingObjectPaintEventArgs e); diff --git a/Pilz.UI.WinForms/PaintingControl/PaintingObject.cs b/Pilz.UI.WinForms/PaintingControl/PaintingObject.cs index 9acd47b..fc7c465 100644 --- a/Pilz.UI.WinForms/PaintingControl/PaintingObject.cs +++ b/Pilz.UI.WinForms/PaintingControl/PaintingObject.cs @@ -1,12 +1,7 @@ using Newtonsoft.Json; -using System; -using System.Collections.Generic; using System.ComponentModel; -using System.Drawing; using System.Drawing.Drawing2D; -using System.Linq; using System.Reflection; -using System.Windows.Forms; 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 Color TextColor { get; set; } = Color.Black; [JsonProperty] - private PointF _Location = new PointF(50f, 50f); + private PointF _Location = new(50f, 50f); [JsonProperty] - private SizeF _Size = new SizeF(50f, 80f); + private SizeF _Size = new(50f, 80f); public bool EnableFill { get; set; } = true; public bool EnableOutline { get; set; } = true; public Color SelectionColor { get; set; } = Color.CornflowerBlue; @@ -50,9 +45,9 @@ public class PaintingObject : ICloneable, IPaintingObjectContainer [JsonIgnore] public object Tag { get; set; } = null; public string Name { get; set; } = ""; - public List PinnedObjects { get; private set; } = new List(); + public List PinnedObjects { get; private set; } = []; [JsonIgnore] - public List DrawMethodes { get; private set; } = new List(); + public List DrawMethodes { get; private set; } = []; [JsonIgnore] public DelegateDrawPaintingObjectMethode DrawSelectionMethode { get; private set; } = DefaultDrawMethodes.DrawSelection; public Cursor Cursor { get; set; } = Cursors.Default; @@ -165,32 +160,32 @@ public class PaintingObject : ICloneable, IPaintingObjectContainer { case "DrawPicture": { - tt = tt | PaintingObjectType.Picture; + tt |= PaintingObjectType.Picture; break; } case "DrawText": { - tt = tt | PaintingObjectType.Text; + tt |= PaintingObjectType.Text; break; } case "DrawRectangle": { - tt = tt | PaintingObjectType.Rectangle; + tt |= PaintingObjectType.Rectangle; break; } case "DrawEllipse": { - tt = tt | PaintingObjectType.Elipse; + tt |= PaintingObjectType.Elipse; break; } case "DrawTriangle": { - tt = tt | PaintingObjectType.Triangle; + tt |= PaintingObjectType.Triangle; break; } case "DrawLine": { - tt = tt | PaintingObjectType.Line; + tt |= PaintingObjectType.Line; break; } } @@ -699,7 +694,8 @@ public class PaintingObject : ICloneable, IPaintingObjectContainer if (!blackFields.Contains(@field.Name)) @field.SetValue(dest, @field.GetValue(source)); } - }; + } + ; copyFields(this, obj, blackField, metype); copyFields(ImageProperties, obj.ImageProperties, Array.Empty(), ImageProperties.GetType()); diff --git a/Pilz.UI.WinForms/PaintingControl/PaintingObjectListLayering.cs b/Pilz.UI.WinForms/PaintingControl/PaintingObjectListLayering.cs index df5b4a7..8960977 100644 --- a/Pilz.UI.WinForms/PaintingControl/PaintingObjectListLayering.cs +++ b/Pilz.UI.WinForms/PaintingControl/PaintingObjectListLayering.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Data; -using System.Linq; +using System.Data; namespace Pilz.UI.WinForms.PaintingControl; @@ -10,7 +7,7 @@ public class PaintingObjectListLayering public PaintingObjectList ObjectList { get; private set; } - public Dictionary> Conditions { get; private set; } = new Dictionary>(); + public Dictionary> Conditions { get; private set; } = []; /// /// Get the order function will checkout the conditions. diff --git a/Pilz.UI.WinForms/PaintingControl/PaintingObjectResizing.cs b/Pilz.UI.WinForms/PaintingControl/PaintingObjectResizing.cs index 8df0832..b2c8a2f 100644 --- a/Pilz.UI.WinForms/PaintingControl/PaintingObjectResizing.cs +++ b/Pilz.UI.WinForms/PaintingControl/PaintingObjectResizing.cs @@ -1,8 +1,5 @@ using Pilz.Drawing; -using System; -using System.Drawing; using System.Runtime.CompilerServices; -using System.Windows.Forms; namespace Pilz.UI.WinForms.PaintingControl; @@ -95,7 +92,7 @@ internal class PaintingObjectResizing private EdgeEnum mEdge = EdgeEnum.None; private int mWidth = 4; private int qWidth = 4 * 4; - private Rectangle rect = new Rectangle(); + private Rectangle rect = new(); public bool Enabled { get; set; } = true; public SizeF MinimumSize { get; set; } = new SizeF(15f, 15f); @@ -239,11 +236,13 @@ internal class PaintingObjectResizing RectangleF extRect = mObj.RectangleExtended; var oldRect = mObj.Rectangle; - var newRect = new RectangleF(); - newRect.X = extRect.X - oldRect.X; - newRect.Y = extRect.Y - oldRect.Y; - newRect.Width = (extRect.Width - oldRect.Width) / 2f; - newRect.Height = (extRect.Height - oldRect.Height) / 2f; + var newRect = new RectangleF + { + X = extRect.X - oldRect.X, + Y = extRect.Y - oldRect.Y, + Width = (extRect.Width - oldRect.Width) / 2f, + Height = (extRect.Height - oldRect.Height) / 2f + }; var setToNone = false; var isOnTop = ReferenceEquals(mObj.Parent.GetObject(new PointF(realX, realY), true), mObj); diff --git a/Pilz.UI.WinForms/Symbols/ISymbolFactory.cs b/Pilz.UI.WinForms/Symbols/ISymbolFactory.cs index 603958c..e897680 100644 --- a/Pilz.UI.WinForms/Symbols/ISymbolFactory.cs +++ b/Pilz.UI.WinForms/Symbols/ISymbolFactory.cs @@ -1,5 +1,4 @@ using Pilz.UI.Symbols; -using System.Reflection; namespace Pilz.UI.WinForms.Symbols; diff --git a/Pilz.UI.WinForms/Utilities/DrawingControl.cs b/Pilz.UI.WinForms/Utilities/DrawingControl.cs index 46d85a5..d3ada88 100644 --- a/Pilz.UI.WinForms/Utilities/DrawingControl.cs +++ b/Pilz.UI.WinForms/Utilities/DrawingControl.cs @@ -1,14 +1,11 @@ -using System.Collections.Generic; -using System.Windows.Forms; - -namespace Pilz.UI.WinForms.Utilities; +namespace Pilz.UI.WinForms.Utilities; public static class DrawingControl { private const int WM_SETREDRAW = 11; - private readonly static Dictionary dicSuspendCount = new Dictionary(); + private readonly static Dictionary dicSuspendCount = []; public static void SuspendDrawing(this Control control) { diff --git a/Pilz.UI.WinForms/ILoadContent.cs b/Pilz.UI/ILoadContent.cs similarity index 65% rename from Pilz.UI.WinForms/ILoadContent.cs rename to Pilz.UI/ILoadContent.cs index 22ac3da..b410bc8 100644 --- a/Pilz.UI.WinForms/ILoadContent.cs +++ b/Pilz.UI/ILoadContent.cs @@ -1,4 +1,4 @@ -namespace Pilz.UI.WinForms; +namespace Pilz.UI; public interface ILoadContent { diff --git a/Pilz.UI.WinForms/ILoadContentAsync.cs b/Pilz.UI/ILoadContentAsync.cs similarity index 69% rename from Pilz.UI.WinForms/ILoadContentAsync.cs rename to Pilz.UI/ILoadContentAsync.cs index 1027fe2..f381ebd 100644 --- a/Pilz.UI.WinForms/ILoadContentAsync.cs +++ b/Pilz.UI/ILoadContentAsync.cs @@ -1,4 +1,4 @@ -namespace Pilz.UI.WinForms; +namespace Pilz.UI; public interface ILoadContentAsync {