First time using the API!

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Lego.Ev3.Core;
using Lego.Ev3.Desktop;

namespace andre_probeer_lego_ev3
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
private Brick _brick;
Int16 _vooruit = 5;
Int16 _achteruit = -5;
Int16 _snelheid = 10;
uint _tijd = 1000;

public MainWindow()

private async void Grid_Loaded(object sender, RoutedEventArgs e)
_brick = new Brick(new NetworkCommunication(""));
_brick.BrickChanged += _brick_BrickChanged;
await _brick.ConnectAsync();
await _brick.DirectCommand.PlayToneAsync(20, 850, 1000);
Project.Content = "Lego EV3 PA0AKV 2013";
Display.Content = "Start";


void _brick_BrickChanged(object sender, BrickChangedEventArgs e)
//throw new NotImplementedException();


private async void Achteruit_Click(object sender, RoutedEventArgs e)
await _brick.DirectCommand.TurnMotorAtPowerForTimeAsync(OutputPort.B | OutputPort.C,_achteruit,_tijd, false);

private async void Vooruit_Click(object sender, RoutedEventArgs e)
await _brick.DirectCommand.TurnMotorAtPowerForTimeAsync(OutputPort.B | OutputPort.C, _vooruit, _tijd, false);

private async void Links_Click(object sender, RoutedEventArgs e)
_brick.BatchCommand.TurnMotorAtPowerForTime(OutputPort.B, _vooruit, _tijd, false);
_brick.BatchCommand.TurnMotorAtPowerForTime(OutputPort.C, _achteruit, _tijd, false);
await _brick.BatchCommand.SendCommandAsync();

private async void Rechts_Click(object sender, RoutedEventArgs e)
_brick.BatchCommand.TurnMotorAtPowerForTime(OutputPort.C, _vooruit, _tijd, false);
_brick.BatchCommand.TurnMotorAtPowerForTime(OutputPort.B, _achteruit, _tijd, false);
await _brick.BatchCommand.SendCommandAsync();

private void Regelaar_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
_snelheid = Convert.ToInt16(Regelaar.Value);
Display.Content = Regelaar.Value;
Vooruit1.Content = _snelheid;
Achteruit1.Content = _snelheid * -1;
_vooruit = _snelheid;
_achteruit =Convert.ToInt16(_vooruit * -1);


It opens a form and with the slider you can manage the speed!

It is important to change the wifi IP adress otherwise the brick cannot connect! Perplexed

If you like the program I can mail it to you!

This is my first C# program and it is not documented yet but it will come!