本文整理汇总了C#中Formatter.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Formatter.ToString方法的具体用法?C# Formatter.ToString怎么用?C# Formatter.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Formatter
的用法示例。
在下文中一共展示了Formatter.ToString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: displayData
private void displayData(int mode, SmotionActivity.Info[] info)
{
// TODO Auto-generated method stub
string str = getMode(mMode);
StringBuilder sb = new StringBuilder();
if (mIsPeriodicMode && (mode == SmotionActivity.Info.MODE_REALTIME))
{
sb.Append("Periodic Mode : " + mInterval / 1000 + " sec" + "\n");
}
sb.Append("<" + getMode(mode) + ">");
if (MotionTest.mIsUpdateInfo)
{
if (mMode == SmotionActivity.Info.MODE_ALL)
{
if (UpdateInfoBatchModeSupport)
{
sb.Append(" - Update" + " All" + " Data");
}
else
{
sb.Append(" - Update " + getMode(mode) + " Data");
}
}
else
{
sb.Append(" - Update " + getMode(mode) + " Data");
}
MotionTest.mIsUpdateInfo = false;
}
sb.Append("\n");
for (int i = 0; i < info.Length; i++)
{
long timestamp = 0;
if (mIsPeriodicMode)
{
if (mode == SmotionActivity.Info.MODE_REALTIME)
{
timestamp = DateTimeHelperClass.CurrentUnixTimeMillis();
}
else if (mode == SmotionActivity.Info.MODE_BATCH)
{
timestamp = info[i].TimeStamp;
}
}
else
{
timestamp = info[i].TimeStamp;
}
Time time = new Time();
time.set(timestamp);
Formatter form = new Formatter();
form.format("%02d:%02d:%02d", time.hour, time.minute, time.second);
sb.Append("[" + form.ToString() + "] ");
form.close();
sb.Append(getStatus(info[i].Status));
sb.Append("(" + getAccuracy(info[i].Accuracy) + ")");
sb.Append("\n");
}
switch (mode)
{
case SmotionActivity.Info.MODE_REALTIME:
mQueue[0] = sb.ToString();
break;
case SmotionActivity.Info.MODE_BATCH:
mQueue[1] = sb.ToString();
break;
default:
break;
}
sb = new StringBuilder();
for (int i = 0; i < mQueue.Length; i++)
{
if (mQueue[i] != null)
{
sb.Append(mQueue[i] + "\n");
}
}
if (str != null)
{
MotionTest.displayData(0, str, sb.ToString());
}
}
示例2: displayData
private void displayData(SmotionActivityNotification.Info info)
{
StringBuilder sb = new StringBuilder();
string str = null;
long timestamp = info.TimeStamp;
Time time = new Time();
time.set(timestamp);
Formatter form = new Formatter();
form.format("%02d:%02d:%02d", time.hour, time.minute, time.second);
sb.Append("[" + form.ToString() + "] ");
form.close();
str = getStatus(info.Status);
sb.Append("(" + getAccuracy(info.Accuracy) + ")");
if (str != null)
{
MotionTest.displayData(0, str, sb.ToString());
}
}