44 lines
1.2 KiB
C#
44 lines
1.2 KiB
C#
using SteamWare;
|
|
using System;
|
|
|
|
namespace MoonProTablet
|
|
{
|
|
public class utility
|
|
{
|
|
#region Public Methods
|
|
|
|
/// <summary>
|
|
/// formatta la durata in minuti in un modo "human readable" gg/ore/min
|
|
/// </summary>
|
|
/// <param name="min">minuti</param>
|
|
/// <returns></returns>
|
|
public static string formatDurata(object min)
|
|
{
|
|
string answ = "";
|
|
DateTime tempo = new DateTime();
|
|
double minuti = 0;
|
|
try
|
|
{
|
|
minuti = Convert.ToDouble(min);
|
|
tempo = tempo.AddMinutes(minuti);
|
|
}
|
|
catch
|
|
{ }
|
|
if (minuti < memLayer.ML.CRI("maxMinuti"))
|
|
{
|
|
answ = $"{tempo.Minute}<small>m</small> {tempo.Second}<small>s</small>";
|
|
}
|
|
else if (minuti < memLayer.ML.CRI("maxOre"))
|
|
{
|
|
answ = $"{tempo.Hour}<small>h</small> {tempo.Minute}<small>m</small>";
|
|
}
|
|
else
|
|
{
|
|
answ = $"{tempo.DayOfYear - 1}<small>g</small> {tempo.Hour}<small>h</small>";
|
|
}
|
|
return answ;
|
|
}
|
|
|
|
#endregion Public Methods
|
|
}
|
|
} |