/// <summary> /// Subscribes a LCQuery. /// </summary> /// <param name="query"></param> /// <returns></returns> public static async Task <LCLiveQuery> Subscribe(this LCQuery query) { LCLiveQuery liveQuery = new LCLiveQuery { Query = query }; await liveQuery.Subscribe(); return(liveQuery); }
private static bool TryGetLiveQuery(Dictionary <string, object> data, out LCLiveQuery liveQuery) { if (!data.TryGetValue("query_id", out object i) || !(i is string id)) { liveQuery = null; return(false); } if (!liveQueries.TryGetValue(id, out WeakReference <LCLiveQuery> weakRef) || !weakRef.TryGetTarget(out LCLiveQuery lq)) { liveQuery = null; return(false); } liveQuery = lq; return(true); }