Example #1
0
        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);
            }
        }
Example #2
0
        private async void BtnChangeInstrument_Click(object sender, RoutedEventArgs e)
        {
            this.AddOptionChangeFlag();

            await SongPagesHelper.AddMidiAsync().ConfigureAwait(true);

            _ = this.Frame.Navigate(typeof(InstrumentsPage), null, new DrillInNavigationTransitionInfo());
        }
Example #3
0
        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);
            }
        }
Example #4
0
 private void BtnUseSelectedSong_Click(object sender, RoutedEventArgs e)
 {
     UserData.Song = this.SongsListBox.SelectedValue.ToString();
     _             = SongPagesHelper.AddMidiAsync(this.sendTheSongToOtherPlayers).ConfigureAwait(true);
     this.lblReceivedSongName.Text           = Path.GetFileNameWithoutExtension(UserData.Song);
     this.lblReceivedSongName.Visibility     = Visibility.Visible;
     this.lblReceivedSongNameText.Visibility = Visibility.Visible;
     this.ShowOrHideSongSelection(false);
     this.btnStartMultiplayerGame.Visibility = Visibility.Visible;
 }
Example #5
0
        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);
            }
        }
Example #6
0
        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();
            }
        }
Example #7
0
 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;
     }
 }
Example #8
0
        /// <summary>
        /// SetSongFromNetwork.
        /// </summary>
        /// <param name="args">MidiFileReceivedEventArguments.</param>
        private async void SetSongFromNetwork(MidiFileReceivedEventArguments args) => await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(
            CoreDispatcherPriority.Normal,
            async() =>
        {
            this.ShowOrHideSongSelection(false);
            this.lblReceivedSongName.Text           = Path.GetFileNameWithoutExtension(args.FilePath);
            this.lblReceivedSongName.Visibility     = Visibility.Visible;
            this.lblReceivedSongNameText.Visibility = Visibility.Visible;

            UserData.Song = args.FilePath;
            await SongPagesHelper.AddMidiAsync().ConfigureAwait(true);
            this.sendTheSongToOtherPlayers          = false;
            this.btnStartMultiplayerGame.Visibility = Visibility.Visible;
        });
Example #9
0
        private async void NextButton_Click(object sender, RoutedEventArgs e)
        {
            this.ErrorBox.Text = string.Empty;
            var selectedValue = this.SongsListBox.SelectedValue;

            if (selectedValue != null)
            {
                UserData.Song = selectedValue.ToString();
                await SongPagesHelper.AddMidiAsync().ConfigureAwait(true);

                _ = this.Frame.Navigate(typeof(DurationPage), null, new DrillInNavigationTransitionInfo());
            }

            this.Next.IsEnabled = false;
        }
Example #10
0
        private async void BtnChangeLaneSettings_Click(object sender, RoutedEventArgs e)
        {
            await SongPagesHelper.AddMidiAsync().ConfigureAwait(true);

            _ = this.Frame.Navigate(typeof(LaneSettingsPage), null, new DrillInNavigationTransitionInfo());
        }
Example #11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SongPage"/> class.
 /// </summary>
 public SongPage()
 {
     this.InitializeComponent();
     _ = SongPagesHelper.FillListBoxAsync(this.SongsListBox, null, this.Next).Id;
 }