private void RequestsStatus(DRequestCompletedEventArgs e, string QId) { try { int NGrants = 0; int NScripts = 0; JsonObject JMesg = JsonStatus.Parse(e.ResponseString); JsonArray JData = JMesg.GetNamedArray("data"); if (0 < Grants.Count()) { List <SHGrant> CurrGrants = new List <SHGrant>(Grants); foreach (JsonValue JValue in JData) { SHGrant G = new SHGrant(JValue.GetObject()); if (Grants.Any(x => x.Id == G.Id)) { continue; } CurrGrants.Add(G); } Grants = CurrGrants.ToArray(); } else { Grants = JData.Remap(x => { SHGrant G = new SHGrant(x.GetObject()); int l = G.Grants.Length; if (!G.SourceRemoved) { if (0 < l) { NScripts++; } NGrants += l; } return(G); }); } if (0 < NGrants) { Member.Activities.Add(() => { StringResources stx = StringResources.Load(); return(string.Format(stx.Text("GrantsReceived"), NGrants, NScripts)); }, () => MessageBus.SendUI(typeof(MyRequests), AppKeys.SH_SHOW_GRANTS)); } } catch (Exception ex) { Logger.Log(ID, ex.Message, LogType.WARNING); } }
private void GrantComplete(DRequestCompletedEventArgs e, string Id) { try { JsonStatus.Parse(e.ResponseString); SetGranted(Id); } catch (Exception ex) { Logger.Log(ID, ex.Message); } }
private async void SaveTemp(DRequestCompletedEventArgs e, DownloadBookContext Context) { StorageFile ISF = await AppStorage.MkTemp( Context.Id + ". " + (string.IsNullOrEmpty(Context.Title) ? "[ Parse Needed ]" : Context.Title) + ".txt" ); await ISF.WriteBytes(e.ResponseBytes); ViewSource.BSData.ImportItem(new LocalBook(ISF)); }
private void PlaceSuccess(DRequestCompletedEventArgs e, string Id) { try { JsonStatus.Parse(e.ResponseString); Canceled = false; Worker.UIInvoke(() => { Hide(); }); } catch (Exception ex) { Error(ex.Message); } }
private void CommentSuccess(DRequestCompletedEventArgs e, string Id) { try { JsonStatus.Parse(e.ResponseString); CommentInput.Document.SetText(Windows.UI.Text.TextSetOptions.None, ""); DropComment(); ReloadComments(); } catch (Exception ex) { CommentError.Text = ex.Message; } }
private void RequestComplete(DRequestCompletedEventArgs e, string QueryId) { IndicateIdle(); try { JsonStatus.Parse(e.ResponseString); Canceled = false; Hide(); } catch (Exception ex) { ErrorMessage(ex.Message); Account.Focus(FocusState.Keyboard); } }
private void SearchItemUpdate(DRequestCompletedEventArgs e, string Id) { HubScriptItem Target; if (TryGetId(Id, out Target)) { try { JsonObject JResponse = JsonStatus.Parse(e.ResponseString); Target.Update(JResponse.GetNamedArray("data").First().GetObject()); } catch (Exception ex) { Target.ErrorMessage = ex.Message; } } }
private void GotServerList(DRequestCompletedEventArgs e, string key) { IEnumerable <ServerChoice> SC = null; XParameter[] Params = ServerReg.Parameters("uri"); try { IEnumerable <string> Servers = X.Call <IEnumerable <string> >(XProto.ServerSelector, "ExtractList", e.ResponseString); SC = Servers.Remap(x => { string[] s = x.Split(new char[] { ',' }); return(new ServerChoice(s[0], s[1])); }); var j = Task.Run(async() => { await X.Call <Task>(XProto.ServerSelector, "ProcessList", Servers); foreach (ServerChoice C in SC) { C.Preferred = X.Static <IEnumerable <Weight <string> > >(XProto.ServerSelector, "ServerList").Any(x => { if (x.Freight == C.Name) { C.Desc = x.Factor + ""; return(true); } return(false); }); C.IsLoading = false; } }); } catch (Exception ex) { Logger.Log(ID, ex.Message, LogType.ERROR); } Worker.UIInvoke(() => AvailableServers.ItemsSource = SC); }
private void ProcessInbox(DRequestCompletedEventArgs e, string QId) { try { JsonObject JDef = JsonStatus.Parse(e.ResponseString); JsonArray JData = JDef.GetNamedArray("data"); foreach (JsonValue JItem in JData) { InboxMessage BoxMessage = new InboxMessage(JItem.GetObject()); Member.Activities.AddUI(new Activity(BoxMessage.Name, BoxMessage.OpenComment) { TimeStamp = BoxMessage.TimeStamp }); } } catch (Exception) { } }
private void ReportSuccess(DRequestCompletedEventArgs e, string Id) { try { JsonStatus.Parse(e.ResponseString); new RuntimeCache().POST( Shared.ShRequest.Server , Shared.ShRequest.Search("uuid: " + Id, 0, 1) // Pass the uuid instead of the query id , (re, q) => MessageBus.Send(GetType(), AppKeys.HS_REPORT_SUCCESS, new Tuple <string, DRequestCompletedEventArgs>(Id, re)) , GR.GSystem.Utils.DoNothing , true ); } catch (Exception ex) { MessageBus.Send(GetType(), AppKeys.HS_REPORT_FAILED, new Tuple <string, string>(Id, ex.Message)); } }
private void SaveIntro(DRequestCompletedEventArgs e, string id) { CurrentBook.Intro = Shared.Conv.Chinese.Translate(e.ResponseString); }
private void DownloadComplete(DRequestCompletedEventArgs e, string Id) { BindItem.SetScriptData(e.ResponseString); }