private void Notify(Session session, NotifyTypeKey key) { var action = this._notifyProviders[key]; var notifications = action.GetInvocationList() .Select(f => ((Func <Session, string>)f)(session)) .Where(x => !string.IsNullOrEmpty(x)); this._notifier.Notify(key.Uri, key.Type.Name, string.Join(Environment.NewLine, notifications)); }
private void _Register(string kcapi, INotifyType type, Func <Session, string> notifyProvider) { var key = new NotifyTypeKey(kcapi, type); Func <Session, string> action; if (this._notifyProviders.TryGetValue(key, out action)) { action += notifyProvider; this._notifyProviders[key] = action; } else { this._notifyProviders.Add(key, notifyProvider); KanColleClient.Current.Proxy.ApiSessionSource .Where(s => s.Request.PathAndQuery == kcapi) .Subscribe(s => Current.Notify(s, key)); } }