Пример #1
0
//#7------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        private void Threadhandler()
        {
            try
            {
                BenchTimer.Start();
                ProgressBar1.Invoke(new Action <int>(s => { ProgressBar1.Minimum = s; }), 0);
                ProgressBar1.Invoke(new Action <int>(s => { ProgressBar1.Maximum = s; }), 1);
                ProgressBar1.Invoke(new Action <int>(s => { ProgressBar1.Value = s; }), 0);
                AllFilesToConvert.Clear();
                AllActionMessages.Clear();
                if (FilePath.Length > 0)
                {
                    ConvertString(FilePath);
                    ProgressBar1.Invoke(new Action <int>(s => { ProgressBar1.Value = s; }), 1);
                }
                if (FolderPath.Length > 0)
                {
                    CheckSubFolders(FolderPath);
                    ProgressBar1.Invoke(new Action <int>(s => { ProgressBar1.Maximum = s; }), AllFilesToConvert.Count - 1);
                    for (int i = 0; i < AllFilesToConvert.Count; i++)
                    {
                        ConvertString(AllFilesToConvert[i]);
                        ProgressBar1.Invoke(new Action <int>(s => { ProgressBar1.Value = s; }), i);
                    }
                }
                MethodInvoker AddItems = delegate
                {
                    for (int i = 0; i < AllActionMessages.Count; i++)
                    {
                        ActionBox.Items.Add(AllActionMessages[i]);
                    }
                };
                ActionBox.BeginInvoke(AddItems);
                BenchTimer.Stop();
                MessageBox.Show(string.Format(FinalMessage, ChangeCount, ChangedFileCount, BenchTimer.ElapsedMilliseconds.ToString()));
                BenchTimer.Reset();
                FileBrowse.Invoke(new Action <bool>(s => { FileBrowse.Enabled = s; }), true);
                FolderBrowse.Invoke(new Action <bool>(s => { FolderBrowse.Enabled = s; }), true);
                ConvertButton.Invoke(new Action <bool>(s => { ConvertButton.Enabled = s; }), true);
                OldStringTextBox.Invoke(new Action <bool>(s => { OldStringTextBox.Enabled = s; }), true);
                NewStringTextBox.Invoke(new Action <bool>(s => { NewStringTextBox.Enabled = s; }), true);
                CaseSensitiveCheckBox.Invoke(new Action <bool>(s => { CaseSensitiveCheckBox.Enabled = s; }), true);
                WholeWordCheckBox.Invoke(new Action <bool>(s => { WholeWordCheckBox.Enabled = s; }), true);
                if (!SourceFilePathBox.Text.Equals(TempPath))
                {
                    SourceBrowse.Invoke(new Action <bool>(s => { SourceBrowse.Enabled = s; }), true);
                    DownloadSourceButton.Invoke(new Action <bool>(s => { DownloadSourceButton.Enabled = s; }), true);
                }
            }
            catch
            {
            }
        }
Пример #2
0
        private void btnTarget_Click(object sender, EventArgs e)
        {
            DialogResult result = FolderBrowse.ShowDialog();

            if (result == DialogResult.OK)
            {
                //Destination path
                targetlocation = FolderBrowse.SelectedPath;
                //Displaying the source path in the text box
                txtTarget.Paste(targetlocation);
            }
        }