예제 #1
0
        public void OpenWAV()
        {
            OutputLogs logs = OutputLogs.Instance();

            OpenFileDialogService.Filter      = "Wav Files (.wav)|*.wav|All Files (*.*)|*.*";
            OpenFileDialogService.FilterIndex = 1;
            OpenFileDialogService.Title       = "Open target audio";
            if (OpenFileDialogService.ShowDialog())
            {
                IFileInfo file   = OpenFileDialogService.Files.First();
                WavReader reader = null;
                try
                {
                    reader        = new WavReader(File.Open(file.GetFullName(), FileMode.Open, FileAccess.Read, FileShare.None));
                    Audio         = reader.ReadAudio();
                    AudioFileName = file.Name;
                    string msg = string.Concat("Succesfully loaded file - ", file.GetFullName());
                    logs.AddLog(new Message(MessageType.Info, msg, "WavReader"));
                }
                catch (ApplicationException ex)
                {
                    logs.AddLog(new Message(MessageType.Error, ex.Message, ex.Source));
                }
                finally
                {
                    if (reader != null)
                    {
                        reader.Dispose();
                    }
                }
            }
        }
예제 #2
0
        private void ImportFileIntoFolder(IFileInfo file)
        {
            var      fullFileName = file.GetFullName();
            Document doc          = new Document
            {
                CustomerID       = SelectedDocumentFolder.CustomerID,
                DocumentFolderID = SelectedDocumentFolder.ID,
                DocumentFileName = file.Name,
                FileTimestamp    = File.GetLastWriteTime(fullFileName),
                UploadDate       = DateTime.Today,
                FileType         = Document.GetFileType(file.Name)
            };

            doc.SaveChanges();
            doc.UploadRawDataFromFile(fullFileName);
        }
예제 #3
0
        private string FindFile()
        {
            IOpenFileDialogService OpenFileDialogService = new OpenFileDialogService
            {
                Filter      = "Text Files (.csv)|*.csv|All Files (*.*)|*.*",
                FilterIndex = 1,
                Title       = "Test Dialog",
            };


            var DialogResult = OpenFileDialogService.ShowDialog();

            if (!DialogResult)
            {
                return(string.Empty);
            }
            else
            {
                IFileInfo file = OpenFileDialogService.Files.First();
                return(file.GetFullName());
            }
        }