Example #1
0
        public void cargarLista(string path)
        {
            string[] filters = new[] { "*.txt", "*.hf" };
            string[] files = filters.SelectMany(f => Directory.GetFiles(path, f)).ToArray();

            if (files.Length == 0)
            {
                MessageBox.Show("No existen archivos selecciona otra carpeta", "Informacion");
            }

            if (files.Length > 0)
            {
                List<Archivo> listaArchivos = new List<Archivo>();
                foreach (string a in files)
                {
                    Archivo archivo = new Archivo(a);
                    listaArchivos.Add(archivo);
                }
                listBox.ItemsSource = listaArchivos;
            }
        }
Example #2
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            TextBoxChar.Text = "";
            TextBoxCompress.Text = "";
            TextBoxSource.Text = "";
            FinalString = "";
            VistaFolderBrowserDialog dlg = new VistaFolderBrowserDialog();
            //dlg.SelectedPath = Properties.Settings.Default.StoreFolder;
            dlg.ShowNewFolderButton = true;

            if (dlg.ShowDialog() == true)
            {
                string path = dlg.SelectedPath;
                actualPath = path;

                string[] filters = new[] { "*.txt", "*.hf" };
                string[] files = filters.SelectMany(f => Directory.GetFiles(path, f)).ToArray();

                if (files.Length == 0)
                {
                    MessageBox.Show("No existen archivos selecciona otra carpeta", "Informacion");
                }

                if (files.Length > 0)
                {
                    List<Archivo> listaArchivos = new List<Archivo>();
                    foreach (string a in files)
                    {
                        Archivo archivo = new Archivo(a);
                        listaArchivos.Add(archivo);
                    }
                    listBox.ItemsSource = listaArchivos;
                }
            }
        }