public App() { // The root page of your application MainPage = new ContentPage { Content = new StackLayout { VerticalOptions = LayoutOptions.Center, Children = { new Label { XAlign = TextAlignment.Center, Text = "Click to play a sound!" }, new Button { Text = "Play", Command = new Command(async() =>{ var soundService = new SoundService(); await soundService.PlaySoundAsync("sound.mp3"); }) } } } }; }
public App() { // The root page of your application MainPage = new ContentPage { Content = new StackLayout { VerticalOptions = LayoutOptions.Center, Children = { new Label { XAlign = TextAlignment.Center, Text = "Click to play a sound!" }, new Button{ Text = "Play", Command = new Command(async () => { var soundService = new SoundService(); await soundService.PlaySoundAsync("sound.mp3"); }) } } } }; }