Esempio n. 1
0
        private async void ListBox_Drop(object sender, DragEventArgs e)
        {
            e.Handled = true;
            try
            {
                if (e.Data.GetDataPresent(DataFormats.FileDrop))
                {
                    string[] droppedFilePaths = e.Data.GetData(DataFormats.FileDrop, true) as string[];

                    foreach (string droppedFile in droppedFilePaths)
                    {
                        switch (System.IO.Path.GetExtension(droppedFile))
                        {
                        case ".wav":
                        case ".mp3":
                        case ".wma":
                        case ".aac":
                        case ".hca":
                            var cue = GetSelectedCue();
                            if (cue == null)
                            {
                                return;
                            }
                            var trackForm = new AddTrackForm(Application.Current.MainWindow, droppedFile);

                            while (!trackForm.IsDone)
                            {
                                await Task.Delay(50);
                            }

                            if (trackForm.Finished)
                            {
                                cue.UndoableAddTrackToCue(trackForm.HcaBytes, trackForm.Streaming, trackForm.Loop);
                            }
                            break;

                        default:
                            MessageBox.Show(String.Format("The filetype of the dropped file ({0}) is not supported.", System.IO.Path.GetExtension(droppedFilePaths[0])), "File Drop", MessageBoxButton.OK, MessageBoxImage.Error);
                            break;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(String.Format("The dropped file could not be opened.\n\nThe reason given by the system: {0}", ex.Message), "File Drop", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Esempio n. 2
0
        private async void AddTrackToCue()
        {
            var cue = GetSelectedCue();

            var trackForm = new AddTrackForm(Application.Current.MainWindow);

            trackForm.ShowDialog();

            while (!trackForm.IsDone)
            {
                await Task.Delay(50);
            }

            if (trackForm.Finished)
            {
                cue.UndoableAddTrackToCue(trackForm.HcaBytes, trackForm.Streaming, trackForm.Loop);
            }
        }
Esempio n. 3
0
        private async void ReplaceSelectedTrack()
        {
            var track = GetSelectedTrack(TrackType.Track);

            if (track != null)
            {
                var trackForm = new AddTrackForm(Application.Current.MainWindow);
                trackForm.ShowDialog();

                while (!trackForm.IsDone)
                {
                    await Task.Delay(50);
                }

                if (trackForm.Finished)
                {
                    track.UndoableReplaceTrack(trackForm.HcaBytes, trackForm.Streaming);
                }
            }
        }