Exemplo n.º 1
0
        public void copyConfig()
        {
            string    applationPath = AppDomain.CurrentDomain.BaseDirectory;
            FIlesCopy filesCopy     = new FIlesCopy(applationPath + "Config", applationPath + "Release");

            filesCopy.beginCopyFiles();
        }
Exemplo n.º 2
0
        public void filesCopy(object filescopy)
        {
            bool s = true;

            while (s)
            {
                while (threadTag == 1)
                {
                    FIlesCopy filecopy = (FIlesCopy)filescopy;
                    filecopy.beginCopyFiles();
                    DialogResult resault = MessageBox.Show("升级已完成是否重新启动程序", "重启程序", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
                    if (resault == DialogResult.OK)
                    {
                        Process.Start(FileName.Substring(0, FileName.LastIndexOf("\\")) + "\\GPSTran.exe");
                        Process.GetCurrentProcess().CloseMainWindow();
                        Application.Exit();
                    }
                    else
                    {
                        Application.Exit();
                    }

                    threadTag = 0;
                    s         = false;
                    break;
                }
            }
        }
Exemplo n.º 3
0
        //---------------------------------
        private void button2_Click(object sender, EventArgs e)
        {
            if (textBox1.Text.Contains("configDataBase.ini") || textBox1.Text.Contains("Tran.config"))
            {
                ///modify 2015-07-03
                ///先关闭程序,后启动线程
                KillProcess();
                ThreadStart dealWithConfig_start  = new ThreadStart(dealWithConfig);
                Thread      dealWithConfig_thread = new Thread(dealWithConfig_start);
                dealWithConfig_thread.Start();

                string    destDir                 = AppDomain.CurrentDomain.BaseDirectory + "\\Release";
                string    sourDir_true            = FileName.Substring(0, FileName.LastIndexOf("\\"));
                FIlesCopy fileCopy                = new FIlesCopy(destDir, sourDir_true); //注意拷贝文件的 源和目的 文件夹
                ParameterizedThreadStart ParStart = new ParameterizedThreadStart(filesCopy);
                Thread filesCopyThread            = new Thread(ParStart);
                filesCopyThread.Start(fileCopy);
            }
            else
            {
                button2.Enabled = false;
                MessageBox.Show(@"路径名有误请重新选择!");
            }
        }