public async Task<InfoModel> GetInfo(string token) { IWebClient client = GetClient(token); string data = await client.DownloadStringTaskAsync(new Uri("https://api.appfog.com/info")); InfoModel newModel = new InfoModel(); JObject infoJson = JObject.Parse(data); newModel.User = infoJson["user"].ToString(); newModel.Plan = infoJson["plan"].ToString(); foreach (JToken framework in infoJson["frameworks"].Children()) { newModel.Frameworks.Add(framework.First["name"].ToString()); } newModel.Apps = (int) infoJson[Usage]["apps"]; newModel.MemoryUsed = (int) infoJson[Usage][Memory]; newModel.TotalMemory = (int) infoJson["limits"][Memory]; return newModel; }
/// <summary> /// Initializes a new instance of the MainViewModel class. /// </summary> public InfoViewModel() { _getInfoCommand = new RelayCommand(GetInfo); _infoModel = new InfoModel(); }