private async void Remove_Item(object sender, RoutedEventArgs e) { var res = ResourceLoader.GetForCurrentView(); this.ErrorBox.Text = string.Empty; ContentDialog dialog = new ContentDialog { Title = res.GetString("SongPage/DeleteDialog/Title"), Content = res.GetString("SongPage/DeleteDialog/Content"), PrimaryButtonText = res.GetString("SongPage/DeleteDialog/Confirm"), CloseButtonText = res.GetString("SongPage/DeleteDialog/Cancel"), }; var result = await dialog.ShowAsync(); if (result == ContentDialogResult.Primary) { var item = (KeyValuePair <string, string>)((FrameworkElement)sender).DataContext; bool fileRemoved = await SongPagesHelper.RemoveFileAsync(item.Key).ConfigureAwait(true); if (!fileRemoved) { this.ErrorBox.Text = res.GetString("SongPage/DeleteSong/Error"); return; } await SongPagesHelper.FillListBoxAsync(this.SongsListBox, null, this.Next).ConfigureAwait(false); } }
private async void File_Drop(object sender, DragEventArgs e) { var songFilePath = await SongPagesHelper.UploadSongDropAsync(e).ConfigureAwait(true); if (songFilePath != null) { await SongPagesHelper.FillListBoxAsync(this.SongsListBox, songFilePath, this.Next).ConfigureAwait(true); } }
private async void FilePicker_Click(object sender, RoutedEventArgs e) { this.ErrorBox.Text = string.Empty; var songFilePath = await SongPagesHelper.UploadSongAsync().ConfigureAwait(true); if (songFilePath != null) { await SongPagesHelper.FillListBoxAsync(this.SongsListBox, songFilePath, this.Next).ConfigureAwait(false); } }
private async void FilePicker_Click(object sender, RoutedEventArgs e) { var songFilePath = await SongPagesHelper.UploadSongAsync().ConfigureAwait(true); UserData.Song = this.SongsListBox.SelectedValue.ToString(); Thread.Sleep(1000); if (songFilePath != null) { SongPagesHelper.FillListBoxAsync(this.SongsListBox, songFilePath, null).GetAwaiter().GetResult(); } }
private void BtnJoin_Click(object sender, RoutedEventArgs e) { if (!string.IsNullOrWhiteSpace(this.txtNickName.Text) && !MultiPlayerData.OtherPlayers.ContainsKey(this.txtNickName.Text)) { UserData.NickName = this.txtNickName.Text; this.lblNickname.Text = UserData.NickName; this.ShowHideNickNameEntered(); this.ShowOrHideSongSelection(true); NetworkDataSender.SendPlayerInfo(); _ = SongPagesHelper.FillListBoxAsync(this.SongsListBox, null, null).Id; } }
/// <summary> /// Initializes a new instance of the <see cref="SongPage"/> class. /// </summary> public SongPage() { this.InitializeComponent(); _ = SongPagesHelper.FillListBoxAsync(this.SongsListBox, null, this.Next).Id; }