Убраны синхронные методы

This commit is contained in:
2026-01-25 01:52:03 +03:00
parent 79bdd8bc62
commit a6ee6fcb36
22 changed files with 1108 additions and 2137 deletions

View File

@@ -122,6 +122,15 @@ public class DragInfo : IDisposable, ICloneable
public DragInfo(object data, Enums.DragDropEffects allowedEffects, Point startPosition, object? source = null)
{
Data = data ?? throw new ArgumentNullException(nameof(data));
// Проверка допустимых значений перечисления
if (!Enum.IsDefined(typeof(Enums.DragDropEffects), allowedEffects))
{
throw new ArgumentException(
$"Недопустимое значение для {nameof(allowedEffects)}: {allowedEffects}",
nameof(allowedEffects));
}
AllowedEffects = allowedEffects;
StartPosition = startPosition;
Source = source;
@@ -145,7 +154,10 @@ public class DragInfo : IDisposable, ICloneable
{
ThrowIfDisposed();
var clone = new DragInfo(Data, AllowedEffects, newPosition, Source);
var clone = new DragInfo(Data, AllowedEffects, newPosition, Source)
{
_disposed = false,
};
foreach (var kvp in _parameters)
{
@@ -209,6 +221,14 @@ public class DragInfo : IDisposable, ICloneable
{
if (_disposed) return;
foreach (var value in _parameters.Values)
{
if (value is IDisposable disposable)
{
disposable.Dispose();
}
}
_parameters.Clear();
_disposed = true;
GC.SuppressFinalize(this);