예제 #1
0
        private void buttonStart_Click(object sender, EventArgs e)
        {
            buttonStart.Enabled  = false;
            buttonCancel.Enabled = true;
            _cancel  = false;
            _generic = new BuildResult("Batch Builder");
            bool b = TraceLogClass.TraceLog.ShowMessageBox;

            TraceLogClass.TraceLog.ShowMessageBox = false;
            try
            {
                string bf = txtBatch.Text.Trim();
                treeView1.Nodes.Clear();
                treeView1.Nodes.Add(_generic.Node);
                if (bf.Length > 0)
                {
                    textBoxRootDir.ReadOnly = true;
                    StreamReader sr = new StreamReader(bf);
                    while (!sr.EndOfStream)
                    {
                        string line = sr.ReadLine();
                        if (!string.IsNullOrEmpty(line))
                        {
                            textBoxRootDir.Text = line;
                            textBoxRootDir.Refresh();
                            processFolder(line);
                        }
                    }
                    sr.Close();
                }
                else
                {
                    processFolder(textBoxRootDir.Text);
                }
            }
            catch (Exception err)
            {
                _generic.SetError(err.Message);
            }
            finally
            {
                TraceLogClass.TraceLog.ShowMessageBox = b;
            }
            _generic.End();

            for (int i = 1; i < 8; i++)
            {
                SystemSounds.Exclamation.Play();
            }
            MessageBox.Show("Finished");
            textBoxRootDir.ReadOnly = false;
            buttonStart.Enabled     = true;
            buttonCancel.Enabled    = false;
        }
        private void buttonStart_Click(object sender, EventArgs e)
        {
            buttonStart.Enabled  = false;
            buttonCancel.Enabled = true;
            _cancel  = false;
            _generic = new BuildResult("Batch Builder");
            bool b = TraceLogClass.TraceLog.ShowMessageBox;

            TraceLogClass.TraceLog.ShowMessageBox = false;
            _slnCount          = 0;
            _slnProcessed      = 0;
            progressBar1.Value = 0;
            progressBar1.Refresh();
            lblCounts.Text = "0/0";
            lblCounts.Refresh();
            try
            {
                string bf = txtBatch.Text.Trim();
                treeView1.Nodes.Clear();
                treeView1.Nodes.Add(_generic.Node);
                if (bf.Length > 0)
                {
                    textBoxRootDir.ReadOnly = true;
                    StringCollection sc = new StringCollection();
                    StreamReader     sr = new StreamReader(bf);
                    while (!sr.EndOfStream)
                    {
                        string line = sr.ReadLine();
                        if (!string.IsNullOrEmpty(line))
                        {
                            textBoxRootDir.Text = line;
                            textBoxRootDir.Refresh();
                            processFolder(line, true);
                            sc.Add(line);
                        }
                    }
                    sr.Close();
                    lblCounts.Text = string.Format(CultureInfo.InvariantCulture, "0/{0}", _slnCount);
                    lblCounts.Refresh();
                    foreach (string line in sc)
                    {
                        textBoxRootDir.Text = line;
                        textBoxRootDir.Refresh();
                        processFolder(line, false);
                    }
                }
                else
                {
                    processFolder(textBoxRootDir.Text, true);
                    lblCounts.Text = string.Format(CultureInfo.InvariantCulture, "0/{0}", _slnCount);
                    lblCounts.Refresh();
                    processFolder(textBoxRootDir.Text, false);
                }
            }
            catch (Exception err)
            {
                _generic.SetError(err.Message);
            }
            finally
            {
                TraceLogClass.TraceLog.ShowMessageBox = b;
            }
            _generic.End();

            for (int i = 1; i < 8; i++)
            {
                SystemSounds.Exclamation.Play();
            }
            MessageBox.Show("Finished");
            textBoxRootDir.ReadOnly = false;
            buttonStart.Enabled     = true;
            buttonCancel.Enabled    = false;
        }