コード例 #1
0
        /// <summary>
        /// Execute code on a console.
        /// </summary>
        /// <param name="uid">Id for console.</param>
        /// <param name="code">Code to execute.</param>
        public static void Execute(Guid uid, string code)
        {
            PyConsole c = consoles[uid];

            if (c != null)
            {
                dynamic r = c.Execute(code);
                if (r != null)
                {
                    c.notify(Convert.ToString(r));
                }
                c.notify(EOT);
                // write to stream ("\EOT");
                // in client, on message receive "\EOT", print next line with prompt
            }
        }
コード例 #2
0
 /// <summary>
 /// Register a event handler.
 /// </summary>
 /// <param name="uid">Id for console.</param>
 /// <param name="handler">Event handler to register.</param>
 public static void Register(Guid uid, EventHandler <StreamNotificationEvent> handler)
 {
     consoles[uid] = new PyConsole(handler);
 }