private void AddUpdateWorker(TweetWorker w, AccountInfo fallbackOriginal) { if (fallbackOriginal == null) { fallbackOriginal = w.AccountInfo; } else if (fallbackOriginal == w.AccountInfo) { ExceptionStorage.Register(new InvalidOperationException("フォールバックがループしています。"), ExceptionCategory.ConfigurationError); return; } DispatcherHelper.BeginInvoke(() => this._updateWorkers.Add(w)); w.fallbackOriginalAccount = fallbackOriginal; w.RemoveRequired += () => DispatcherHelper.BeginInvoke(() => this._updateWorkers.Remove(w)); w.FallbackRequired += new Action <TweetWorker>(fw => AddUpdateWorker(fw, fallbackOriginal)); w.DoWork().ContinueWith(t => { if (t.Result) { Thread.Sleep(Setting.Instance.ExperienceProperty.PostFinishShowLength); DispatcherHelper.BeginInvoke(() => this._updateWorkers.Remove(w)); } }); }
public void AddUpdateWorker(TweetWorker w) { AddUpdateWorker(w, null); }
private void AddUpdateWorker(TweetWorker w, AccountInfo fallbackOriginal) { if (fallbackOriginal == null) { fallbackOriginal = w.AccountInfo; } else if (fallbackOriginal == w.AccountInfo) { ExceptionStorage.Register(new InvalidOperationException("フォールバックがループしています。"), ExceptionCategory.ConfigurationError); return; } DispatcherHelper.BeginInvoke(() => this._updateWorkers.Add(w)); w.fallbackOriginalAccount = fallbackOriginal; w.RemoveRequired += () => DispatcherHelper.BeginInvoke(() => this._updateWorkers.Remove(w)); w.FallbackRequired += new Action<TweetWorker>(fw => AddUpdateWorker(fw, fallbackOriginal)); w.DoWork().ContinueWith(t => { if (t.Result) { Thread.Sleep(Setting.Instance.ExperienceProperty.PostFinishShowLength); DispatcherHelper.BeginInvoke(() => this._updateWorkers.Remove(w)); } }); }
public void AddUpdateWorker(TweetWorker w) { DispatcherHelper.BeginInvoke(() => this._updateWorkers.Add(w)); w.RemoveRequired += () => DispatcherHelper.BeginInvoke(() => this._updateWorkers.Remove(w)); w.WorkerAddRequired += AddUpdateWorker; w.DoWork().ContinueWith(t => { if (t.Result) { Thread.Sleep(Setting.Instance.ExperienceProperty.PostFinishShowLength); DispatcherHelper.BeginInvoke(() => this._updateWorkers.Remove(w)); } }); }