コード例 #1
0
        private void PlayFile()
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter = "All Supported Files (*.wav;*.mp3)|*.wav;*.mp3|All Files (*.*)|*.*";
            bool?result = openFileDialog.ShowDialog();

            if (result.HasValue && result.Value)
            {
                string file = openFileDialog.FileName;
                audioGraph.PlayFile(file);
            }
        }
コード例 #2
0
        private void PlayFile()
        {
            var openFileDialog = new OpenFileDialog();

            openFileDialog.Filter = "All Supported Files (*.wav;*.mp3)|*.wav;*.mp3|All Files (*.*)|*.*";
            bool?result = openFileDialog.ShowDialog();

            if (result.HasValue && result.Value)
            {
                string file = openFileDialog.FileName;
                try
                {
                    audioGraph.PlayFile(file);
                    Title = string.Format("{0} - {1}", AppTitle, Path.GetFileNameWithoutExtension(file));
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.Message);
                    Title = AppTitle;
                }
            }
        }