private void Connect(object sender, RoutedEventArgs e) { if (!lottery.Connected) { lottery.Connect(); } else { lottery.Stop(); } }