using SettingCore;
using SettingCore.Views;
+using SettingMainGadget.Apps;
using SettingMainGadget.TextResources;
using System;
using System.Collections.Generic;
foreach (var package in packages)
{
packageSizeInfo = await package.Key.GetSizeInformationAsync();
- package.Value.SubText = GetSizeString(packageSizeInfo.AppSize);
+ package.Value.SubText = AppManager.GetSizeString(packageSizeInfo.AppSize);
}
}
var appContext = new ApplicationRunningContext(info.Key.ApplicationId);
var processMemmory = new Tizen.System.ProcessMemoryUsage(new List<int> { appContext.ProcessId });
processMemmory.Update(new List<int> { appContext.ProcessId });
- info.Value.SubText = GetSizeString(processMemmory.GetVsz(appContext.ProcessId));
+ info.Value.SubText = AppManager.GetSizeString(processMemmory.GetVsz(appContext.ProcessId));
}
}
- private string GetSizeString(double size)
- {
- string[] suffixes = { "Bytes", "KB", "MB", "GB" };
- int counter = 0;
-
- while (Math.Round(size / 1024, 2) >= 1)
- {
- size = size / 1024;
- counter++;
- }
-
- return string.Format("{0:0.##} {1}", size, suffixes[counter]);
- }
-
private ScrollableBase CreateScrollableBase()
{
return new ScrollableBase()
using SettingCore;
using SettingCore.Views;
+using SettingMainGadget.Apps;
using SettingMainGadget.TextResources;
using System;
using System.Collections.Generic;
foreach (var app in applicationInfos)
{
- var item = new TextWithIconListItem(app.Name, Color.Transparent, iconPath: app.IconPath, subText: GetSizeString(app.AppSize));
+ var item = new TextWithIconListItem(app.Name, Color.Transparent, iconPath: app.IconPath, subText: AppManager.GetSizeString(app.AppSize));
content.Add(item);
if (app.AppSize == 0)
if (app != null)
{
app.AppSize = packageSizeInfo.AppSize;
- item.Value.SubText = GetSizeString(packageSizeInfo.AppSize);
+ item.Value.SubText = AppManager.GetSizeString(packageSizeInfo.AppSize);
}
}
}
}
- private string GetSizeString(double size)
- {
- string[] suffixes = { "Bytes", "KB", "MB", "GB" };
- int counter = 0;
-
- while (Math.Round(size / 1024, 2) >= 1)
- {
- size = size / 1024;
- counter++;
- }
-
- return string.Format("{0:0.##} {1}", size, suffixes[counter]);
- }
-
private class ApplicationInfo
{
public string AppId { get; }