private void bgworkerGetAllData_DoWork(object sender, DoWorkEventArgs e) { WService _service = new WService(); MR_storages_usage _storageUsage = _service.storages_usage(Main.Current.RT.Login.session_token); long _quota = _storageUsage.storages.waveface.quota.month_total_objects; long _usage = _storageUsage.storages.waveface.usage.month_total_objects; int _daysLeft = _storageUsage.storages.waveface.interval.quota_interval_left_days; e.Result = new StorageUsage { quota = _quota, usage = _usage, daysLeft = _daysLeft }; }
/// <summary> /// Fetch the token of the previous session if this one exist /// </summary> /// <returns></returns> private static async Task FetchPreviousToken() { try { // Get the token of the previous session var Token = await SecureStorage.GetAsync("oauth_token"); // If this token exist if (!string.IsNullOrEmpty(Token)) { // Set the header IDictionary <string, string> headers = new Dictionary <string, string>(); // Fetch the user token headers.Add("Authorization", "Bearer " + Token); App.currentUser = await WService.ExecuteGet <User>("users", null, headers); } } catch (Exception ex) { throw new Exception(ex.Message); } }
public RT_REST(RunTime rt) { m_rt = rt; m_service = new WService(); }