private void btn_Browse_Click(object sender, EventArgs e) { Microsoft.Office.Core.FileDialog fileDialog = ppApp.get_FileDialog(MsoFileDialogType.msoFileDialogFolderPicker); fileDialog.InitialFileName = "c:\\Temp\\"; int nres = fileDialog.Show(); if (nres == -1) //ok { FileDialogSelectedItems selectedItems = fileDialog.SelectedItems; string[] selectedFolders = selectedItems.Cast <string>().ToArray(); if (selectedFolders.Length > 0) { selectedFolder = selectedFolders[0]; } string[] fileEntries = Directory.GetFiles(selectedFolder); foreach (string fileName in fileEntries) { if (Path.GetExtension(fileName) == ".pptx") { fileGridView.Rows.Add(Path.GetFileName(fileName)); } } foreach (DataGridViewRow row in fileGridView.Rows) { DataGridViewCheckBoxCell chk = (DataGridViewCheckBoxCell)row.Cells[2]; chk.Value = !(chk.Value == null ? false : (bool)chk.Value); //because chk.Value is initialy null } } this.Width = 395; this.Height = 430; }
/// <summary>Exports modules from specified Access databases to eponymous subdirectories.</summary> /// <remarks> /// </remarks> public override void ExtractProjects(FileDialogSelectedItems items, bool destIsSrc) { if (items == null) { throw new ArgumentNullException(nameof(items)); } using (var app = new AccessWrapper()) { if (app == null) { throw new NotSupportedException("MS-Access not available on this machine."); } foreach (string item in items) { ExtractProject(app, item, destIsSrc); } } }
/// <inheritdoc/> public abstract void ExtractProjects(FileDialogSelectedItems items, bool destIsSrc);
public VbaExportSelectedEventArgs(ProjectFilter filter, FileDialogSelectedItems files) : base(filter) => Files = files;