public MainWindow() { DataManager.InitializeDatabase(); _viewModel = new MainViewModel(); InitializeComponent(); DataContext = _viewModel; }
public BetWorker(MainViewModel viewModel) { _viewModel = viewModel; _bets = new List<Bet>(); _users = new List<User>(); _ircClient = new IrcClient(); _ircClient.Connect(_server, _port); _ircClient.WriteLine(Rfc2812.Nick(_botName), Priority.Critical); _ircClient.WriteLine(Rfc2812.User(_botName, 0, _botName), Priority.Critical); _ircClient.WriteLine(Rfc2812.Join(_channel)); _listenThread = new Thread(() => { _ircClient.OnChannelMessage += _ircClient_OnChannelMessage; _ircClient.OnJoin += _ircClient_OnJoin; _ircClient.OnPart += _ircClient_OnPart; _ircClient.OnQuit += _ircClient_OnQuit; _ircClient.Listen(); }); _listenThread.Start(); }