本文整理汇总了C#中System.Threading.Timer.?.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# Timer.?.Dispose方法的具体用法?C# Timer.?.Dispose怎么用?C# Timer.?.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Threading.Timer
的用法示例。
在下文中一共展示了Timer.?.Dispose方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AutoCheckSyntaxBackground
public void AutoCheckSyntaxBackground()
{
if (PtrScriptFrame == IntPtr.Zero || TB.IsDisposed || !TB.IsHandleCreated || !IsHandleCreated) return;
if (CheckSyntaxIsBusy) { CheckSyntaxAgain = true; return; }
CheckSyntaxIsBusy = true;
t = new Timer(TimeoutCheckSyntax, null, 3000, Timeout.Infinite);
object objScriptName = new BStrWrapper(ScriptLanguage);
object objScriptText = new BStrWrapper(TB.Text);
object objErrorMessage = new BStrWrapper("");
var th = new Thread(() =>
{
try {
int nErrorLine = 0;
int nErrorChar = 0;
int nResult = 0;
IHmsScriptFrame scriptFrame1 = (IHmsScriptFrame)System.Runtime.Remoting.Services.EnterpriseServicesHelper.WrapIUnknownWithComObject(PtrScriptFrame);
scriptFrame1.CompileScript(ref objScriptName, ref objScriptText, ref objErrorMessage, ref nErrorLine, ref nErrorChar, ref nResult);
CheckSyntaxArgs args = new CheckSyntaxArgs();
if (nResult == 0) {
args.ErrorChar = Math.Max(0, nErrorChar - 1);
args.ErrorLine = Math.Max(0, nErrorLine - 1);
args.ErrorMessage = objErrorMessage.ToString();
}
TB.Invoke((MethodInvoker)delegate {
t?.Dispose();
if (args.ErrorMessage.Length > 0)
TB.SetErrorLines(args.ErrorChar, args.ErrorLine, args.ErrorMessage);
else
TB.ClearErrorLines();
CheckSyntaxIsBusy = false;
if (CheckSyntaxAgain) {
CheckSyntaxAgain = false;
AutoCheckSyntaxBackground();
}
});
} catch /*(Exception e)*/ {
TB.ClearErrorLines();
//HMS.LogError(e.ToString());
}
}, 10);
th.Start();
}