Пример #1
0
        /// <summary>
        /// It finds an array of paths to the files.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button2_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(labelFolder.Text))
            {
                MessageBox.Show("Please, choose a folder.");
                return;
            }

            string[] FilePaths = null;

            try
            {
                FilePaths = Directory.GetFiles(labelFolder.Text, textBoxMask.Text, SearchOption.AllDirectories);

                MessageToParentEventArgs args = new MessageToParentEventArgs();
                args.UrgentInfo = FilePaths;
                ReportInfo(this, args);
            }
            catch (SystemException ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                this.Close();
            }
        }
Пример #2
0
        /// <summary>
        /// It is a handler for information from second window.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void doWork(object sender, MessageToParentEventArgs e)
        {
            this.listBoxFile.Items.Clear();

            foreach (string filePath in e.UrgentInfo)
            {
                this.listBoxFile.Items.Add(Path.GetFileName(filePath));
            }
        }