//
// ConflictEventArgs.cs
//
// Copyright (c) František Boháček. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using NosSmooth.Extensions.SharedBinding.Lifetime;
namespace NosSmooth.Extensions.SharedBinding.EventArgs;
///
/// Arguments containing information about a shared instance.
/// The conflict may be resolved by setting the correct property.
///
public class ConflictEventArgs : System.EventArgs
{
///
/// Initializes a new instance of the class.
///
/// All of the conflicting instances.
/// The default method to resolve the conflict.
public ConflictEventArgs(IReadOnlyList conflictingInstances, ConflictResolution defaultResolution)
{
ConflictingInstances = conflictingInstances;
Resolve = defaultResolution;
}
///
/// Gets the instances that are in conflict.
///
public IReadOnlyList ConflictingInstances { get; }
///
/// Gets or sets the method of resolution.
///
public ConflictResolution Resolve { get; set; }
///
/// Possible methods of resolution.
///
public enum ConflictResolution
{
///
/// Allow the new instance, keep the old ones.
///
Allow,
///
/// Do not allow the new instance, keep the old ones.
///
Restrict,
///
/// Allow the instance, try to detach the old instance.
/// In case the old instance cannot be detached, fall back
/// to .
///
DetachOriginal
}
}