本文整理汇总了C#中Params类的典型用法代码示例。如果您正苦于以下问题:C# Params类的具体用法?C# Params怎么用?C# Params使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Params类属于命名空间,在下文中一共展示了Params类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: _addRptParams
private static void _addRptParams(IDbConnection conn, String rptUID, Params prms, String userUID, String remoteIP) {
var v_prms = new Params();
v_prms.SetValue("p_rpt_uid", rptUID);
var v_sql = "begin xlr.clear_rparams(:p_rpt_uid); end;";
SQLCmd.ExecuteScript(conn, v_sql, v_prms, 120);
v_sql = "begin xlr.add_rparam(:p_rpt_uid, :p_prm_name, :p_prm_type, :p_prm_val, :p_usr_uid, :p_remote_ip); end;";
foreach (var v_prm in prms) {
v_prms.SetValue("p_prm_name", v_prm.Name);
String v_prmValue;
var v_prmTypeStr = "A";
if (v_prm.Value != null) {
var v_prmType = v_prm.ParamType ?? v_prm.Value.GetType();
if (Utl.TypeIsNumeric(v_prmType)) {
v_prmTypeStr = "N";
v_prmValue = "" + v_prm.Value;
v_prmValue = v_prmValue.Replace(",", ".");
} else if (v_prmType == typeof(DateTime)) {
v_prmTypeStr = "D";
v_prmValue = ((DateTime)v_prm.Value).ToString("yyyy.MM.dd HH:mm:ss");
} else
v_prmValue = "" + v_prm.Value;
} else
continue;
v_prms.SetValue("p_prm_type", v_prmTypeStr);
v_prms.SetValue("p_prm_val", v_prmValue);
v_prms.SetValue("p_usr_uid", userUID);
v_prms.SetValue("p_remote_ip", remoteIP);
SQLCmd.ExecuteScript(conn, v_sql, v_prms, 120);
}
}
示例2: _exec
private void _exec(Params bioPrms, AjaxRequestDelegate callback, SQLTransactionCmd cmd, Boolean silent) {
if (this.AjaxMng == null)
throw new EBioException("Свойство \"ajaxMng\" должно быть определено!");
if (String.IsNullOrEmpty(this.BioCode))
throw new EBioException("Свойство \"bioCode\" должно быть определено!");
this.BioParams = Params.PrepareToUse(this.BioParams, bioPrms);
this._lastRequestedBioCode = this.BioCode;
this.AjaxMng.Request(new BioSQLRequest {
RequestType = RequestType.SQLR,
BioCode = this.BioCode,
BioParams = this.BioParams,
transactionCmd = cmd,
transactionID = this.TransactionID,
Prms = null,
Silent = silent,
Callback = (sndr, args) => {
if (args.Response.Success) {
var rsp = args.Response as BioResponse;
if (rsp != null){
this._lastReturnedParams = (rsp.BioParams != null) ? rsp.BioParams.Clone() as Params : null;
this.TransactionID = rsp.TransactionID;
}
}
if (callback != null) callback(this, args);
}
});
}
示例3: run
protected internal OCRCharacterResult run(Params params1)
{
double d = 4.9406564584124654E-324D;
int[] ai = { -1, -1 };
ReferenceCharacter referencecharacter = ReferenceCharacter.INVALID;
IEnumerator iterator = params1.references.GetEnumerator();
do
{
if (!iterator.MoveNext())
break;
ReferenceCharacter referencecharacter1 = (ReferenceCharacter)iterator.Current;
double[] ad = calculateMatch(params1.symbol, referencecharacter1.image);
double d1 = ad[0];
if (d1 > d)
{
d = d1;
ai[0] = (int)ad[1];
ai[1] = (int)ad[2];
referencecharacter = referencecharacter1;
}
} while (true);
if (referencecharacter == ReferenceCharacter.INVALID)
return OCRCharacterResult.INVALID;
else
return new OCRCharacterResult(referencecharacter, d);
}
示例4: DBSession
/// <summary>
/// Конструктор
/// </summary>
/// <param name="connStr"></param>
/// <param name="workSpaceSchema"></param>
public DBSession(String connStr, String workSpaceSchema) {
this._connStrItems = new Params();
this._storedTrans = new Dictionary<String, IDbTransaction>();
this._connStr = connStr;
this._parsConnectionStr(this._connStr);
this._workSpaceSchema = workSpaceSchema;
}
示例5: Init
/// <summary>
/// Inits this instance.
/// </summary>
/// <returns></returns>
private bool Init() {
this.Graph = this.Model as IGraph;
if (Graph == null)
throw new InconsistencyException("The model has not been set and the Graph property is hence 'null'");
this.LayoutRoot = this.Controller.Model.LayoutRoot;//could be null if not set in the GUI
Graph.ClearSpanningTree();
Graph.MakeSpanningTree(LayoutRoot as INode);
Pars = new Dictionary<string, Params>();
if (Graph.Nodes.Count == 0)
return false;
if (Graph.Edges.Count == 0) //this layout is base on embedded springs in the connections
return false;
Params par;
foreach (INode node in Graph.Nodes) {
par = new Params();
Pars.Add(node.Uid.ToString(), par);
}
return true;
}
示例6: OpenModal
public void OpenModal(Params bioPrms, HtmlPopupWindowOptions opts) {
if (this.AjaxMng == null)
throw new EBioException("Свойство \"ajaxMng\" должно быть определено!");
if (String.IsNullOrEmpty(this.BioCode))
throw new EBioException("Свойство \"bioCode\" должно быть определено!");
this.BioParams = Params.PrepareToUse(this.BioParams, bioPrms);
var v_cli = new SQLRClient();
v_cli.AjaxMng = this.AjaxMng;
v_cli.BioCode = "iod.ping_webdb";
//http://localhost/ekb8/srv.aspx?rqtp=FileSrv&rqbc=ios.givc.mailer.getAttchmntFile&hf=1216
var urlBody = this._bldBodyUrl();
const string c_url = "sys/HTMLShowPage.htm";
var v_opts = opts ?? new HtmlPopupWindowOptions { Width = 600, Height = 500 };
v_cli.Exec(null, (s, a) => {
var v_opts_line = "";
Utl.AppendStr(ref v_opts_line, "resizable:" + ((v_opts.Resizeable) ? "yes" : "no"), ";");
Utl.AppendStr(ref v_opts_line, "menubar:no;status:no;center:yes;help:no;minimize:no;maximize:no;border:think;statusbar:no", ";");
Utl.AppendStr(ref v_opts_line, "dialogWidth:" + v_opts.Width + "px", ";");
Utl.AppendStr(ref v_opts_line, "dialogHeight:" + v_opts.Height + "px", ";");
//var v_rsp = a.response as BioResponse;
var v_html = "Сообщение" + "||" + urlBody;
var v_js = String.Format("self.showModalDialog('{0}', '{1}', '{2}');", c_url, v_html, v_opts_line);
HtmlPage.Window.Eval(v_js);
});
}
示例7: _prepareParamValue
private static String _prepareParamValue(Params inParams, String paramText) {
if (String.IsNullOrEmpty(paramText))
return paramText;
foreach (var t in inParams)
paramText = paramText.Replace("#" + t.Name + "#", t.ValueAsString());
return paramText;
}
示例8: Generate
public static void Generate(IMapGrid map, Params param)
{
m_params = param;
map.Init();
// round block
for (int x = 0; x < map.Width; x++)
for (int y = 0; y < map.Height; y++)
if (x == 0 || y == 0 || x == (map.Width - 1) || y == (map.Height - 1))
map.SetID (x, y, MapGridTypes.ID.Blocked);
else
map.SetID (x, y, MapGridTypes.ID.Empty);
// create rooms
PlaceRooms(map);
// create corridors
PlaceCorridors(map);
// place stairs
PlaceStairs(map);
// remove dead ends
if (m_params.RemoveDeadEnd)
RemoveDeadEnds(map);
// final cleanup
Cleanup(map);
}
示例9: CalculateAttraction
/// <summary>
/// Calculates the attraction or tension on the given edge.
/// </summary>
/// <param name="edge">The edge.</param>
public void CalculateAttraction(IEdge edge)
{
INode n1, n2;
Params n1p = new Params();
Params n2p = new Params();
if (edge.SourceNode != null)
{
n2 = edge.SourceNode;
n2p = Pars[n2.Uid.ToString()];
};
if (edge.TargetNode != null)
{
n1 = edge.TargetNode;
n1p = Pars[n1.Uid.ToString()];
};
double xDelta = n1p.loc[0] - n2p.loc[0];
double yDelta = n1p.loc[1] - n2p.loc[1];
double deltaLength = Math.Max(EPSILON, Math.Sqrt(xDelta * xDelta + yDelta * yDelta));
double force = (deltaLength * deltaLength) / forceConstant;
if (Double.IsNaN(force))
{
System.Diagnostics.Trace.WriteLine("Oops, the layout resulted in a NaN problem.");
return;
}
double xDisp = (xDelta / deltaLength) * force;
double yDisp = (yDelta / deltaLength) * force;
n1p.disp[0] -= xDisp; n1p.disp[1] -= yDisp;
n2p.disp[0] += xDisp; n2p.disp[1] += yDisp;
}
示例10: Execute
public static async Task<bool> Execute(Params @params)
{
var arguments = string.Join(" ",
string.Format("\"{0}\"", @params.SolutionPath),
@params.Args,
string.Format(MsBuildArgs,
@params.Configuration,
@params.Platform,
@params.Verbosity));
var process = new Process
{
StartInfo = new ProcessStartInfo(MsBuildPath)
{
Arguments = arguments,
CreateNoWindow = true,
RedirectStandardOutput = true,
UseShellExecute = false
}
};
process.OutputDataReceived += (sender, args) => @params.Callback(args.Data);
process.Start();
process.BeginOutputReadLine();
while (!process.HasExited)
{
if (@params.CancellationToken.IsCancellationRequested)
{
process.Kill();
return false;
}
await Task.Delay(50, @params.CancellationToken);
}
return process.ExitCode == 0;
}
示例11: DeleteFile
static void DeleteFile(RxMessageBrokerMinimod bus, Params @params)
{
var file = @params.File.FileName;
bus.Send(new AdvanceToNextFile());
bus.Send(new DeleteFile(file, @params.Command.WhatIf));
}
示例12: ParseCmdLine
static Params ParseCmdLine(string[] args)
{
if (args.Length == 0)
return null;
var res = new Params();
var s = args[0].ToLower();
switch (s) {
case "-gen": res.ActionToPerform = Params.Action.Generate; break;
case "-encr": res.ActionToPerform = Params.Action.Encrypt; break;
case "-decr": res.ActionToPerform = Params.Action.Decrypt; break;
default: return null;
}
if (res.ActionToPerform == Params.Action.Generate) {
if (args.Length != 3)
return null;
res.KeyFile = args[1];
res.Pwd = args[2];
} else {
if (args.Length != 4)
return null;
res.InFile = args[1];
res.OutFile = args[2];
res.KeyFile = args[3];
}
return res;
}
示例13: LoadItems
public static void LoadItems(AjaxResponse prevResponse, IAjaxMng ajaxMng, ComboBox cbx, String bioCode, Params bioParams, Action<ComboBox, AjaxResponse> callback, Boolean addNullItem, Boolean useCache) {
if ((prevResponse != null) && (!prevResponse.Success)) {
if (callback != null)
callback(cbx, prevResponse);
return;
}
var v_cli = new JsonStoreClient {
AjaxMng = ajaxMng,
BioCode = bioCode
};
CbxItems storedItems = null;
if (useCache)
storedItems = _restoreItems(bioCode);
if (storedItems != null) {
_loadItems(cbx, storedItems, addNullItem);
if (callback != null)
callback(cbx, new AjaxResponse { Success = true });
} else {
v_cli.Load(bioParams, (s, a) => {
if (a.Response.Success) {
var cbxitems = new CbxItems {metadata = v_cli.JSMetadata, ds = v_cli.DS};
if (useCache)
_storeItems(bioCode, cbxitems);
_loadItems(cbx, cbxitems, addNullItem);
}
if (callback != null)
callback(cbx, a.Response);
});
}
}
示例14: ExternalMonitorAdder
public ExternalMonitorAdder(IRequestSender<SimpleResponse> requestSender, ILog log )
{
RequestSender = requestSender;
Log = log;
LocationIds = new List<int>();
Params = new Params();
}
示例15: TcpConnection
public TcpConnection(Params.Connection param)
{
EndPoint = param.EndPoint;
ReceiveBufferSettings = param.ReceiveBuffer;
SendBufferSettings = param.SendBuffer;
Logger.Network.Debug("New TCP connection created for host " + EndPoint.Address.ToString() + " on port " + EndPoint.Port.ToString());
}