Убраны синхронные методы
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user