本文整理汇总了C#中Altaxo.Data.AltaxoVariant.IsType方法的典型用法代码示例。如果您正苦于以下问题:C# AltaxoVariant.IsType方法的具体用法?C# AltaxoVariant.IsType怎么用?C# AltaxoVariant.IsType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Altaxo.Data.AltaxoVariant
的用法示例。
在下文中一共展示了AltaxoVariant.IsType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FormatItem
protected override string FormatItem(AltaxoVariant item)
{
if (item.IsType(AltaxoVariant.Content.VDateTime) && !string.IsNullOrEmpty(_formatString))
{
var dt = item.ToDateTime();
switch (_timeConversion)
{
case TimeConversion.ToLocal:
dt = dt.ToLocalTime();
break;
case TimeConversion.ToUtc:
dt = dt.ToUniversalTime();
break;
}
bool showAlternate = false;
showAlternate |= (_showAlternateFormattingAtMidnight && Math.Abs(dt.TimeOfDay.TotalSeconds) < 1);
showAlternate |= (_showAlternateFormattingAtNoon && Math.Abs((dt.TimeOfDay - TimeSpan.FromHours(12)).TotalSeconds) < 1);
try
{
return string.Format(showAlternate ? _formatStringAlternate : _formatString, dt);
}
catch (Exception)
{
}
}
return item.ToString();
}
示例2: SetValueAt
// indexers
public override void SetValueAt(int i, AltaxoVariant val)
{
if(val.IsType(AltaxoVariant.Content.VDouble))
this[i] = val.m_Double;
else if(val.CanConvertedToDouble)
this[i] = val.ToDouble();
else
throw new ApplicationException("Error: Try to set " + this.TypeAndName + "[" + i + "] with the string " + val.ToString());
}
示例3: ProcessDataBounds
/// <summary>
/// calculates the axis org and end using the databounds
/// the org / end is adjusted only if it is not fixed
/// and the DataBound object contains valid data
/// </summary>
public override void ProcessDataBounds(AltaxoVariant org, bool orgfixed, AltaxoVariant end, bool endfixed)
{
DateTime dorg;
DateTime dend;
if (org.IsType(AltaxoVariant.Content.VDateTime))
dorg = (DateTime)org;
else if (org.CanConvertedToDouble)
dorg = new DateTime((long)(org.ToDouble() * 1E7));
else
throw new ArgumentException("Variant org is not a DateTime nor a numeric value");
if (end.IsType(AltaxoVariant.Content.VDateTime))
dend = (DateTime)end;
else if (end.CanConvertedToDouble)
dend = new DateTime((long)(end.ToDouble() * 1E7));
else
throw new ArgumentException("Variant end is not a DateTime nor a numeric value");
ProcessDataBounds(dorg, orgfixed, dend, endfixed);
}