private void LoadStorageUsageUICallback(object sender, SimpleEventArgs evt) { StorageUsageResponse storageUsage = (StorageUsageResponse)evt.param; 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; if (quota < 0) { label_MonthlyLimitValue.Text = I18n.L.T("MonthlyUsage_Unlimited"); } else { label_MonthlyLimitValue.Text = quota.ToString(); } label_DaysLeftValue.Text = daysLeft.ToString(); label_UsedCountValue.Text = usage.ToString(); if (quota < 0) { barCloudUsage.Value = (int)(usage * 100 / int.MaxValue); } else { barCloudUsage.Value = (int)(usage * 100 / quota); } RestoreCursor(); }
public static StorageUsageResponse StorageUsage(string sessionToken) { try { // TODO: call the api via station StorageUsageResponse res = CloudServer.requestPath <StorageUsageResponse>( new WebClient(), "storages/usage", new Dictionary <object, object> { { CloudServer.PARAM_API_KEY, CloudServer.APIKey }, { CloudServer.PARAM_SESSION_TOKEN, sessionToken } } ); return(res); } catch (WammerCloudException e) { ExtractApiRetMsg(e); throw; } }