Ejemplo n.º 1
0
        //File Drop (messy duplication, for now...)
        private async void DataGrid_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":
                            AddCueForm form = new AddCueForm(Application.Current.MainWindow, droppedFile, true);

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

                            if (form.Finished)
                            {
                                if (form.AddTrack)
                                {
                                    AcbFile.UndoableAddCue(form.CueName, form.ReferenceType, form.HcaBytes, form.Streaming, form.Loop, false);
                                }
                                else
                                {
                                    AcbFile.UndoableAddCue(form.CueName, form.ReferenceType, false);
                                }
                            }
                            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);
            }
        }
Ejemplo n.º 2
0
        private async void AddNewCue()
        {
            AddCueForm form = new AddCueForm(Application.Current.MainWindow, string.Format("cue_{0}", AcbFile.AcbFile.GetFreeCueId()));

            form.ShowDialog();

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

            if (form.Finished)
            {
                if (form.AddTrack)
                {
                    AcbFile.UndoableAddCue(form.CueName, form.ReferenceType, form.HcaBytes, form.Streaming, form.Loop, form.Is3DSound);
                }
                else
                {
                    AcbFile.UndoableAddCue(form.CueName, form.ReferenceType, form.Is3DSound);
                }
            }
        }