static async Task Run() { var guidBot = new GuidBot(); guidBot.MessageReceived += (sender, args) => System.Console.WriteLine("{0} : {1}", args.UserName, args.Text); await guidBot.Start(); }
private async void btnStart_Click(object sender, EventArgs e) { if (_bot.State == BotState.Stopped) { btnStart.Enabled = false; btnStop.Enabled = true; Task.Factory.StartNew(() => _bot.Start()).ConfigureAwait(false); txtLog.AppendText("Старт!" + Environment.NewLine); } }
private async Task RunBot() { var guidBot = new GuidBot(); await guidBot.Start(); }