public int IndexOfUniqueSessionId(WTSUniqueSessionId _UniqueSessionId) { for (int i = 0; i < this.Count; i++) { if (this[i].UniqueSessionId == _UniqueSessionId) { return(i); } } return(-1); // non found }
//public override event NotifyCollectionChangedEventHandler CollectionChanged; //protected override void OnCollectionChanged(NotifyCollectionChangedEventArgs e) //{ // var eh = CollectionChanged; // if (eh != null) // { // Dispatcher dispatcher = (from NotifyCollectionChangedEventHandler nh in eh.GetInvocationList() // let dpo = nh.Target as DispatcherObject // where dpo != null // select dpo.Dispatcher).FirstOrDefault(); // if (dispatcher != null && dispatcher.CheckAccess() == false) // { // dispatcher.Invoke(DispatcherPriority.DataBind, (Action)(() => OnCollectionChanged(e))); // } // else // { // foreach (NotifyCollectionChangedEventHandler nh in eh.GetInvocationList()) // nh.Invoke(this, e); // } // } //} public WTSSession this[WTSUniqueSessionId _UniqueSessionId] { get { foreach (WTSSession s in this) { if (s.UniqueSessionId == _UniqueSessionId) { return(s); } } return(null); } }