本文整理汇总了C#中tcl.lang.Interp.getAssocData方法的典型用法代码示例。如果您正苦于以下问题:C# Interp.getAssocData方法的具体用法?C# Interp.getAssocData怎么用?C# Interp.getAssocData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tcl.lang.Interp
的用法示例。
在下文中一共展示了Interp.getAssocData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: cmdProc
public TCL.CompletionCode cmdProc( Interp interp, TclObject[] argv )
{
int i;
Notifier notifier = (Notifier)interp.getNotifier();
Object info;
if ( assocData == null )
{
/*
* Create the "after" information associated for this
* interpreter, if it doesn't already exist.
*/
assocData = (AfterAssocData)interp.getAssocData( "tclAfter" );
if ( assocData == null )
{
assocData = new AfterAssocData( this );
interp.setAssocData( "tclAfter", assocData );
}
}
if ( argv.Length < 2 )
{
throw new TclNumArgsException( interp, 1, argv, "option ?arg arg ...?" );
}
/*
* First lets see if the command was passed a number as the first argument.
*/
bool isNumber = false;
int ms = 0;
if ( argv[1].InternalRep is TclInteger )
{
ms = TclInteger.get( interp, argv[1] );
isNumber = true;
}
else
{
string s = argv[1].ToString();
if ( ( s.Length > 0 ) && ( System.Char.IsDigit( s[0] ) ) )
{
ms = TclInteger.get( interp, argv[1] );
isNumber = true;
}
}
if ( isNumber )
{
if ( ms < 0 )
{
ms = 0;
}
if ( argv.Length == 2 )
{
/*
* Sleep for at least the given milliseconds and return.
*/
long endTime = System.DateTime.Now.Ticks / 10000 + ms;
while ( true )
{
try
{
System.Threading.Thread.Sleep( ms );
return TCL.CompletionCode.RETURN;
}
catch ( System.Threading.ThreadInterruptedException e )
{
/*
* We got interrupted. Sleep again if we havn't slept
* long enough yet.
*/
long sysTime = System.DateTime.Now.Ticks / 10000;
if ( sysTime >= endTime )
{
return TCL.CompletionCode.RETURN;
}
ms = (int)( endTime - sysTime );
continue;
}
}
}
TclObject cmd = getCmdObject( argv );
cmd.preserve();
assocData.lastAfterId++;
TimerInfo timerInfo = new TimerInfo( this, notifier, ms );
timerInfo.interp = interp;
timerInfo.command = cmd;
timerInfo.id = assocData.lastAfterId;
assocData.handlers.Add( timerInfo );
interp.setResult( "after#" + timerInfo.id );
return TCL.CompletionCode.RETURN;
//.........这里部分代码省略.........