Ejemplo n.º 1
0
 public OpenFileDialogResult ShowOpenFileDialog(OpenFileDialogParameters openFileDialogParameters)
 {
     if (openFileDialogParameters == null)
         throw new ArgumentNullException("openFileDialogParameters");
     OpenFileDialog openFileDialog = new OpenFileDialog();
     if (!String.IsNullOrEmpty(openFileDialogParameters.Filter))
         openFileDialog.Filter = openFileDialogParameters.Filter;
     openFileDialog.Multiselect = openFileDialogParameters.Multiselect;
     if (!String.IsNullOrEmpty(openFileDialogParameters.InitialDirectory))
         openFileDialog.InitialDirectory = openFileDialogParameters.InitialDirectory;
     OpenFileDialogResult result = new OpenFileDialogResult();
     result.DialogResult = openFileDialog.ShowDialog() == true;
     result.SelectedFilePaths = result.DialogResult ? openFileDialog.FileNames.ToList() : new List<string>();
     return result;
 }
Ejemplo n.º 2
0
 private void AddBook()
 {
     OpenFileDialogParameters openFileDialogParameters = new OpenFileDialogParameters
     {
         Filter = "EPUB files (*.epub)|*.epub|All files (*.*)|*.*",
         Multiselect = true
     };
     OpenFileDialogResult openDialogResult = windowManager.ShowOpenFileDialog(openFileDialogParameters);
     if (openDialogResult.DialogResult)
     {
         foreach (string selectedFilePath in openDialogResult.SelectedFilePaths)
             libraryModel.AddBookToLibrary(selectedFilePath);
         RefreshLibrary();
     }
 }
Ejemplo n.º 3
0
        public OpenFileDialogResult ShowOpenFileDialog(OpenFileDialogParameters openFileDialogParameters)
        {
            if (openFileDialogParameters == null)
            {
                throw new ArgumentNullException("openFileDialogParameters");
            }
            OpenFileDialog openFileDialog = new OpenFileDialog();

            if (!String.IsNullOrEmpty(openFileDialogParameters.Filter))
            {
                openFileDialog.Filter = openFileDialogParameters.Filter;
            }
            openFileDialog.Multiselect = openFileDialogParameters.Multiselect;
            if (!String.IsNullOrEmpty(openFileDialogParameters.InitialDirectory))
            {
                openFileDialog.InitialDirectory = openFileDialogParameters.InitialDirectory;
            }
            OpenFileDialogResult result = new OpenFileDialogResult();

            result.DialogResult      = openFileDialog.ShowDialog() == true;
            result.SelectedFilePaths = result.DialogResult ? openFileDialog.FileNames.ToList() : new List <string>();
            return(result);
        }