change UI to UI.WinForms

This commit is contained in:
2025-06-16 11:50:17 +02:00
parent fa3a9da07e
commit 299867a910
116 changed files with 318 additions and 319 deletions

View File

@@ -1,7 +1,7 @@
using Telerik.WinControls;
using Telerik.WinControls.UI;
namespace Pilz.Plugins.Advanced.UI.Telerik;
namespace Pilz.Plugins.Advanced.UI.WinForms.Telerik;
public static class Extensions
{
@@ -14,27 +14,27 @@ public static class Extensions
public static RadButtonItem GetAsItem(this PluginModuleBase module, PluginButtonType buttonType = PluginButtonType.RadMenuItem)
{
return GetAsItem(module, true, buttonType: buttonType);
return module.GetAsItem(true, buttonType: buttonType);
}
public static RadButtonItem GetAsItem(this PluginModuleBase module, bool addDefaultHandler, PluginButtonType buttonType = PluginButtonType.RadMenuItem)
{
return GetAsItem(module, addDefaultHandler ? RadMenuItem_RMMethod_Click : null, buttonType: buttonType);
return module.GetAsItem(addDefaultHandler ? RadMenuItem_RMMethod_Click : null, buttonType: buttonType);
}
public static RadButtonItem GetAsItem(this PluginFunction function, PluginButtonType buttonType = PluginButtonType.RadMenuItem)
{
return GetAsItem(function, true, buttonType: buttonType);
return function.GetAsItem(true, buttonType: buttonType);
}
public static RadButtonItem GetAsItem(this PluginFunction function, bool addDefaultHandler, PluginButtonType buttonType = PluginButtonType.RadMenuItem)
{
return GetAsItem(function, addDefaultHandler ? RadMenuItem_RMFunction_Click : null, buttonType: buttonType);
return function.GetAsItem(addDefaultHandler ? RadMenuItem_RMFunction_Click : null, buttonType: buttonType);
}
public static RadButtonItem GetAsItem(this PluginFeature module, EventHandler? clickHandler, PluginButtonType buttonType = PluginButtonType.RadMenuItem)
{
RadButtonItem item = buttonType switch
var item = buttonType switch
{
PluginButtonType.RadMenuItem => new RadMenuItem(),
PluginButtonType.RadButtonElement => new RadButtonElement(),

View File

@@ -9,12 +9,12 @@
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Pilz.Plugins.Advanced.UI\Pilz.Plugins.Advanced.UI.csproj" />
<ProjectReference Include="..\Pilz.UI.Telerik\Pilz.UI.Telerik.csproj" />
<ProjectReference Include="..\Pilz.Plugins.Advanced.UI.WinForms\Pilz.Plugins.Advanced.UI.WinForms.csproj" />
<ProjectReference Include="..\Pilz.UI.WinForms.Telerik\Pilz.UI.WinForms.Telerik.csproj" />
</ItemGroup>
<PropertyGroup>
<Version>1.7.5</Version>
<Version>1.8.0</Version>
</PropertyGroup>
<ItemGroup>

View File

@@ -1,4 +1,4 @@
namespace Pilz.Plugins.Advanced.UI.Telerik;
namespace Pilz.Plugins.Advanced.UI.WinForms.Telerik;
public enum PluginButtonType
{

View File

@@ -1,8 +1,8 @@
using Pilz.UI.Telerik.Dialogs;
using Pilz.UI.Telerik.Extensions;
using Pilz.UI.WinForms.Telerik.Extensions;
using Telerik.WinControls;
namespace Pilz.Plugins.Advanced.UI.Telerik;
namespace Pilz.Plugins.Advanced.UI.WinForms.Telerik;
public abstract class RadPluginModule : PluginModule<RadPluginModuleUI>
{

View File

@@ -1,7 +1,7 @@
using Pilz.UI;
using Pilz.UI.Telerik.Dialogs;
using Pilz.UI.Telerik.Dialogs;
using Pilz.UI.WinForms;
namespace Pilz.Plugins.Advanced.UI.Telerik;
namespace Pilz.Plugins.Advanced.UI.WinForms.Telerik;
public class RadPluginModuleUI : RadFlyoutBase, ILoadContent
{

View File

@@ -1,4 +1,4 @@
namespace Pilz.Plugins.Advanced.UI;
namespace Pilz.Plugins.Advanced.UI.WinForms;
public enum ControlExecuteReason
{

View File

@@ -1,6 +1,6 @@
using System.Text.RegularExpressions;
namespace Pilz.Plugins.Advanced.UI;
namespace Pilz.Plugins.Advanced.UI.WinForms;
internal class ControlListener(IEnumerable<ControlListenerFeature> features, Control control, bool recursive) : IControlListener
{

View File

@@ -1,4 +1,4 @@
namespace Pilz.Plugins.Advanced.UI;
namespace Pilz.Plugins.Advanced.UI.WinForms;
internal class ControlListenerDummy(IEnumerable<ControlListenerFeature> features, Control control, bool recursive) : ControlListener(features, control, recursive)
{

View File

@@ -1,4 +1,4 @@
namespace Pilz.Plugins.Advanced.UI;
namespace Pilz.Plugins.Advanced.UI.WinForms;
public abstract class ControlListenerFeature : PluginFeature
{

View File

@@ -1,4 +1,4 @@
namespace Pilz.Plugins.Advanced.UI;
namespace Pilz.Plugins.Advanced.UI.WinForms;
public class ControlParameters(Control? control) : PluginFunctionParameter
{

View File

@@ -1,20 +1,20 @@
namespace Pilz.Plugins.Advanced.UI.Extensions;
namespace Pilz.Plugins.Advanced.UI.WinForms.Extensions;
public static class PluginFeatureControllerExtensions
{
public static IControlListener ApplyControlManager(this PluginFeatureController @this, string featureType, Control control)
{
return ApplyControlManager(@this, featureType, control, true, true);
return @this.ApplyControlManager(featureType, control, true, true);
}
public static IControlListener ApplyControlManager(this PluginFeatureController @this, string featureType, Control control, PluginFunctionParameter? parameter)
{
return ApplyControlManager(@this, featureType, control, true, true, parameter);
return @this.ApplyControlManager(featureType, control, true, true, parameter);
}
public static IControlListener ApplyControlManager(this PluginFeatureController @this, string featureType, Control control, bool recursive, bool autoTrack)
{
return ApplyControlManager(@this, featureType, control, recursive, autoTrack, null);
return @this.ApplyControlManager(featureType, control, recursive, autoTrack, null);
}
public static IControlListener ApplyControlManager(this PluginFeatureController @this, string featureType, Control control, bool recursive, bool autoTrack, PluginFunctionParameter? parameter)

View File

@@ -1,4 +1,4 @@
namespace Pilz.Plugins.Advanced.UI;
namespace Pilz.Plugins.Advanced.UI.WinForms;
[Flags]
public enum FeatureInsertMode

View File

@@ -1,4 +1,4 @@
namespace Pilz.Plugins.Advanced.UI;
namespace Pilz.Plugins.Advanced.UI.WinForms;
[Flags]
public enum FeatureInsertPosition

View File

@@ -1,4 +1,4 @@
namespace Pilz.Plugins.Advanced.UI;
namespace Pilz.Plugins.Advanced.UI.WinForms;
public interface IControlListener
{

View File

@@ -9,12 +9,12 @@
</PropertyGroup>
<PropertyGroup>
<Version>1.8.3</Version>
<Version>1.9.0</Version>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Pilz.Plugins.Advanced\Pilz.Plugins.Advanced.csproj" />
<ProjectReference Include="..\Pilz.UI\Pilz.UI.csproj" />
<ProjectReference Include="..\Pilz.UI.WinForms\Pilz.UI.WinForms.csproj" />
</ItemGroup>
</Project>

View File

@@ -1,7 +1,7 @@
using Pilz.UI.Dialogs;
using Pilz.UI.Extensions;
using Pilz.UI.WinForms.Extensions;
namespace Pilz.Plugins.Advanced.UI;
namespace Pilz.Plugins.Advanced.UI.WinForms;
public abstract class PluginModule : PluginModule<PluginModuleUI>
{

View File

@@ -1,7 +1,7 @@
using Pilz.UI;
using Pilz.UI.Dialogs;
using Pilz.UI.WinForms;
using Pilz.UI.WinForms.Dialogs;
namespace Pilz.Plugins.Advanced.UI;
namespace Pilz.Plugins.Advanced.UI.WinForms;
public partial class PluginModuleUI : FlyoutBase, ILoadContent
{

View File

@@ -1,4 +1,4 @@
namespace Pilz.Plugins.Advanced.UI;
namespace Pilz.Plugins.Advanced.UI.WinForms;
public abstract class PluginModule<TPluginModuleUI> : PluginModuleBase where TPluginModuleUI : Control
{

View File

@@ -1,6 +1,6 @@
using System.Reflection;
namespace Pilz.UI.Telerik.Symbols.Factories;
namespace Pilz.UI.WinForms.Telerik.Symbols.Factories;
public class BasicFactory<T>(string baseName) : RadSymbolFactory<T> where T : Enum
{

View File

@@ -8,7 +8,7 @@
</PropertyGroup>
<PropertyGroup>
<Version>1.0.10</Version>
<Version>1.2.0</Version>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
</PropertyGroup>
@@ -17,7 +17,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Pilz.UI.Telerik\Pilz.UI.Telerik.csproj" />
<ProjectReference Include="..\Pilz.UI.WinForms.Telerik\Pilz.UI.WinForms.Telerik.csproj" />
</ItemGroup>
</Project>

View File

@@ -1,7 +1,7 @@
using Pilz.SymbolPacks.Sets;
using Pilz.UI.Telerik.Symbols.Factories;
namespace Pilz.UI.Telerik.Symbols;
namespace Pilz.UI.WinForms.Telerik.Symbols;
public static class RadSymbols
{

View File

@@ -1,7 +1,7 @@
//using System.Linq;
using Telerik.WinControls;
namespace Pilz.UI.Telerik.Controls.RadValidationProvider;
namespace Pilz.UI.WinForms.Telerik.Controls.RadValidationProvider;
/// <summary>

View File

@@ -5,7 +5,7 @@ using Telerik.WinControls;
//using System.Linq;
using Telerik.WinControls.Data;
namespace Pilz.UI.Telerik.Controls.RadValidationProvider;
namespace Pilz.UI.WinForms.Telerik.Controls.RadValidationProvider;
/// <summary>
/// RadCompositeValidationRule evaluates two or more RadValidationRules or RadValidationRuleWithTargetControl
@@ -30,14 +30,12 @@ public class RadCompositeValidationRuleEx : CompositeFilterDescriptor, IRadValid
List<Control> controls = [];
foreach (IRadValidationRuleEx validationRule in ValidationRules)
{
foreach (Control control in validationRule.Controls)
foreach (var control in validationRule.Controls)
{
if (!controls.Contains(control))
{
controls.Add(control);
}
}
}
return controls;
}
@@ -58,18 +56,14 @@ public class RadCompositeValidationRuleEx : CompositeFilterDescriptor, IRadValid
public virtual void AddControl(RadControl control)
{
if (control == null)
{
return;
}
foreach (IRadValidationRuleEx validationRule in ValidationRules)
{
if (!validationRule.Controls.Contains(control))
{
validationRule.AddControl(control);
}
}
}
/// <summary>
/// <para>Removes the specified RadControl descendant from this rule and from all controls in ValidationRules collection .</para>
@@ -78,9 +72,7 @@ public class RadCompositeValidationRuleEx : CompositeFilterDescriptor, IRadValid
public void RemoveControl(RadControl control)
{
if (control == null)
{
return;
}
foreach (IRadValidationRuleEx validationRule in ValidationRules)
{

View File

@@ -1,7 +1,7 @@
using Telerik.WinControls;
using Telerik.WinControls.UI;
namespace Pilz.UI.Telerik.Controls.RadValidationProvider;
namespace Pilz.UI.WinForms.Telerik.Controls.RadValidationProvider;
public delegate void RadValidationEventHandlerEx(object sender, RadValidationEventArgsEx e);

View File

@@ -11,7 +11,7 @@ using Telerik.WinControls.Data;
using Telerik.WinControls.Design;
using Telerik.WinControls.UI;
namespace Pilz.UI.Telerik.Controls.RadValidationProvider;
namespace Pilz.UI.WinForms.Telerik.Controls.RadValidationProvider;
/// <summary>
/// Provides a validation management for RadControl descendant editors.

View File

@@ -3,7 +3,7 @@ using System.Drawing.Design;
using Telerik.WinControls;
using Telerik.WinControls.Data;
namespace Pilz.UI.Telerik.Controls.RadValidationProvider;
namespace Pilz.UI.WinForms.Telerik.Controls.RadValidationProvider;
/// <summary>
/// RadValidationRule provides a validation logic which compares RadControl's Property with Rule's Value.
@@ -42,10 +42,8 @@ public class RadValidationRuleEx : FilterDescriptor, IRadValidationRuleEx
public virtual void AddControl(RadControl control)
{
if (control != null && !controls.Contains(control))
{
controls.Add(control);
}
}
/// <summary>
/// <para>Removes the specified RadControl descendant from this rule.</para>
@@ -54,9 +52,7 @@ public class RadValidationRuleEx : FilterDescriptor, IRadValidationRuleEx
public virtual void RemoveControl(RadControl control)
{
if (control == null)
{
return;
}
while (controls.Contains(control))
{
@@ -120,8 +116,8 @@ public class RadValidationRuleEx : FilterDescriptor, IRadValidationRuleEx
[DefaultValue(false)]
public bool AutoToolTip
{
get { return this.autoToolTip; }
set { this.autoToolTip = value; }
get { return autoToolTip; }
set { autoToolTip = value; }
}
/// <summary>
@@ -130,8 +126,8 @@ public class RadValidationRuleEx : FilterDescriptor, IRadValidationRuleEx
[DefaultValue("Validation Failed")]
public string ToolTipTitle
{
get { return this.toolTipTitle; }
set { this.toolTipTitle = value; }
get { return toolTipTitle; }
set { toolTipTitle = value; }
}
@@ -141,8 +137,8 @@ public class RadValidationRuleEx : FilterDescriptor, IRadValidationRuleEx
[DefaultValue(false)]
public bool CaseSensitive
{
get { return this.caseSensitive; }
set { this.caseSensitive = value; }
get { return caseSensitive; }
set { caseSensitive = value; }
}
/// <summary>

View File

@@ -2,7 +2,7 @@
using Telerik.WinControls.Data;
//using System.Linq;
namespace Pilz.UI.Telerik.Controls.RadValidationProvider;
namespace Pilz.UI.WinForms.Telerik.Controls.RadValidationProvider;
/// <summary>
@@ -29,8 +29,8 @@ public class RadValidationRuleWithTargetControlEx : RadValidationRuleEx
[DefaultValue("Text")]
public string TargetControlPropertyName
{
get { return this.sourceControlPropertyName; }
set { this.sourceControlPropertyName = value; }
get { return sourceControlPropertyName; }
set { sourceControlPropertyName = value; }
}
/// <summary>
@@ -41,10 +41,8 @@ public class RadValidationRuleWithTargetControlEx : RadValidationRuleEx
{
get
{
if (this.TargetControl != null)
{
this.Value = this.CalculateValue();
}
if (TargetControl != null)
Value = CalculateValue();
return base.Expression;
}
@@ -60,7 +58,7 @@ public class RadValidationRuleWithTargetControlEx : RadValidationRuleEx
{
get
{
if (this.TargetControl != null && !string.IsNullOrEmpty(this.TargetControlPropertyName))
if (TargetControl != null && !string.IsNullOrEmpty(TargetControlPropertyName))
{
try
{
@@ -80,12 +78,10 @@ public class RadValidationRuleWithTargetControlEx : RadValidationRuleEx
protected virtual object CalculateValue()
{
if (this.TargetControl.Site != null)
{
return string.Format("{0}.{1}", this.TargetControl.Name, this.TargetControlPropertyName);
}
if (TargetControl.Site != null)
return string.Format("{0}.{1}", TargetControl.Name, TargetControlPropertyName);
if (!string.IsNullOrEmpty(this.TargetControlPropertyName))
if (!string.IsNullOrEmpty(TargetControlPropertyName))
{
try
{

View File

@@ -1,4 +1,6 @@
namespace Pilz.UI.Telerik.Dialogs;
using Pilz.UI.Telerik.Dialogs;
namespace Pilz.UI.WinForms.Telerik.Dialogs;
public class DialogClosedEventArgs : EventArgs
{

View File

@@ -1,4 +1,6 @@
namespace Pilz.UI.Telerik.Dialogs;
using Pilz.UI.Telerik.Dialogs;
namespace Pilz.UI.WinForms.Telerik.Dialogs;
public class DialogLoadingEventArgs : EventArgs
{

View File

@@ -1,4 +1,6 @@
namespace Pilz.UI.Telerik.Dialogs;
using Pilz.UI.Telerik.Dialogs;
namespace Pilz.UI.WinForms.Telerik.Dialogs;
public class FlyoutClosedEventArgs(RadFlyoutBase content) : global::Telerik.WinControls.UI.SplashScreen.FlyoutClosedEventArgs(content)
{

View File

@@ -1,6 +1,7 @@
using Telerik.WinControls.UI.SplashScreen;
using Pilz.UI.Telerik.Dialogs;
using Telerik.WinControls.UI.SplashScreen;
namespace Pilz.UI.Telerik.Dialogs;
namespace Pilz.UI.WinForms.Telerik.Dialogs;
public class FlyoutCreatedEventArgs(RadFlyoutBase content) : ContentCreatedEventArgs(content)
{

View File

@@ -1,5 +1,6 @@
using Pilz.UI.Extensions;
using Pilz.UI.Telerik.Extensions;
using Pilz.UI.WinForms.Extensions;
using Pilz.UI.WinForms.Telerik.Dialogs;
using Pilz.UI.WinForms.Telerik.Extensions;
using Telerik.WinControls;
namespace Pilz.UI.Telerik.Dialogs;

View File

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

View File

@@ -1,4 +1,6 @@
using Telerik.WinControls;
using Pilz.UI.WinForms;
using Pilz.UI.WinForms.Telerik.Dialogs;
using Telerik.WinControls;
using Telerik.WinControls.UI;
using Telerik.WinControls.UI.SplashScreen;

View File

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

View File

@@ -1,6 +1,6 @@
using Pilz.UI.Telerik.Dialogs;
namespace Pilz.UI.Telerik.Extensions.Extensions;
namespace Pilz.UI.WinForms.Telerik.Extensions;
public static class RadFlyoutBaseExtensions
{

View File

@@ -1,17 +1,17 @@
using Telerik.WinControls.UI;
namespace Pilz.UI.Telerik.Extensions;
namespace Pilz.UI.WinForms.Telerik.Extensions;
public static class RadListDataItemCollectionExtensions
{
public static IEnumerable<RadListDataItem> AddEnumValues<T>(this RadListDataItemCollection @this) where T : struct, Enum
{
return AddEnumValues<T>(@this, false);
return @this.AddEnumValues<T>(false);
}
public static IEnumerable<RadListDataItem> AddEnumValues<T>(this RadListDataItemCollection @this, bool clearCollection) where T : struct, Enum
{
return AddEnumValues<T>(@this, clearCollection, null, null);
return @this.AddEnumValues<T>(clearCollection, null, null);
}
public static IEnumerable<RadListDataItem> AddEnumValues<T>(this RadListDataItemCollection @this, bool clearCollection, Func<T, bool>? filter, Func<T, string?>? format) where T : struct, Enum

View File

@@ -1,7 +1,7 @@
using Telerik.WinControls;
using Telerik.WinControls.Svg;
namespace Pilz.UI.Telerik.Extensions;
namespace Pilz.UI.WinForms.Telerik.Extensions;
public static class RadSvgImageExtensions
{

View File

@@ -1,7 +1,7 @@
using HarmonyLib;
using System.Reflection;
namespace Pilz.UI.Telerik.Patches;
namespace Pilz.UI.WinForms.Telerik.Patches;
public static class Patches
{

View File

@@ -1,7 +1,7 @@
using HarmonyLib;
using Telerik.WinControls.UI;
namespace Pilz.UI.Telerik.Patches.TelerikUiForWinForms;
namespace Pilz.UI.WinForms.Telerik.Patches.TelerikUiForWinForms;
[HarmonyPatch(typeof(RadPictureBoxElement))]
[HarmonyPatch("PasteImage")]

View File

@@ -9,7 +9,7 @@
</PropertyGroup>
<PropertyGroup>
<Version>2.10.9</Version>
<Version>2.12.0</Version>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
</PropertyGroup>
@@ -23,7 +23,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Pilz.UI\Pilz.UI.csproj" />
<ProjectReference Include="..\Pilz.UI.WinForms\Pilz.UI.WinForms.csproj" />
</ItemGroup>
</Project>

View File

@@ -1,7 +1,7 @@
using Pilz.UI.Symbols;
using Pilz.UI.WinForms.Symbols;
using Telerik.WinControls;
namespace Pilz.UI.Telerik.Symbols;
namespace Pilz.UI.WinForms.Telerik.Symbols;
public interface IRadSymbolFactory<TSymbols> : ISymbolFactory<TSymbols>
{

View File

@@ -1,8 +1,8 @@
using Pilz.UI.Symbols;
using Pilz.UI.Telerik.Extensions;
using Pilz.UI.WinForms.Symbols;
using Pilz.UI.WinForms.Telerik.Extensions;
using Telerik.WinControls;
namespace Pilz.UI.Telerik.Symbols;
namespace Pilz.UI.WinForms.Telerik.Symbols;
public abstract class RadSymbolFactory<TSymbols> : SymbolFactory<TSymbols>, IRadSymbolFactory<TSymbols>
{

View File

@@ -1,4 +1,4 @@
namespace Pilz.UI.Telerik.Theming;
namespace Pilz.UI.WinForms.Telerik.Theming;
public enum ApplicationTheme
{

View File

@@ -1,4 +1,4 @@
namespace Pilz.UI.Telerik.Theming;
namespace Pilz.UI.WinForms.Telerik.Theming;
public enum HighContrastMode
{

View File

@@ -1,4 +1,4 @@
namespace Pilz.UI.Telerik.Theming;
namespace Pilz.UI.WinForms.Telerik.Theming;
public class ThemeDefinition
{

View File

@@ -1,6 +1,6 @@
using Telerik.WinControls;
namespace Pilz.UI.Telerik.Theming;
namespace Pilz.UI.WinForms.Telerik.Theming;
public static class ThemeHelper
{

View File

@@ -1,4 +1,4 @@
namespace Pilz.UI.Controls.ConfigurationManager;
namespace Pilz.UI.WinForms.Controls.ConfigurationManager;
public class ConfigurationEntry(string name, string title, ConfigurationValueListener Listener)
{

View File

@@ -1,4 +1,4 @@
namespace Pilz.UI.Controls.ConfigurationManager;
namespace Pilz.UI.WinForms.Controls.ConfigurationManager;
public class ConfigurationManager
{

View File

@@ -1,4 +1,4 @@
namespace Pilz.UI.Controls.ConfigurationManager;
namespace Pilz.UI.WinForms.Controls.ConfigurationManager;
public class ConfigurationPanel : TableLayoutPanel
{

View File

@@ -1,4 +1,4 @@
namespace Pilz.UI.Controls.ConfigurationManager;
namespace Pilz.UI.WinForms.Controls.ConfigurationManager;
public abstract class ConfigurationValueListener : IDisposable
{

View File

@@ -1,4 +1,6 @@
namespace Pilz.UI.Dialogs;
using Pilz.UI.WinForms.Dialogs;
namespace Pilz.UI.Dialogs;
partial class DialogBase
{

View File

@@ -1,4 +1,7 @@
namespace Pilz.UI.Dialogs;
using Pilz.UI.WinForms;
using Pilz.UI.WinForms.Dialogs;
namespace Pilz.UI.Dialogs;
public partial class DialogBase : Form
{

View File

@@ -1,4 +1,6 @@
namespace Pilz.UI.Dialogs;
using Pilz.UI.Dialogs;
namespace Pilz.UI.WinForms.Dialogs;
public class DialogClosedEventArgs(DialogBase dialog) : EventArgs
{

View File

@@ -1,4 +1,6 @@
namespace Pilz.UI.Dialogs;
using Pilz.UI.Dialogs;
namespace Pilz.UI.WinForms.Dialogs;
public class DialogLoadingEventArgs(DialogBase dialog) : EventArgs
{

View File

@@ -1,7 +1,8 @@
using System.ComponentModel;
using Pilz.UI.Dialogs;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
namespace Pilz.UI.Dialogs;
namespace Pilz.UI.WinForms.Dialogs;
public partial class FlyoutBase : UserControl
{

View File

@@ -1,7 +1,7 @@
using System.Drawing;
using System.Drawing.Drawing2D;
namespace Pilz.UI;
namespace Pilz.UI.WinForms;
public class DisplayHelp
{
@@ -211,7 +211,7 @@ public class DisplayHelp
if (cornerDiameter == 0)
cornerDiameter = 1;
int diameter = cornerDiameter * 2;
var diameter = cornerDiameter * 2;
return corner switch
{

View File

@@ -1,4 +1,4 @@
namespace Pilz.UI.Extensions;
namespace Pilz.UI.WinForms.Extensions;
public static class DialogResultExtensions
{

View File

@@ -1,7 +1,7 @@
using Pilz.UI.Dialogs;
using Pilz.UI.WinForms.Dialogs;
using System.Diagnostics.CodeAnalysis;
namespace Pilz.UI.Extensions;
namespace Pilz.UI.WinForms.Extensions;
public static class FlyoutBaseExtensions
{

View File

@@ -1,4 +1,4 @@
namespace Pilz.UI.Extensions;
namespace Pilz.UI.WinForms.Extensions;
public static class ImageExtensions
{

View File

@@ -1,7 +1,7 @@
using System.Diagnostics;
using System.Windows.Forms;
namespace Pilz.UI;
namespace Pilz.UI.WinForms;
public static class HelpfulFunctions
{

View File

@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
namespace Pilz.UI;
namespace Pilz.UI.WinForms;
internal class HighlightPanel : Control
@@ -28,9 +28,9 @@ internal class HighlightPanel : Control
var g = e.Graphics;
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
foreach (HighlightRegion highlightRegion in _HighlightRegions)
foreach (var highlightRegion in _HighlightRegions)
{
Color[] colors = GetHighlightColors(highlightRegion.HighlightColor);
var colors = GetHighlightColors(highlightRegion.HighlightColor);
var r = highlightRegion.Bounds;
var back = highlightRegion.BackColor;
r.Inflate(1, 1);
@@ -48,7 +48,7 @@ internal class HighlightPanel : Control
private Color[] GetHighlightColors(eHighlightColor color)
{
Color[] colors = new Color[3];
var colors = new Color[3];
if (color == eHighlightColor.Blue)
{
@@ -129,10 +129,10 @@ internal class HighlightPanel : Control
return;
}
bool processFocusControl = true;
var processFocusControl = true;
Region region = null;
foreach (KeyValuePair<Control, eHighlightColor> item in _Highlights)
foreach (var item in _Highlights)
{
if (item.Value == eHighlightColor.None || !GetIsVisible(item.Key))
continue;
@@ -221,13 +221,13 @@ internal class HighlightPanel : Control
return false;
if (control.Parent is null || !control.IsHandleCreated)
return control.Visible;
var rect = new Pilz.Win32.Native.RECT();
Pilz.Win32.Native.User32.GetWindowRect(control.Handle, ref rect);
var rect = new Win32.Native.RECT();
Win32.Native.User32.GetWindowRect(control.Handle, ref rect);
var pp = control.Parent.PointToClient(new Point(rect.Left + 3, rect.Top + 3));
var handle = Pilz.Win32.Native.User32.ChildWindowFromPointEx(control.Parent.Handle, new Pilz.Win32.Native.POINT(pp.X, pp.Y), (uint)Pilz.Win32.Native.WindowFromPointFlags.CWP_SKIPINVISIBLE);
if (handle == IntPtr.Zero)
var handle = Win32.Native.User32.ChildWindowFromPointEx(control.Parent.Handle, new Win32.Native.POINT(pp.X, pp.Y), (uint)Win32.Native.WindowFromPointFlags.CWP_SKIPINVISIBLE);
if (handle == nint.Zero)
return control.Visible;
var c = Control.FromHandle(handle);
var c = FromHandle(handle);
if (c is not null && !ReferenceEquals(c, control) && !ReferenceEquals(c, this) && !ReferenceEquals(c, control.Parent))
return false;
@@ -259,9 +259,9 @@ internal class HighlightPanel : Control
{
if (!c.IsHandleCreated)
return Rectangle.Empty;
var rect = default(Pilz.Win32.Native.RECT);
Pilz.Win32.Native.User32.GetWindowRect(c.Handle, ref rect);
var p = this.PointToClient(rect.Location);
var rect = default(Win32.Native.RECT);
Win32.Native.User32.GetWindowRect(c.Handle, ref rect);
var p = PointToClient(rect.Location);
return new Rectangle(p, rect.Size);
}

View File

@@ -11,7 +11,7 @@ using System.Drawing;
// Imports System.Windows.Forms
using System.Windows.Forms;
namespace Pilz.UI;
namespace Pilz.UI.WinForms;
public class Highlighter : Component
@@ -172,14 +172,14 @@ public class Highlighter : Component
private void ControlParentChanged(object sender, EventArgs e)
{
Control c = (Control)sender;
var c = (Control)sender;
c.ParentChanged -= ControlParentChanged;
AddTabControlHandlers(c);
}
private void AddTabControlHandlers(Control c)
{
TabControl tab2 = GetParentControl(c, typeof(TabControl)) as TabControl;
var tab2 = GetParentControl(c, typeof(TabControl)) as TabControl;
if (tab2 is not null)
{
@@ -194,7 +194,7 @@ public class Highlighter : Component
}
else
{
Panel parentPanel = GetParentControl(c, typeof(Panel)) as Panel;
var parentPanel = GetParentControl(c, typeof(Panel)) as Panel;
if (parentPanel is not null)
{
@@ -272,7 +272,7 @@ public class Highlighter : Component
c.LocationChanged -= new EventHandler(ControlLocationChanged);
c.SizeChanged -= new EventHandler(ControlSizeChanged);
c.VisibleChanged -= new EventHandler(ControlVisibleChanged);
TabControl tab2 = GetParentControl(c, typeof(TabControl)) as TabControl;
var tab2 = GetParentControl(c, typeof(TabControl)) as TabControl;
if (tab2 is not null)
{
@@ -293,7 +293,7 @@ public class Highlighter : Component
}
else
{
Panel parentPanel = GetParentControl(c, typeof(Panel)) as Panel;
var parentPanel = GetParentControl(c, typeof(Panel)) as Panel;
if (parentPanel is not null)
{
@@ -419,7 +419,7 @@ public class Highlighter : Component
{
if (_HighlightPanel.Parent is Form)
{
Form form = _HighlightPanel.Parent as Form;
var form = _HighlightPanel.Parent as Form;
if (form.AutoSize)
{
@@ -445,7 +445,7 @@ public class Highlighter : Component
private void ContainerControlSizeChanged(object sender, EventArgs e)
{
Form form = sender as Form;
var form = sender as Form;
if (form is not null)
{

View File

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

View File

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

View File

@@ -1,7 +1,7 @@
using System.Drawing;
using System.Drawing.Drawing2D;
namespace Pilz.UI;
namespace Pilz.UI.WinForms.PaintingControl;
public class ArrowLineCapProps : LineCapProps
{

View File

@@ -1,10 +1,11 @@
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;
namespace Pilz.UI.WinForms.PaintingControl;
/// <summary>
@@ -44,7 +45,7 @@ public class DefaultDrawMethodes
RectangleF result;
Bitmap image;
SizeF zoomf;
bool hasNoParent = e.PaintingObject.Parent is null;
var hasNoParent = e.PaintingObject.Parent is null;
object syncObj;
if (hasNoParent)
@@ -74,7 +75,7 @@ public class DefaultDrawMethodes
if (image is null)
{
bool needRescaleImageBecauseRot = false;
var needRescaleImageBecauseRot = false;
image = DrawToNewImage((Bitmap)objImg, result.Size);
@@ -162,10 +163,10 @@ public class DefaultDrawMethodes
var objrect = new RectangleF(obj.Location, obj.Size);
var size = new SizeF(imageSize.Width * zoom.Width, imageSize.Height * zoom.Height);
var clientRectangle = objrect;
float val = clientRectangle.Width / size.Width;
var val = clientRectangle.Width / size.Width;
clientRectangle = objrect;
float num = Math.Min(val, clientRectangle.Height / size.Height);
var num = Math.Min(val, clientRectangle.Height / size.Height);
result.Width = (int)Math.Round(Math.Truncate((double)(size.Width * num)));
result.Height = (int)Math.Round(Math.Truncate((double)(size.Height * num)));
@@ -195,7 +196,7 @@ public class DefaultDrawMethodes
if (obj.EnableOutline)
{
float lw = obj.OutlineThicknes;
var lw = obj.OutlineThicknes;
var p = new Pen(obj.OutlineColor, obj.OutlineThicknes) { DashStyle = obj.OutlineDashStyle, Alignment = PenAlignment.Inset };
e.Graphics.DrawPolygon(p, new[] { p1, p2, p3 });
}
@@ -204,7 +205,7 @@ public class DefaultDrawMethodes
public static void DrawRectangle(PaintingObjectPaintEventArgs e)
{
var obj = e.PaintingObject;
float hol = obj.OutlineThicknes / 2f;
var hol = obj.OutlineThicknes / 2f;
if (obj.EnableFill)
{
@@ -243,10 +244,10 @@ public class DefaultDrawMethodes
public static void DrawSelection(PaintingObjectPaintEventArgs e)
{
var obj = e.PaintingObject;
float lw = 2.5f;
float hlw = lw / 2f;
float hlwphol = hlw; // + hol
float hlwpholm2 = hlwphol * 2f;
var lw = 2.5f;
var hlw = lw / 2f;
var hlwphol = hlw; // + hol
var hlwpholm2 = hlwphol * 2f;
var p = new Pen(Color.CornflowerBlue, lw) { DashStyle = obj.SelectionDashStyle, Alignment = PenAlignment.Outset };
var rect = new Rectangle((int)Math.Round(e.X - hlwphol), (int)Math.Round(e.Y - hlwphol), (int)Math.Round(obj.Size.Width + hlwpholm2), (int)Math.Round(obj.Size.Height + hlwpholm2));
@@ -257,14 +258,14 @@ public class DefaultDrawMethodes
{
var p = new Pen(pc.GridColor, 0.5f);
int curX = (int)Math.Round(pc.GridChunkSize.Width * pc.ZoomFactor.Width - offset.X);
var curX = (int)Math.Round(pc.GridChunkSize.Width * pc.ZoomFactor.Width - offset.X);
while (curX < pc.Width)
{
e.Graphics.DrawLine(p, curX, -offset.Y, curX, pc.Height);
curX = (int)Math.Round(curX + pc.GridChunkSize.Width * pc.ZoomFactor.Width);
}
int curY = (int)Math.Round(pc.GridChunkSize.Height * pc.ZoomFactor.Height - offset.Y);
var curY = (int)Math.Round(pc.GridChunkSize.Height * pc.ZoomFactor.Height - offset.Y);
while (curY < pc.Height)
{
e.Graphics.DrawLine(p, -offset.X, curY, pc.Width, curY);

View File

@@ -1,6 +1,6 @@
using System.Drawing.Drawing2D;
namespace Pilz.UI;
namespace Pilz.UI.WinForms.PaintingControl;
public class DefaultLineCapProps : LineCapProps

View File

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

View File

@@ -1,7 +1,7 @@
using System;
using System.Drawing;
namespace Pilz.UI;
namespace Pilz.UI.WinForms.PaintingControl.EventArgs;
public class PaintingObjectPaintEventArgs(PaintingObject obj, Graphics g, PointF offset) : EventArgs
{

View File

@@ -1,5 +1,4 @@

namespace Pilz.UI;
namespace Pilz.UI.WinForms.PaintingControl;
public interface IPaintingObjectContainer
{

View File

@@ -1,5 +1,4 @@

namespace Pilz.UI;
namespace Pilz.UI.WinForms.PaintingControl;
public class PaintingObjectImageProperties
{

View File

@@ -1,6 +1,6 @@
using System.Drawing.Drawing2D;
namespace Pilz.UI;
namespace Pilz.UI.WinForms.PaintingControl;
public class LineCapConfigurationArgs

View File

@@ -1,5 +1,4 @@

namespace Pilz.UI;
namespace Pilz.UI.WinForms.PaintingControl;
public abstract class LineCapProps
{

View File

@@ -1,4 +1,6 @@
using Pilz.Drawing;
using Pilz.UI.WinForms.PaintingControl.EventArgs;
using Pilz.UI.WinForms.Utilities;
using System;
using System.Collections;
using System.Collections.Generic;
@@ -9,7 +11,7 @@ using System.Drawing.Drawing2D;
using System.Linq;
using System.Windows.Forms;
namespace Pilz.UI;
namespace Pilz.UI.WinForms.PaintingControl;
public class PaintingControl : UserControl, IPaintingObjectContainer
@@ -79,7 +81,7 @@ public class PaintingControl : UserControl, IPaintingObjectContainer
{
var objs = new List<PaintingObject>();
foreach (PaintingObject obj in PaintingObjects)
foreach (var obj in PaintingObjects)
{
if (obj.Selected)
objs.Add(obj);
@@ -173,7 +175,7 @@ public class PaintingControl : UserControl, IPaintingObjectContainer
private void ResetAllBufferedImages()
{
foreach (PaintingObject ob in PaintingObjects)
foreach (var ob in PaintingObjects)
ob.ResetImageBuffer();
Refresh();
}
@@ -195,7 +197,7 @@ public class PaintingControl : UserControl, IPaintingObjectContainer
protected void CheckMouseClick(object sender, MouseEventArgs e)
{
foreach (PaintingObject obj in GetObjects(new Point((int)Math.Round(e.X + Offset.X), (int)Math.Round(e.Y + Offset.Y))))
foreach (var obj in GetObjects(new Point((int)Math.Round(e.X + Offset.X), (int)Math.Round(e.Y + Offset.Y))))
{
if (!obj.MouseTransparency)
obj.RaiseMouseClick(GetMouseEventArgs(e, obj));
@@ -211,10 +213,10 @@ public class PaintingControl : UserControl, IPaintingObjectContainer
if (curObjMouseDown is null || !curObjMouseDown.Selected || pressedControl)
{
bool hasMovedObjects = false;
var hasMovedObjects = false;
if (IsMovingObjects)
{
foreach (PaintingObject obj in GetSelectedObjects())
foreach (var obj in GetSelectedObjects())
{
if (HelpfulDrawingFunctions.IsPointInRectangle(lastMousePos, obj.Rectangle))
{
@@ -230,7 +232,7 @@ public class PaintingControl : UserControl, IPaintingObjectContainer
if (AutoRemoveSelection && !pressedControl)
{
foreach (PaintingObject obj in PaintingObjects)
foreach (var obj in PaintingObjects)
{
if (obj.Selected)
{
@@ -306,7 +308,7 @@ public class PaintingControl : UserControl, IPaintingObjectContainer
if (IsMovingObjects)
{
IsMovingObjects = false;
foreach (PaintingObject obj in GetSelectedObjects())
foreach (var obj in GetSelectedObjects())
obj.RaiseMoved(new EventArgs());
AutoArrangeToGrid();
}
@@ -337,7 +339,7 @@ public class PaintingControl : UserControl, IPaintingObjectContainer
if (IsMovingObjects)
UpdateObjectPositions(e);
foreach (PaintingObject obj in GetObjects(new Point((int)Math.Round(e.X + Offset.X), (int)Math.Round(e.Y + Offset.Y))))
foreach (var obj in GetObjects(new Point((int)Math.Round(e.X + Offset.X), (int)Math.Round(e.Y + Offset.Y))))
{
if (!obj.MouseTransparency)
obj.RaiseMouseMove(GetMouseEventArgs(e, obj));
@@ -381,7 +383,7 @@ public class PaintingControl : UserControl, IPaintingObjectContainer
{
var objs = new List<PaintingObject>();
foreach (PaintingObject obj in PaintingObjects)
foreach (var obj in PaintingObjects)
{
if (obj.Selected)
objs.Add(obj);
@@ -416,7 +418,7 @@ public class PaintingControl : UserControl, IPaintingObjectContainer
SuspendDrawing();
foreach (PaintingObject obj in objs)
foreach (var obj in objs)
{
var sp = savedPos[obj];
@@ -438,7 +440,7 @@ public class PaintingControl : UserControl, IPaintingObjectContainer
private bool UpdateObjectPosition(MouseEventArgs e, PaintingObject obj, PointF sp)
{
bool moved = false;
var moved = false;
var cancel = new CancelEventArgs(false);
obj.RaiseMovingBeforePositionUpdated(cancel);
@@ -454,7 +456,7 @@ public class PaintingControl : UserControl, IPaintingObjectContainer
private bool IsResizingObjs(IList<PaintingObject> objs)
{
foreach (PaintingObject obj in objs)
foreach (var obj in objs)
{
if (obj.IsResizing)
return true;
@@ -471,7 +473,7 @@ public class PaintingControl : UserControl, IPaintingObjectContainer
{
PaintingObject val = null;
for (int i = PaintingObjects.Count - 1; i >= 0; i -= 1)
for (var i = PaintingObjects.Count - 1; i >= 0; i -= 1)
{
var obj = PaintingObjects[i];
@@ -496,7 +498,7 @@ public class PaintingControl : UserControl, IPaintingObjectContainer
{
var objs = new List<PaintingObject>();
foreach (PaintingObject obj in PaintingObjects)
foreach (var obj in PaintingObjects)
{
if (HelpfulDrawingFunctions.IsPointInRectangle(p, obj.RectangleExtended))
objs.Add(obj);
@@ -514,7 +516,7 @@ public class PaintingControl : UserControl, IPaintingObjectContainer
{
var objs = new List<PaintingObject>();
foreach (PaintingObject obj in PaintingObjects)
foreach (var obj in PaintingObjects)
{
var objRect = obj.Rectangle;
if (HelpfulDrawingFunctions.IsPointInRectangle(objRect.Location, rect) || HelpfulDrawingFunctions.IsPointInRectangle(objRect.Location + objRect.Size, rect) || HelpfulDrawingFunctions.IsPointInRectangle(new PointF(objRect.Left, objRect.Bottom), rect) || HelpfulDrawingFunctions.IsPointInRectangle(new PointF(objRect.Right, objRect.Top), rect))
@@ -586,7 +588,7 @@ public class PaintingControl : UserControl, IPaintingObjectContainer
var baserect = new RectangleF(Offset, Size);
foreach (PaintingObject obj in PaintingObjects)
foreach (var obj in PaintingObjects)
{
if (obj.Visible && HelpfulDrawingFunctions.OverlapsTwoRectangles(obj.Rectangle, baserect))
obj.Draw(e, Offset);
@@ -610,7 +612,7 @@ public class PaintingControl : UserControl, IPaintingObjectContainer
public void PaintFullView(Graphics g)
{
foreach (PaintingObject obj in PaintingObjects)
foreach (var obj in PaintingObjects)
{
if (obj.Visible)
obj.Draw(g, PointF.Empty);
@@ -630,7 +632,7 @@ public class PaintingControl : UserControl, IPaintingObjectContainer
private void SelectControlsInArea()
{
var rect = HelpfulDrawingFunctions.GetRectangle(startMousePos, lastMousePos);
foreach (PaintingObject obj in PaintingObjects)
foreach (var obj in PaintingObjects)
obj.Selected = startMousePos.X >= lastMousePos.X ? HelpfulDrawingFunctions.OverlapsTwoRectangles(obj.Rectangle, rect) : HelpfulDrawingFunctions.RectangleContainsRectangle(rect, obj.Rectangle);
}
@@ -640,11 +642,11 @@ public class PaintingControl : UserControl, IPaintingObjectContainer
{
var zoomedGridChunkSize = new SizeF(GridChunkSize.Width * ZoomFactor.Width, GridChunkSize.Height * ZoomFactor.Height);
int modTop = (int)Math.Round(obj.Y % zoomedGridChunkSize.Height);
int modLeft = (int)Math.Round(obj.X % zoomedGridChunkSize.Width);
var modTop = (int)Math.Round(obj.Y % zoomedGridChunkSize.Height);
var modLeft = (int)Math.Round(obj.X % zoomedGridChunkSize.Width);
int halfHeight = (int)Math.Round(zoomedGridChunkSize.Height / 2f);
int halfWidth = (int)Math.Round(zoomedGridChunkSize.Width / 2f);
var halfHeight = (int)Math.Round(zoomedGridChunkSize.Height / 2f);
var halfWidth = (int)Math.Round(zoomedGridChunkSize.Width / 2f);
void zoomLocation(PaintingObject obj2)
{
@@ -665,25 +667,25 @@ public class PaintingControl : UserControl, IPaintingObjectContainer
zoomLocation(obj);
foreach (PaintingObject pinned in obj.PinnedObjects)
foreach (var pinned in obj.PinnedObjects)
zoomLocation(pinned);
int modH = (int)Math.Round(obj.Height % zoomedGridChunkSize.Height);
int modW = (int)Math.Round(obj.Width % zoomedGridChunkSize.Width);
var modH = (int)Math.Round(obj.Height % zoomedGridChunkSize.Height);
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; } } };
zoomSize(obj);
foreach (PaintingObject pinned in obj.PinnedObjects)
foreach (var pinned in obj.PinnedObjects)
zoomSize(pinned);
}
}
public bool IsPinnedObject(PaintingObject o)
{
foreach (PaintingObject obj in PaintingObjects)
foreach (var obj in PaintingObjects)
{
if (obj.PinnedObjects.Contains(o))
return true;
@@ -695,7 +697,7 @@ public class PaintingControl : UserControl, IPaintingObjectContainer
{
if (GridEnabled)
{
foreach (PaintingObject obj in GetSelectedObjects())
foreach (var obj in GetSelectedObjects())
{
if (obj.AutoAlignToGrid)
ArrangeToGrid(obj, false);
@@ -712,15 +714,15 @@ public class PaintingControl : UserControl, IPaintingObjectContainer
public static SizeF GetFullSize(IEnumerable<PaintingObject> objects)
{
float curX = 0f;
float curY = 0f;
var curX = 0f;
var curY = 0f;
foreach (PaintingObject po in objects)
foreach (var po in objects)
{
float myX = po.X + po.Width;
var myX = po.X + po.Width;
if (curX < myX)
curX = myX;
float myY = po.Y + po.Height;
var myY = po.Y + po.Height;
if (curY < myY)
curY = myY;
}
@@ -746,7 +748,7 @@ public class PaintingControl : UserControl, IPaintingObjectContainer
{
if (pressedAlt)
{
float val = (float)(e.Delta / 120d / 10d);
var val = (float)(e.Delta / 120d / 10d);
ZoomFactor = new SizeF((float)Math.Max((double)(ZoomFactor.Width + val), 0.25d), (float)Math.Max((double)(ZoomFactor.Height + val), 0.25d));
Refresh();
}
@@ -761,7 +763,7 @@ public class PaintingControl : UserControl, IPaintingObjectContainer
if (_stopDrawing < 0)
// bufferedImg = New Bitmap(Width, Height)
// DrawToBitmap(bufferedImg, New Rectangle(0, 0, bufferedImg.Width, bufferedImg.Height))
Utils.DrawingControl.SuspendDrawing(this);
DrawingControl.SuspendDrawing(this);
_stopDrawing += 1;
}
@@ -779,7 +781,7 @@ public class PaintingControl : UserControl, IPaintingObjectContainer
// bufferedImg.Dispose()
// bufferedImg = Nothing
// If executeRefresh Then Refresh()
Utils.DrawingControl.ResumeDrawing(this, executeRefresh);
DrawingControl.ResumeDrawing(this, executeRefresh);
}
}

View File

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

View File

@@ -8,7 +8,7 @@ using System.Linq;
using System.Reflection;
using System.Windows.Forms;
namespace Pilz.UI;
namespace Pilz.UI.WinForms.PaintingControl;
[Serializable]
@@ -157,7 +157,7 @@ public class PaintingObject : ICloneable, IPaintingObjectContainer
{
var tt = PaintingObjectType.Custom;
foreach (DelegateDrawPaintingObjectMethode d in DrawMethodes)
foreach (var d in DrawMethodes)
{
if (ReferenceEquals(d.Method.DeclaringType, typeof(DefaultDrawMethodes)))
{
@@ -335,7 +335,7 @@ public class PaintingObject : ICloneable, IPaintingObjectContainer
}
set
{
bool re = !ReferenceEquals(value, _Parent);
var re = !ReferenceEquals(value, _Parent);
_Parent = value;
if (re)
ParentChanged?.Invoke(this, new EventArgs());
@@ -663,7 +663,7 @@ public class PaintingObject : ICloneable, IPaintingObjectContainer
{
var poevargs = new PaintingObjectPaintEventArgs(this, g, offset);
foreach (DelegateDrawPaintingObjectMethode dm in DrawMethodes)
foreach (var dm in DrawMethodes)
{
try
{
@@ -689,12 +689,12 @@ public class PaintingObject : ICloneable, IPaintingObjectContainer
{
var obj = new PaintingObject();
var metype = GetType();
string[] blackField = new[] { nameof(PinnedObjects), nameof(resizeEngine), nameof(_Parent), nameof(BufferedImage), nameof(ImageProperties) };
var blackField = new[] { nameof(PinnedObjects), nameof(resizeEngine), nameof(_Parent), nameof(BufferedImage), nameof(ImageProperties) };
void copyFields(object source, object dest, string[] blackFields, Type t)
{
var fields = new List<FieldInfo>(t.GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.IgnoreCase | BindingFlags.Instance));
foreach (FieldInfo @field in fields)
foreach (var @field in fields)
{
if (!blackFields.Contains(@field.Name))
@field.SetValue(dest, @field.GetValue(source));
@@ -761,10 +761,10 @@ public class PaintingObjectList : List<PaintingObject>
public void AddRange(PaintingObject[] items)
{
foreach (PaintingObject item in items)
foreach (var item in items)
item.Parent = MyParent;
base.AddRange(items);
foreach (PaintingObject item in items)
foreach (var item in items)
item.AutoArrangeToGrid();
if (EnableRaisingEvents)
MyParent?.RaisePaintingObjectAdded(new PaintingObjectEventArgs(items));

View File

@@ -1,5 +1,4 @@

namespace Pilz.UI;
namespace Pilz.UI.WinForms.PaintingControl;
public class PaintingObjectJsonSerializer
{

View File

@@ -1,6 +1,6 @@
using Newtonsoft.Json;
namespace Pilz.UI;
namespace Pilz.UI.WinForms.PaintingControl;
public class PaintingObjectLayering
@@ -46,8 +46,8 @@ public class PaintingObjectLayering
/// <param name="count">The number how many objects it should be moved.</param>
public void MoveObject(int count)
{
int oldIndex = ObjectList.IndexOf(PaintingObject);
int newIndex = oldIndex + count;
var oldIndex = ObjectList.IndexOf(PaintingObject);
var newIndex = oldIndex + count;
MoveObjectTo(newIndex);
}

View File

@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Data;
using System.Linq;
namespace Pilz.UI;
namespace Pilz.UI.WinForms.PaintingControl;
public class PaintingObjectListLayering
{
@@ -59,7 +59,7 @@ public class PaintingObjectListLayering
{
var func = kvp.Value;
foreach (PaintingObject obj in listOld)
foreach (var obj in listOld)
{
if (func(obj))
{
@@ -72,7 +72,7 @@ public class PaintingObjectListLayering
}
// Remove remembered objects
foreach (PaintingObject obj in toRemove)
foreach (var obj in toRemove)
listOld.Remove(obj);
toRemove.Clear();
}

Some files were not shown because too many files have changed in this diff Show More