public async Task UpdateSessionSummaryFromServerAsync() { object jwt = FileManager.getItem("jwt"); if (jwt != null) { string api = "/sessions/summary?refresh=true"; HttpResponseMessage response = await SoftwareHttpManager.SendRequestAsync(HttpMethod.Get, api, jwt.ToString()); if (SoftwareHttpManager.IsOk(response)) { SessionSummary summary = SessionSummaryManager.Instance.GetSessionSummayData(); string responseBody = await response.Content.ReadAsStringAsync(); IDictionary <string, object> jsonObj = (IDictionary <string, object>)SimpleJson.DeserializeObject(responseBody, new Dictionary <string, object>()); if (jsonObj != null) { try { SessionSummary incomingSummary = summary.GetSessionSummaryFromDictionary(jsonObj); summary.CloneSessionSummary(incomingSummary); SessionSummaryManager.Instance.SaveSessionSummaryToDisk(summary); DispatchUpdatesProcessorAsync(); } catch (Exception e) { Logger.Error("failed to read json: " + e.Message); } } package.RebuildMenuButtonsAsync(); } } }
public void ToggleStatusInfo() { showingStatusText = !showingStatusText; // update the tree view text package.RebuildMenuButtonsAsync(); // update the status bar info SessionSummaryManager.Instance.UpdateStatusBarWithSummaryDataAsync(); }