|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
namespace MyList
{
/// <summary>
/// Represents an event send remotely.
/// </summary>
public struct SyncListEvent
{
/// <summary>
/// Constructs a new instance of <see cref="SyncListEvent"/>.
/// </summary>
/// <param name="args">Event arguments to clone.</param>
public SyncListEvent(NotifyCollectionChangedEventArgs args)
{
this.Action = args.Action;
this.NewItems = args.NewItems;
this.NewIndex = args.NewStartingIndex;
this.OldItems = args.OldItems;
this.OldIndex = args.OldStartingIndex;
}
/// <summary>
/// Constructs a new instance of <see cref="SyncListEvent"/>.
/// </summary>
/// <param name="items">A list of items to forward.</param>
public SyncListEvent(IList items)
{
this.Action = NotifyCollectionChangedAction.Reset;
this.NewItems = items;
this.NewIndex = 0;
this.OldItems = null;
this.OldIndex = -1;
}
/// <summary>
/// Gets the action that caused the event.
/// </summary>
public readonly NotifyCollectionChangedAction Action;
/// <summary>
/// Gets the list of new items involved in the change.
/// </summary>
public readonly IList NewItems;
/// <summary>
/// Gets the index at which the change occurred.
/// </summary>
public readonly int NewIndex;
/// <summary>
/// Gets the list of items affected by a Replace, Remove, or Move action.
/// </summary>
public readonly IList OldItems;
/// <summary>
/// Gets the index at which a Move, Remove, or Replace action occurred.
/// </summary>
public readonly int OldIndex;
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.