public void Dispose() { this.timer.Dispose(); this.timer = null; this.receiver.ReceivedTimeline -= this.receiver_ReceivedTimeline; this.receiver.IsRefreshingChanged -= this.receiver_IsRefreshingChanged; this.receiver.Error -= this.receiver_Error; this.receiver.Dispose(); this.receiver = null; this.Items = null; TimelineItemCache.Instance.CollectionChanged -= this.StatusCache_CollectionChanged; this.Setting.PropertyChanged -= this.Settings_PropertyChanged; this.Setting = null; GC.SuppressFinalize(this); }
private void Settings_PropertyChanged(object sender, PropertyChangedEventArgs e) { switch (e.PropertyName) { case "Name": this.RaisePropertyChanged(e.PropertyName); break; case "Type": var oldReceiver = this.receiver;//UserStream再接続防止 this.receiver = TimelineReceiver.CreateTimelineReceiver(this.Setting.Type); this.receiver.Args = this.Setting.Args; this.receiver.ReceivedTimeline += this.receiver_ReceivedTimeline; this.receiver.IsRefreshingChanged += this.receiver_IsRefreshingChanged; this.receiver.Error += this.receiver_Error; if (oldReceiver != null) { oldReceiver.ReceivedTimeline -= this.receiver_ReceivedTimeline; oldReceiver.IsRefreshingChanged -= this.receiver_IsRefreshingChanged; oldReceiver.Error -= this.receiver_Error; oldReceiver.Dispose(); } this.Items.Clear(); this.receiver.GetFirst(); this.Refresh(); break; case "Args": if (this.receiver != null) this.receiver.Args = this.Setting.Args; break; case "RefreshSpan": this.timer.Change(0, this.Setting.RefreshSpan * 1000); break; } }