/// <summary> /// Initializes a new instance of the <see cref="ShareLinkViewModel"/> class. /// </summary> /// <param name="subscriptionStore"> /// The subscription store. /// </param> /// <param name="streamStore"> /// The stream Store. /// </param> public ShareLinkViewModel(ISubscriptionStore subscriptionStore, IStreamStore streamStore) { this.streamStore = streamStore; this.Subscriptions = new ObservableCollection<SubscriptionViewModel>(); var subscriptions = subscriptionStore.GetSubsriptions(); var mappedSubscriptions = new List<SubscriptionViewModel>(); mappedSubscriptions = Mapper.Map(subscriptions, mappedSubscriptions); this.Subscriptions.AddRange(mappedSubscriptions); subscriptions.CollectionChanged += (sender, args) => { var newItems = new List<SubscriptionViewModel>(); newItems = Mapper.Map(args.NewItems, newItems); this.Subscriptions.AddRange(newItems); var oldItems = new List<SubscriptionViewModel>(); oldItems = Mapper.Map(args.NewItems, oldItems); this.Subscriptions.RemoveRange(oldItems); }; }