def marking(pairs): marking_lst = List[KeyValuePair[Place, UInt32]]() for m in pairs: t = KeyValuePair[Place, UInt32](m[0], UInt32.Parse(str(m[1]))) marking_lst.Add(t) return Marking(marking_lst)
except Exception, e: Trace.WriteLine(e.clsException.Message) Trace.WriteLine(e.clsException.StackTrace) finally: task.Result.Response.Close() return None try: httpListener = HttpListener() httpListener.Prefixes.Add( String.Format( "http://localhost:{0}/", UInt32.Parse("B0B", NumberStyles.HexNumber).ToString( CultureInfo.InvariantCulture))) # localhost:2827 httpListener.Start() httpListener.GetContextAsync().ContinueWith[List[Entry]]( Func[Task[HttpListenerContext], List[Entry]](onDispatch), TaskContinuationOptions.LongRunning).ContinueWith( Action[Task[List[Entry]]](onCompleted), context) except Exception, e: Trace.WriteLine(e.clsException.Message) Trace.WriteLine(e.clsException.StackTrace) def onExit(sender, args): global sessionEnding, httpListener if not sessionEnding and httpListener is not None: