示例#1
0
        protected override void OnStart(string[] args)
        {
            EventLog.WriteEntry("begin");
            HTMLParser24score parser = new HTMLParser24score();

            EventLog.WriteEntry("parser created");
            this.htmlParserThread = new Thread(new ThreadStart(() => parser.Parse()));
            EventLog.WriteEntry("thread init");
            this.htmlParserThread.Start();
            EventLog.WriteEntry("started");
        }
        public static async Task Run()
        {
            JsonParser        jsonParser = new JsonParser();
            HTMLParser24score htmlParser = new HTMLParser24score();

            List <Task> tasks = new List <Task>();

            tasks.Add(Task.Factory.StartNew(() =>
            {
                jsonParser.StartParser();
            }));

            tasks.Add(Task.Factory.StartNew(() =>
            {
                htmlParser.Parse();
            }));

            await Task.WhenAll(tasks);
        }