本文整理汇总了C#中LoadType.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# LoadType.ToString方法的具体用法?C# LoadType.ToString怎么用?C# LoadType.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LoadType
的用法示例。
在下文中一共展示了LoadType.ToString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DoLoad
private void DoLoad(LoadType loadType)
{
lock (loadLock)
{
instance.timer.Change(Timeout.Infinite, Timeout.Infinite);
var tran = Cat.NewTransaction("LoadDataSource", loadType.ToString());
logger.Info("Load data source begin - " + loadType.ToString());
try
{
if (instance.names == null)
instance.names = instance.GetNames();
if (instance.names.Length > 0)
{
var coll = DataSourceProvider.GetProvider().GetConnectionStrings(instance.names);
DataSourceManager.AddConnectionStrings(coll);
string names = string.Join(",", DataSourceManager.GetAllNames());
Cat.LogEvent("LoadDataSource.Cache", "LoadDataSource.Cache.Entries", CatConstants.SUCCESS, names);
logger.Info("Data sources cached", names);
}
tran.Status = CatConstants.SUCCESS;
}
catch (Exception ex)
{
var msg = "Error occured during loading data source.";
Cat.LogError(msg, ex);
tran.SetStatus(ex);
logger.Error(msg, ex);
if (loadType == LoadType.Initialize)
throw;
}
finally
{
tran.Complete();
logger.Info("Load data source end.");
instance.timer.Change(ConfigHelper.UpdateInterval * 1000, Timeout.Infinite);
}
}
}
示例2: LoadXML
/// <summary>
/// 从文件或者URL加载XML
/// Easy way to load XML from a file or URL
/// </summary>
public bool LoadXML(string sourceXMLOrFile, LoadType loadType, Encoding encoding)
{
bool bLoadResult = false;
try
{
switch (loadType)
{
case LoadType.FromString:
m_xmlDocument.LoadXml(sourceXMLOrFile); // loading from source XML text
break;
case LoadType.FromLocalFile:
m_xmlDocument.Load(sourceXMLOrFile); // loading from a file
break;
case LoadType.FromURL:
{
string sURLContent = GetURLContent(sourceXMLOrFile, encoding);
m_xmlDocument.LoadXml(sURLContent);
break;
}
default:
string sErr = "Developer note: No LoadType case supported for " + loadType.ToString();
throw (new Exception(sErr));
}
DoPostLoadCreateInit();
bLoadResult = true;
}
catch (Exception e)
{
HandleException(e);
}
return bLoadResult;
}
示例3: GetEffectiveLength
public double GetEffectiveLength(double l_u, double d, LateralBracingCondition BracingConditition,
SupportCondition Support, LoadType LoadType, int NumberOfLoads = 0)
{
double l_e = double.PositiveInfinity;
//adjust values
SupportCondition bc = Support;
LateralBracingCondition br = BracingConditition;
int N = NumberOfLoads;
if (bc == SupportCondition.Cantilever)
{
br = LateralBracingCondition.Unbraced;
}
if (bc == SupportCondition.SingleSpan)
{
if (LoadType == NDS2015.LoadType.UniformlyDistributed)
{
br = LateralBracingCondition.Unbraced;
}
else
{
if (br == LateralBracingCondition.Unbraced && N>2)
{
N = 2;
}
else
{
if (N>7)
{
N = 7;
}
}
}
}
//Find value in table
#region Read Effective Length Data
var SampleValue = new
{ BC = "", LoadType = "", Br = "", N=1,
l_d_Less7_luFactor= 0.0,
l_d_Less7_dFactor= 0.0,
l_d_Less14_luFactor = 0.0,
l_d_Less14_dFactor = 0.0,
l_d_More14_luFactor = 0.0,
l_d_More14_dFactor = 0.0
}; // sample
var EffectiveLengthTableVals = ListFactory.MakeList(SampleValue);
using (StringReader reader = new StringReader(Resources.NDS2015_Table3_3_3EffectiveLength))
{
string line;
while ((line = reader.ReadLine()) != null)
{
string[] Vals = line.Split(',');
if (Vals.Length == 10)
{
string _BC = Vals[0];
string _LoadType = Vals[1];
string _Br = Vals[2];
int _N = int.Parse(Vals[3]);
double _l_d_Less7_luFactor =double.Parse(Vals[4]);
double _l_d_Less7_dFactor = double.Parse(Vals[5]);
double _l_d_Less14_luFactor = double.Parse(Vals[6]);
double _l_d_Less14_dFactor = double.Parse(Vals[7]);
double _l_d_More14_luFactor = double.Parse(Vals[8]);
double _l_d_More14_dFactor =double.Parse(Vals[9]);
EffectiveLengthTableVals.Add
(new
{
BC = _BC ,
LoadType = _LoadType ,
Br = _Br ,
N=_N,
l_d_Less7_luFactor = _l_d_Less7_luFactor ,
l_d_Less7_dFactor = _l_d_Less7_dFactor ,
l_d_Less14_luFactor= _l_d_Less14_luFactor,
l_d_Less14_dFactor = _l_d_Less14_dFactor ,
l_d_More14_luFactor= _l_d_More14_luFactor,
l_d_More14_dFactor = _l_d_More14_dFactor
}
);
}
}
}
#endregion
double lu_factor = 0.0;
double dFactor = 0.0;
var EffectiveLengthEntryData = EffectiveLengthTableVals.First(l =>
l.BC==bc.ToString()
&& l.Br == br.ToString()
//.........这里部分代码省略.........