本文整理汇总了C#中InputValue类的典型用法代码示例。如果您正苦于以下问题:C# InputValue类的具体用法?C# InputValue怎么用?C# InputValue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
InputValue类属于命名空间,在下文中一共展示了InputValue类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CheckPath
//---------------------------------------------------------------------
/// <summary>
/// Checks if the path of the parameter file for a climate change is
/// valid.
/// </summary>
public static void CheckPath(InputValue<string> path)
{
CheckForInitialization();
if (path.Actual.Trim(null).Length == 0)
throw new InputValueException(path.String,
"{0} is not a valid path.",
path.String);
}
开发者ID:LANDIS-II-Foundation,项目名称:Extensions-Succession,代码行数:13,代码来源:InputValidation.cs
示例2: CheckBiomassParm
public static double CheckBiomassParm(InputValue<double> newValue,
double minValue,
double maxValue)
{
if (newValue != null)
{
if (newValue.Actual < minValue || newValue.Actual > maxValue)
throw new InputValueException(newValue.String,
"{0} is not between {1:0.0} and {2:0.0}",
newValue.String, minValue, maxValue);
}
return newValue.Actual;
}
开发者ID:pjbitterman,项目名称:Extensions-Disturbance,代码行数:13,代码来源:Util.cs
示例3: CheckInputValue
//---------------------------------------------------------------------
private void CheckInputValue(StringReader reader,
InputValue<byte> expectedValue,
int expectedIndex)
{
int index;
InputValue<byte> result = byteReadMethod(reader, out index);
Assert.AreEqual(expectedValue.Actual, result.Actual);
Assert.AreEqual(expectedValue.String, result.String);
Assert.AreEqual(expectedIndex, reader.Index);
}
开发者ID:LANDIS-II-Foundation,项目名称:Core-Utilities-Library,代码行数:11,代码来源:InputValues_Test.cs
示例4: SetMortCurveShapeParm
//---------------------------------------------------------------------
public void SetMortCurveShapeParm(ISpecies species,
InputValue<double> newValue)
{
Debug.Assert(species != null);
mortCurveShapeParm[species] = newValue.CheckInRange(5.0, 25.0, "mortCurveShapeParm");
}
开发者ID:YongLuo007,项目名称:Extensions-Succession,代码行数:7,代码来源:InputParameters.cs
示例5: ValidateTargetSizes
//---------------------------------------------------------------------
public static void ValidateTargetSizes(
InputValue<double> minTargetSize,
InputValue<double> maxTargetSize) {
if (minTargetSize.Actual < 0)
throw new InputValueException(
minTargetSize.String,
"Min target harvest size cannot be negative");
if (maxTargetSize.Actual <= 0)
throw new InputValueException(maxTargetSize.String,
"Max target harvest size must be positive");
if (minTargetSize.Actual > maxTargetSize.Actual)
throw new InputValueException(minTargetSize.String + " " +
maxTargetSize.String,
"Max target harvest size cannot be greater than min.");
}
开发者ID:pjbitterman,项目名称:Extensions-Disturbance,代码行数:18,代码来源:StandSpreading.cs
示例6: SetMortCurveShapeParm
//---------------------------------------------------------------------
public void SetMortCurveShapeParm(ISpecies species,
InputValue<double> newValue)
{
Debug.Assert(species != null);
mortCurveShapeParm[species] = Util.CheckBiomassParm(newValue, 5.0, 25.0);
}
开发者ID:LANDIS-II-Foundation,项目名称:Extensions-Succession,代码行数:7,代码来源:InputParameters.cs
示例7: SetWoodyDecayRate
//---------------------------------------------------------------------
public void SetWoodyDecayRate(ISpecies species,
InputValue<double> newValue)
{
Debug.Assert(species != null);
woodyDecayRate[species] = Util.CheckBiomassParm(newValue, 0.0, 1.0);
}
开发者ID:LANDIS-II-Foundation,项目名称:Extensions-Succession,代码行数:7,代码来源:InputParameters.cs
示例8: SetLeafLignin
//---------------------------------------------------------------------
public void SetLeafLignin(ISpecies species,
InputValue<double> newValue)
{
Debug.Assert(species != null);
leafLignin[species] = Util.CheckBiomassParm(newValue, 0.0, 0.4);
}
开发者ID:LANDIS-II-Foundation,项目名称:Extensions-Succession,代码行数:7,代码来源:InputParameters.cs
示例9: SetLightExtinctionCoeff
//---------------------------------------------------------------------
public void SetLightExtinctionCoeff(ISpecies species, InputValue<double> newValue)
{
Debug.Assert(species != null);
lightExtinctionCoeff[species] = Util.CheckBiomassParm(newValue, 0.0, 1.0);
}
开发者ID:LANDIS-II-Foundation,项目名称:Extensions-Succession,代码行数:6,代码来源:InputParameters.cs
示例10: NameEmpty
public void NameEmpty()
{
InputValue<string> name = new InputValue<string>("", "");
parameters.Name = name;
}
开发者ID:LANDIS-II-Foundation,项目名称:Libraries,代码行数:5,代码来源:EditableParameters_Test.cs
示例11: SetAET
//---------------------------------------------------------------------
public void SetAET(IEcoregion ecoregion,
InputValue<int> newValue)
{
Debug.Assert(ecoregion != null);
aet[ecoregion] = Util.CheckBiomassParm(newValue, 0, 10000); //FIXME: FIND GOOD MAXIMUM
}
开发者ID:LANDIS-II-Foundation,项目名称:Extensions-Succession,代码行数:7,代码来源:InputParameters.cs
示例12: FinishInputLineOperation
/// <summary>
/// Finishes an input operation which reads a line of text.
/// </summary>
/// <param name="inputText">
/// The input text.
/// </param>
/// <param name="terminator">
/// The terminator.
/// </param>
protected virtual void FinishInputLineOperation(string inputText, InputValue terminator)
{
var zsciiText = this.UnicodeToZscii(inputText);
var textStartAddress = this.InputOperation.TextBuffer + this.TextBufferHeaderLength;
this.WriteZsciiToMemory(textStartAddress, zsciiText);
this.TerminateTextBuffer(textStartAddress, (byte)zsciiText.Count());
this.LexicalAnalysis(zsciiText, this.InputOperation.ParseBuffer, this.DictionaryTableAddress, true);
this.FinishInputOperation(inputText, terminator);
}
开发者ID:DevTheo,项目名称:IFControlDemo,代码行数:18,代码来源:ZmachineV1.cs
示例13: FinishInputOperation
/// <summary>
/// Finishes an input operation.
/// </summary>
/// <param name="inputText">
/// The input text.
/// </param>
/// <param name="terminator">
/// The terminator.
/// </param>
protected virtual void FinishInputOperation(string inputText, InputValue terminator)
{
if (this.InputLogOpen)
{
ImmutableQueue<InputValue> inputValues = null;
foreach (var character in inputText)
{
inputValues = inputValues.Add(new InputValue(character));
}
inputValues = inputValues.Add(terminator);
this.WriteToInputLog(inputValues);
}
this.InputOperation = null;
this.State = MachineState.Running;
}
开发者ID:DevTheo,项目名称:IFControlDemo,代码行数:26,代码来源:ZmachineV1.cs
示例14: ProcessInputValue
/// <summary>
/// Processes an input value.
/// </summary>
/// <param name="inputValue">
/// The input value.
/// </param>
/// <returns>
/// A value indicating whether the input operation terminated.
/// </returns>
protected virtual bool ProcessInputValue(InputValue inputValue)
{
var value = inputValue.Value;
if (value is char)
{
return this.ProcessCharacter((char)value);
}
if (value is InputKey)
{
return this.ProcessInputKey((InputKey)value);
}
return false;
}
开发者ID:DevTheo,项目名称:IFControlDemo,代码行数:24,代码来源:ZmachineV1.cs
示例15: FilterInput
public InputValue[] FilterInput(System.Collections.Specialized.NameValueCollection querystring, UIFS.FormDataStruct FormData)
{
int cnt = 0;
InputValue[] IVs = new InputValue[FormData.ControlList.Length];
UIFS.FormControl Control;
foreach (UIFS.FormDataStruct.ControlListDetail CtrlDetail in FormData.ControlList)
{
Control = FormData.Get_Control(CtrlDetail.id);
IVs[cnt] = new InputValue();
IVs[cnt].Controlid = CtrlDetail.id; // set control id
// now set the correct values based on control type
switch (CtrlDetail.type)
{
case ControlType.Textbox:
case ControlType.DateTime:
case ControlType.List:
IVs[cnt].value = querystring["c_" + Control.id.ToString()];
break;
case ControlType.Percentage:
case ControlType.Number:
IVs[cnt].value = querystring["c_" + Control.id.ToString()];
if (IVs[cnt].value == "") {
IVs[cnt].value = "0"; // DEFAULT to 0 if nothing returned
}
break;
// This checkbox control may also have an attached text input field
case ControlType.Checkbox:
UIFS.FormControl.Checkbox CB = (UIFS.FormControl.Checkbox)Control; //FormData.Get_Control(CtrlDetail.id);;
if (CB.hasinput)
{
IVs[cnt].value = SQLBOOL(querystring["c_" + Control.id.ToString()]);
IVs[cnt].input = querystring["c_" + Control.id.ToString()+"_I"];
}
else { IVs[cnt].value = SQLBOOL(querystring["c_" + Control.id.ToString()]);}
break;
// Ranges have a *Start and *End set of values
case ControlType.Range:
UIFS.FormControl.Range R = (UIFS.FormControl.Range)Control;
IVs[cnt].Start = querystring["c_" + Control.id.ToString() + "_S"];
IVs[cnt].End = querystring["c_" + Control.id.ToString() + "_E"];
switch (R.type) {
// numbers
case FormControl.Range.Rangetype.Currency:
case FormControl.Range.Rangetype.MinMax:
// DEFAULT to 0 if nothing returned
if (IVs[cnt].Start == ""){IVs[cnt].Start = "0"; }
if (IVs[cnt].End == ""){IVs[cnt].End = "0"; }
break;
case FormControl.Range.Rangetype.DateRange:
case FormControl.Range.Rangetype.DateTimeRange:
case FormControl.Range.Rangetype.TimeRange:
// DEFAULTs are typically set by Calendar widget..control creation..
break;
}
break;
}
cnt += 1; // increase our array counter
}
return IVs;
}
开发者ID:jmptrader,项目名称:UIFS,代码行数:63,代码来源:UIFS.FormInput.cs
示例16: wants
// ---------------------------------------------------------------------------------------------------------------
/* -- FormInput.EditSave --
// ---------------------------------------------------------------------------------------------------------------
| 1) updates the db record for the form with new field changes
| 2) returns a text value "LOG" entry to the user application for it to do what it wants (a basic table example is: UIFS_formid, formid, [changes text])
|
*/
public bool Update(UIFS.FormDataStruct FormData, long formid, InputValue[] FormValues_Old, InputValue[] FormValues_New, ref UIFS.SQL SQL, bool test, ref string Changes)
{
UIFS.FormControl Control;
string query_update = "UPDATE [UIFS.Form_" + FormData.id + "]";
string query_values = " SET ";
string query_where = " WHERE [id]="+formid.ToString();
int iOldCtrl, iNewCtrl, ctrl_currentversion;
string ctrl_dbver = "";
Changes = ""; // clear out first
// if bool test is set, we want to encap in a tran and roll it back.
if (test)
{
query_update = "BEGIN TRAN UIFSTest \n" + query_update;
}
// begin...
try
{
// We are going to build a querystring from all the values
// : making sure to parse values
// For each control for the form: find the value(s) for the control from the form data and check for changes
foreach (UIFS.FormDataStruct.ControlListDetail CtrlDetail in FormData.ControlList)
{
Control = FormData.Get_Control(CtrlDetail.id);
iNewCtrl = -1; iOldCtrl = -1;
//. determine if this control is the latest version or older..
SQL.Query = string.Format(SQL.SQLQuery.Form_ControlcurrentVersion, FormData.id, Control.id);
SQL.cmd = SQL.Command(SQL.Data);
ctrl_currentversion = Convert.ToInt32(SQL.cmd.ExecuteScalar());
if (Control.version != ctrl_currentversion)
{ // NOT CURRENT version, specific column name required
ctrl_dbver = "_" + Control.version.ToString();
}
else { ctrl_dbver = ""; }
for (int t = 0; t < FormValues_Old.Length;t++)
{
if (FormValues_Old[t].Controlid == Control.id)
{ // Found the control data, now we can add to the query strings
iOldCtrl = t; break;
}
}
for (int t = 0; t < FormValues_New.Length;t++)
{
if (FormValues_New[t].Controlid == Control.id)
{ // Found the control data, now we can add to the query strings
iNewCtrl = t; break;
}
}
if (iNewCtrl == -1 || iOldCtrl == -1) {
// error, could not match control value arrays!
continue;
}
switch (CtrlDetail.type) {
// All of the following return a single string values
case ControlType.Textbox:
case ControlType.DateTime:
case ControlType.List:
if (FormValues_Old[iOldCtrl].value != FormValues_New[iNewCtrl].value)
{
query_values = query_values + "[" + Control.id + "]='" + SQL.ParseInput(FormValues_New[iNewCtrl].value) + "',";
Changes = Changes + Control.name + "(" + Control.id + ") was changed from: " + FormValues_Old[iOldCtrl].value + " to: " + FormValues_New[iNewCtrl].value + "\n";
}
break;
// The following return a single numeric values
case ControlType.Percentage:
case ControlType.Number:
if (FormValues_Old[iOldCtrl].value != FormValues_New[iNewCtrl].value)
{
query_values = query_values + "[" + Control.id + "]=" + FormValues_New[iNewCtrl].value + ",";
Changes = Changes + Control.name + "(" + Control.id + ") was changed from: " + FormValues_Old[iOldCtrl].value + " to: " + FormValues_New[iNewCtrl].value + "\n";
}
break;
// Checkbox controls are always true/false with an optional input field
case ControlType.Checkbox:
UIFS.FormControl.Checkbox CB = (UIFS.FormControl.Checkbox)Control;
if (CheckboxBOOL(FormValues_Old[iOldCtrl].value) != CheckboxBOOL(FormValues_New[iNewCtrl].value)) {
query_values = query_values + "[" + Control.id + ctrl_dbver + "]=" + FormValues_New[iNewCtrl].value + ",";
Changes = Changes + Control.name + "(" + Control.id + ") was changed from: " + CheckboxBOOL(FormValues_Old[iOldCtrl].value) + " to: " + CheckboxBOOL(FormValues_New[iNewCtrl].value) + "\n";
}
if (CB.hasinput)
{
if (FormValues_Old[iOldCtrl].input != FormValues_New[iNewCtrl].input)
{
query_values = query_values + "[" + Control.id + ctrl_dbver + "_text]='" + SQL.ParseInput(FormValues_New[iNewCtrl].input) + "',";
Changes = Changes + Control.name + "(" + Control.id + ")'s input was changed from: " + FormValues_Old[iOldCtrl].input + " to: " + FormValues_New[iNewCtrl].input + "\n";
}
}
break;
// Ranges have start/end values
case ControlType.Range:
//.........这里部分代码省略.........
开发者ID:jmptrader,项目名称:UIFS,代码行数:101,代码来源:UIFS.FormInput.cs
示例17: Save
public bool Save(UIFS.FormDataStruct FormData, InputValue[] FormValues, ref UIFS.SQL SQL, bool test, ref long newFormid)
{
UIFS.FormControl Control;
string query_insert = "INSERT INTO [UIFS.Form_" + FormData.id + "] (version,";
string query_values = "VALUES("+FormData.version+",";
// if bool test is set, we want to encap in a tran and roll it back.
if (test)
{
query_insert = "BEGIN TRAN UIFSTest \n" + query_insert;
}
// begin...
try
{
// We are going to build a querystring from all the values
// : making sure to parse values
// 1) For each control for the form: build insert statement with correct column names: id_ver
// 2) and find the value(s) for the control from the form data and add to VALUES part of query
foreach (UIFS.FormDataStruct.ControlListDetail CtrlDetail in FormData.ControlList)
{
Control = FormData.Get_Control(CtrlDetail.id);
foreach (InputValue IV in FormValues)
{
if (IV.Controlid == Control.id)
{ // Found the control data, now we can add to the query strings
switch (CtrlDetail.type)
{
// All of the following return a single string values
case ControlType.Textbox:
case ControlType.DateTime:
case ControlType.List:
query_insert = query_insert + "[" + Control.id + "],";
query_values = query_values + "'" + SQL.ParseInput(IV.value) + "',";
break;
// The following return a single numeric values
case ControlType.Percentage:
case ControlType.Number:
query_insert = query_insert + "[" + Control.id + "],";
query_values = query_values + "" + IV.value + ",";
break;
// Checkbox controls are always true/false with an optional input field
case ControlType.Checkbox:
UIFS.FormControl.Checkbox CB = (UIFS.FormControl.Checkbox)Control;
if (CB.hasinput)
{
query_insert = query_insert + "[" + Control.id + "], [" + Control.id + "_text],"; ;
query_values = query_values + IV.value + ",'" + SQL.ParseInput(IV.input) + "',";
}
else
{
query_insert = query_insert + "[" + Control.id + "],";
query_values = query_values + "" + IV.value + ",";
}
break;
// Ranges have start/end values
case ControlType.Range:
query_insert = query_insert + "[" + Control.id + "_Start], [" + Control.id + "_End],";
query_values = query_values + "'"+SQL.ParseInput(IV.Start)+ "','" + SQL.ParseInput(IV.End) + "',";
break;
}
break;
}
}
}
// dbwrite
// NOTE: we have to trim our trailing commas from created strings
SQL.Query = query_insert.Substring(0, query_insert.Length - 1) + ") " + query_values.Substring(0, query_values.Length - 1) + ") SELECT @@IDENTITY";
// if test, rollback
if (test) {
SQL.Query = SQL.Query + "\n ROLLBACK TRAN UIFSTest";
}
SQL.cmd = SQL.Command(SQL.Data);
newFormid = Convert.ToInt64(SQL.cmd.ExecuteScalar());
return true;
}
catch (Exception ex)
{
SQL.WriteLog_Error(ex, "Failed to save form data: "+SQL.Query, "UIFS.FormInput.SaveForm");
return false;
}
}
开发者ID:jmptrader,项目名称:UIFS,代码行数:86,代码来源:UIFS.FormInput.cs
示例18: SetWoodyDecayRate
//---------------------------------------------------------------------
public void SetWoodyDecayRate(ISpecies species,
InputValue<double> newValue)
{
Debug.Assert(species != null);
woodyDecayRate[species] = newValue.CheckInRange(0.0, 1.0, "woodyDecayRate");
}
开发者ID:YongLuo007,项目名称:Extensions-Succession,代码行数:7,代码来源:InputParameters.cs
示例19: NameWhitespace
public void NameWhitespace()
{
InputValue<string> name = new InputValue<string>(" ", " ");
parameters.Name = name;
} }
开发者ID:LANDIS-II-Foundation,项目名称:Libraries,代码行数:5,代码来源:EditableParameters_Test.cs
示例20: FinishInputCharacterOperation
/// <summary>
/// Finishes an input operation which reads a single character.
/// </summary>
/// <param name="terminator">
/// The terminator.
/// </param>
protected void FinishInputCharacterOperation(InputValue terminator)
{
this.Store((ushort)this.InputValueToZscii(terminator));
this.FinishInputOperation(string.Empty, terminator);
}
开发者ID:DevTheo,项目名称:IFControlDemo,代码行数:11,代码来源:ZmachineV4.cs
注:本文中的InputValue类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论