本文整理汇总了C#中DebugDelegate类的典型用法代码示例。如果您正苦于以下问题:C# DebugDelegate类的具体用法?C# DebugDelegate怎么用?C# DebugDelegate使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DebugDelegate类属于命名空间,在下文中一共展示了DebugDelegate类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Send
public static void Send(string gmailuser, string password, string to, string subject, string message, TradeLink.API.DebugDelegate deb)
{
d = deb;
try
{
MailMessage mail = new MailMessage();
System.Net.NetworkCredential cred = new System.Net.NetworkCredential
(gmailuser, password);
mail.To.Add(to);
mail.Subject = subject;
mail.From = new MailAddress(gmailuser);
mail.IsBodyHtml = true;
mail.Body = message;
SmtpClient smtp = new SmtpClient("smtp.gmail.com");
smtp.UseDefaultCredentials = false;
smtp.EnableSsl = true;
smtp.Credentials = cred;
smtp.Port = 587;
smtp.SendCompleted += new SendCompletedEventHandler(s_SendCompleted);
smtp.Send(mail);
}
catch (Exception ex)
{
debug("Error sending email from: " + gmailuser + " to: " + to + " subject: " + subject + " err: " + ex.Message + ex.StackTrace);
}
}
示例2: ServerSterling
public ServerSterling(TLServer tls, int sleepOnNodata, int sleepAfterOrder, DebugDelegate deb)
{
SendDebug = deb;
tl = tls;
_SLEEP = 50;
_ORDERSLEEP = sleepAfterOrder;
}
示例3: Qdl2GT
/// <summary>
/// takes all or part of quandl object and converts it into GT
/// </summary>
/// <param name="ro"></param>
/// <param name="datecol"></param>
/// <param name="valcol"></param>
/// <param name="startrow"></param>
/// <param name="endrow"></param>
/// <returns></returns>
public static GenericTracker<decimal> Qdl2GT(RootObject ro, string datecol, string valcol, int startrow, int endrow, DebugDelegate d)
{
// get columns
var datecolidx = GetQdlColidx(ro,datecol);
var valcolidx = GetQdlColidx(ro,valcol);
// slice out the data
var subset = GetAllRows(ro, startrow, endrow, d);
// get date column
var dates = QdlCol2Dates( GetColumn(subset, datecolidx));
var vals =QdlCol2Vals( GetColumn(subset, valcolidx));
// populate GT
GenericTracker<decimal> gt = new GenericTracker<decimal>(dates.Count);
for (int i = 0; i < dates.Count; i++)
{
var val = vals[i];
var dt = dates[i];
if (val == qh.ERROR_VALUE)
continue;
if (dt == qh.ERROR_DATE)
continue;
var tldate = Util.ToTLDate(dt);
gt.addindex(tldate.ToString("F0"), val);
}
return gt;
}
示例4: RunHelper
public RunHelper(VoidDelegate start, VoidDelegate end, DebugDelegate deb, string name)
{
OnStart = start;
OnEnd = end;
Name = name;
OnDebug = deb;
bw.DoWork += new System.ComponentModel.DoWorkEventHandler(bw_DoWork);
bw.WorkerReportsProgress = false;
}
示例5: ConvertMap
public ConvertMap(List<int> importmap, List<string> custval, ConvertMapType t, bool ignoreinvalid, DebugDelegate deb, DebugDelegate stat)
{
cust = custval;
ignoreinvalidtick = ignoreinvalid;
inp = importmap;
type = t;
SendDebugEvent = deb;
SendStatusEvent = stat;
}
示例6: hasMaxFails
public static bool hasMaxFails(string task, int maxfail, DebugDelegate deb)
{
var t = GetTask(task);
bool max = t.isValid && (t.Successes == 0) && (t.Failures > maxfail);
if (max && (deb != null))
deb(task + " hit maximum failures " + t.Failures + " with no success.");
return max;
}
示例7: SkinImpl
public SkinImpl(object response, string responsename, string dll, DebugDelegate deb)
{
// save class name
_class = responsename;
// save dll
if (havedll(dll))
_dll = dll;
// serialize props and save
_props = serializeprops(GetType(_class, _dll), response,deb);
}
示例8: ServerNxCore
public ServerNxCore(TLServer tls, string filename, int SaveStateInterval, bool Verbose, DebugDelegate debugs)
{
_fn = filename;
_islive = _fn == LIVEFEED;
_nxsyms.NewTxt += new TextIdxDelegate(_syms_NewTxt);
SendDebugEvent = debugs;
SaveStateIntervalSec = SaveStateInterval;
VerboseDebugging = Verbose;
d = debugs;
debug(Util.TLSIdentity());
_proc = new System.Threading.Thread(proc);
tl = tls;
tl.newProviderName = Providers.Nanex;
tl.newFeatureRequest += new MessageArrayDelegate(ServerNxCore_newFeatureRequest);
tl.newRegisterSymbols += new SymbolRegisterDel(tl_newRegisterSymbols);
savestateint = (uint)(SaveStateIntervalSec * 1000);
debug((tl.VerboseDebugging ? "Verbose is on" : "Verbose is off"));
if (isLive)
{
debug("Running in live mode.");
DOLIVESKIPTEST = true;
// if live and no previous state, remove old state files
if (!hasstate)
{
debug("No state file found for today, removing previous states...");
System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(Util.ProgramData(PROGRAM));
System.IO.FileInfo[] fis = di.GetFiles("nxstate.*.tmp");
foreach (System.IO.FileInfo fi in fis)
{
try
{
System.IO.File.Delete(fi.FullName);
debug("removed: " + fi.FullName);
}
catch { }
}
}
else
{
debug("Will use saved state to advance tape position at startup: " + statefilepath);
_fn = statefilepath;
}
DOSAVESTATE = SaveStateIntervalSec != 0;
if (DOSAVESTATE)
debug("Will save tape position every: " + SaveStateIntervalSec + " seconds.");
else
debug("State saving disabled because SaveStateInterval is 0");
}
}
示例9: ServerRithmic
public ServerRithmic(TLServer tls, DebugDelegate dd)
{
debs = dd;
tl = tls;
// set defaults
PRI_bLoggedIntoMd = false;
PRI_bGotPriceIncrInfo = false;
PRI_oAccount = null;
PRI_bGotAccounts = false;
PRI_bLoggedIntoTs = false;
PRI_bOrderComplete = false;
}
示例10: Prompt
public static void Prompt(string program, string basepath, AuthInfo ai, bool pause, string promptmsg, DebugDelegate deb)
{
PROGRAM = program;
BASEPATH = basepath+"\\";
aip = new AuthInfoPrompt(ai);
aip.status(promptmsg);
aip.NewAuthInfo += new AuthInfoDelegate(aip_NewAuthInfo);
d = deb;
if (pause)
aip.ShowDialog();
else
aip.Show();
}
示例11: UploadTodaysTicks
/// <summary>
/// upload todays tickdata to a portal
/// </summary>
/// <param name="space"></param>
/// <param name="un"></param>
/// <param name="pw"></param>
/// <param name="ticket"></param>
/// <param name="workpath"></param>
/// <param name="debug"></param>
/// <returns></returns>
public static bool UploadTodaysTicks(string space, string un, string pw, int ticket, string workpath, DebugDelegate debug)
{
bool r = true;
try
{
List<string> files = TikUtil.GetFilesFromDate();
string fn = workpath + "\\TickData." + Util.ToTLDate() + ".zip";
r &= ZipFile(fn, files, string.Empty, debug);
if (TradeLink.AppKit.AssemblaDocument.Create(space, un, pw, fn, ticket, false))
{
if (debug != null)
{
debug("tick data upload succeeded for: " + fn);
}
}
else
{
if (debug != null)
{
r &= false;
debug("tick data upload failed for: " + fn);
}
}
if (System.IO.File.Exists(fn))
{
try
{
System.IO.File.Delete(fn);
}
catch (Exception ex)
{
r &= false;
if (debug != null)
{
debug("unable to delete local copy: " + fn);
debug(ex.Message + ex.StackTrace);
}
}
}
}
catch (Exception ex)
{
r &= false;
if (debug != null)
{
debug("unknown error uploading ticks. ");
debug(ex.Message + ex.StackTrace);
}
}
return r;
}
示例12: FromAssembly
/// <summary>
/// Create a single Response from an Assembly containing many Responses.
/// </summary>
/// <param name="a"></param>
/// <param name="fullname"></param>
/// <param name="deb"></param>
/// <returns></returns>
public static Response FromAssembly(System.Reflection.Assembly a, string fullname, DebugDelegate deb)
{
try
{
return FromAssembly(a, fullname);
}
catch (Exception ex)
{
if (deb != null)
{
deb(ex.Message + ex.StackTrace);
}
}
return null;
}
示例13: FromDLL
/// <summary>
/// Create a single Response from a DLL containing many Responses.
/// </summary>
/// <param name="fullname"></param>
/// <param name="dllname"></param>
/// <param name="deb"></param>
/// <returns></returns>
public static Response FromDLL(string fullname, string dllname, DebugDelegate deb)
{
try
{
return FromDLL(fullname, dllname);
}
catch (Exception ex)
{
if (deb != null)
{
deb(ex.Message + ex.StackTrace);
}
}
return null;
}
示例14: TLServer_IP
public TLServer_IP(string ipaddr, int port, int wait, int TickBufferSize, DebugDelegate deb)
{
SendDebugEvent = deb;
if (TickBufferSize == 0)
_queueb4send = false;
else
tickq = new RingBuffer<Tick>(TickBufferSize);
MinorVer = Util.ProgramBuild(Util.PROGRAM,debug);
_wait = wait;
if (!IPUtil.isValidAddress(ipaddr))
debug("Not valid ip address: " + ipaddr + ", using localhost.");
_addr = IPUtil.isValidAddress(ipaddr) ? IPAddress.Parse(ipaddr) : IPAddress.Loopback;
_port = port;
v("tlserver_ip wait: " + _wait);
Start();
}
示例15: run
public static RunHelper run(VoidDelegate start, VoidDelegate complete, DebugDelegate deb, string name)
{
debs = deb;
RunHelper rh = new RunHelper();
if (rh.isBusy)
{
debug("must wait until previous job completed. " + name);
return rh;
}
if (start == null)
throw new Exception("cannot pass a null start delegate to run helper!");
rh = new RunHelper(start, complete, deb, name);
rh.bw.RunWorkerAsync(rh);
return rh;
}