/* * UpdateNotifyingList.cs * * Copyright © 2009 * Diversified Technical Systems, Inc. * All Rights Reserved */ using System; using System.Collections.Generic; using System.Linq; using System.Text; using DTS.Common.Utilities.DotNetProgrammingConstructs; namespace DTS.Common.Utilities { public class UpdateNotifyingList : Exceptional { /// /// Initialize an instance of the UpdateNotifyingList class. /// public UpdateNotifyingList() { } /// /// Get/set the notification-bound items in this list. /// public List Items { get => _Items.Value; set { try { // // Update list items and then notify all subscribers. // _Items.Value = value; OnUpdate(value); } catch (System.Exception ex) { throw new UpdateNotifyingList.Exception("encountered problem setting UpdateNotifyingList.Items", ex); } } } private Property> _Items = new Property>("NotifyingList", null, false); /// /// Callback method to be invoked whenever the notifying list is updated. /// /// /// /// The updated contents of the notifying list. /// /// public delegate void OnUpdateCallback(List updatedContents); /// /// Subscribers to be notified whenever this list is changed. /// public event OnUpdateCallback OnUpdate; } }