public static CopyFileInterface GetCopyFileTool()
 {
     if (tool == null)
     {
         tool = new CopyFileImpl();
     }
     return(tool);
 }
Пример #2
0
        private void button3_Click(object sender, EventArgs e)
        {
            if (textBox1.Text.Length == 0 || textBox2.Text.Length == 0)
            {
                MessageBox.Show("请选择原文件路径或目的文件路径。");
                return;
            }
            str = textBox1.Text;//记录源文件的路径
            // 工厂模式
            CopyFileInterface copyFile = FactoryCopyFileTool.GetCopyFileTool();

            str        = copyFile.extractFileName(str);
            thdAddFile = new Thread(new ThreadStart(SetAddFile)); //创建一个线程
            thdAddFile.Start();                                   //执行当前线程
        }