private void MenuItem_Click_Open(object sender, RoutedEventArgs e) { var ofd = new OpenFileDialog(); Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog(); dlg.Filter = "All files|*.mp3; *.m4a; *.alac; *.ogg; *.flac; *.wma; *.wav; *.dsf; *.aif; *.aiff" + "|MP3 files (.mp3)|*.mp3" + "|ALAC Files (*.alac)|*.alac" + "|OGG Files (*.ogg)|*.ogg" + "|FLAC Files (*.flac)|*.flac" + "|WMA Files (*.wma)|*.wma" + "|WAV Files (*.wav)|*.wav" + "|AAC Files (*.m4a)|*.m4a" + "|Sony 1-bit Files (*.dsf)|*.dsf" + "|AIFF Files (*.aif; .aiff)| *.aif; *.aiff"; Nullable <bool> result = dlg.ShowDialog(); //if (dlg.ShowDialog() == false) { return; } if (dlg.FileName == "") { //MessageBox.Show("Empty field is not permissible", "File name error", MessageBoxButton.OK, MessageBoxImage.Error); return; } else { Vars.Files.Add(dlg.FileName); playlist.Items.Add(Vars.GetFileName(dlg.FileName)); } //Binding binding = new Binding(); //binding.ElementName = "progressBarPeakLeft"; //binding.Path = new PropertyPath("") }
// Простой обработчик данных - просто берет и проигрывает. private void Button_Click(object sender, RoutedEventArgs e) { var ofd = new OpenFileDialog(); Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog(); dlg.DefaultExt = ".wav"; dlg.Filter = "WAV files (.wav)|*.wav"; Nullable <bool> result = dlg.ShowDialog(); if (dlg.ShowDialog() == false) { return; } wave = new NAudio.Wave.WaveFileReader(dlg.FileName); output = new NAudio.Wave.DirectSoundOut(); output.Init(new NAudio.Wave.WaveChannel32(wave)); output.Play(); }
private void Button_Click_1(object sender, RoutedEventArgs e) { Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog(); dlg.DefaultExt = ".png"; dlg.Filter = "JPEG Files (*.jpeg)|*.jpeg|PNG Files (*.png)|*.png|JPG Files (*.jpg)|*.jpg"; Nullable <bool> result = dlg.ShowDialog(); if (result == true) { string filename = dlg.FileName; BitmapImage source = new BitmapImage(new Uri(filename)); browse.Source = source; putanjaSlike.Content = filename; } }
//------------------------------------------------------------------------------------------------------------------------------// // File section (Save, SaveAs, Open) >> room for improvement // //------------------------------------------------------------------------------------------------------------------------------// //---------------------------------------------------------------------------// // Still working on implementation >> looking for a way to optimize process // //---------------------------------------------------------------------------// private void OpenPDFFile_Click(object sender, RoutedEventArgs e) { Microsoft.Win32.OpenFileDialog openFileDlg = new Microsoft.Win32.OpenFileDialog(); // Launch OpenFileDialog by calling ShowDialog method Nullable<bool> result = openFileDlg.ShowDialog(); // Get the selected file name and display in a TextBox. Load content of file in a TextBlock if (result == true) { var filepath = openFileDlg.FileName; pdfloaded = new PdfLoadedDocument(filepath); PdfViewer.Load(pdfloaded); } }
private void ReplayClicked(object sender, RoutedEventArgs e) { var testKinect = DependencyFactory.Container.Resolve<TKinect.TKinect>(); if (replayStream != null) { replayStream.Dispose(); } Microsoft.Win32.OpenFileDialog fd = new Microsoft.Win32.OpenFileDialog(); fd.DefaultExt = ".xed"; // Display OpenFileDialog by calling ShowDialog method Nullable<bool> result = fd.ShowDialog(); // Get the selected file name and display in a TextBox if (result == true) { // Open document //replayStream = new FileStream(fd.FileName, FileMode.Open); //testKinect.Replay(replayStream); } }
private void ReplayClicked(object sender, RoutedEventArgs e) { var testKinect = DependencyFactory.Container.Resolve <TKinect.TKinect>(); if (replayStream != null) { replayStream.Dispose(); } Microsoft.Win32.OpenFileDialog fd = new Microsoft.Win32.OpenFileDialog(); fd.DefaultExt = ".xed"; // Display OpenFileDialog by calling ShowDialog method Nullable <bool> result = fd.ShowDialog(); // Get the selected file name and display in a TextBox if (result == true) { // Open document //replayStream = new FileStream(fd.FileName, FileMode.Open); //testKinect.Replay(replayStream); } }