public App() { InitializeComponent(); MainPage = new BTBulldozer.MainPage(); }
public MainPage() { this.InitializeComponent(); var app = new BTBulldozer.App(); mainPage = app.MainPage as BTBulldozer.MainPage; mainPage.OnConnect += async(sender, e, address) => { await Connect(address); }; mainPage.OnDisconnect += async(sender, e) => { await Disconnect(); }; mainPage.OnForward += async(sender, e) => { if (socket is null) { return; } var writer = new DataWriter(socket.OutputStream); writer.WriteBytes(Command.FORWARD); await writer.StoreAsync(); }; mainPage.OnBack += async(sender, e) => { if (socket is null) { return; } var writer = new DataWriter(socket.OutputStream); writer.WriteBytes(Command.BACK); await writer.StoreAsync(); }; mainPage.OnRight += async(sender, e) => { if (socket is null) { return; } var writer = new DataWriter(socket.OutputStream); writer.WriteBytes(Command.RIGHT); await writer.StoreAsync(); }; mainPage.OnLeft += async(sender, e) => { if (socket is null) { return; } var writer = new DataWriter(socket.OutputStream); writer.WriteBytes(Command.LEFT); await writer.StoreAsync(); }; mainPage.OnStop += async(sender, e) => { if (socket is null) { return; } var writer = new DataWriter(socket.OutputStream); writer.WriteBytes(Command.STOP); await writer.StoreAsync(); }; mainPage.OnUp += async(sender, e) => { if (socket is null) { return; } var writer = new DataWriter(socket.OutputStream); writer.WriteBytes(Command.UP); await writer.StoreAsync(); }; mainPage.OnDown += async(sender, e) => { if (socket is null) { return; } var writer = new DataWriter(socket.OutputStream); writer.WriteBytes(Command.DOWN); await writer.StoreAsync(); }; mainPage.OnKeep += async(sender, e) => { if (socket is null) { return; } var writer = new DataWriter(socket.OutputStream); writer.WriteBytes(Command.KEEP); await writer.StoreAsync(); }; LoadApplication(app); }