当前位置: 首页>>代码示例>>C#>>正文


C# Interp.getAssocData方法代码示例

本文整理汇总了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;
//.........这里部分代码省略.........
开发者ID:R4P3NET,项目名称:TS3SRV-ASE,代码行数:101,代码来源:AfterCmd.cs


注:本文中的tcl.lang.Interp.getAssocData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。