2013年5月15日

摘要: public static void StartProgram(string directory,string fileName) { Process mainprocess = new Process(); mainprocess.StartInfo.WorkingDirectory = directory; mainprocess.StartInfo.FileName = fileName;//其实可以不指定上面的目录,这里写成directory + filename亦可 mainprocess.StartInfo.Ar... 阅读全文
posted @ 2013-05-15 17:35 fish_1949 阅读(387) 评论(0) 推荐(0) 编辑
摘要: 问题描述:Winform 在执行构造函数时如何阻止它运行Load方法现在要做一个在线更新的功能,我在主窗体的构造函数 判断版本是否一致,不一致则弹出更新的exe。但是弹出更新的EXE后,主窗体的FORM_LOAD函数还是会执行。如何阻止它?解决方案:可以在Program.cs中的Run前加上判断,如果需要更新,就不要创建主窗体了,直接杀死当前进程你应该写在Main函数里面,而不是主窗口的构造函数。构造函数除了“构造”,你不应该让它干别的。 阅读全文
posted @ 2013-05-15 17:27 fish_1949 阅读(421) 评论(0) 推荐(0) 编辑
摘要: //检查虚拟目录是否可以访问 public static bool Cmd(string cmdLine) { using (var process = new Process { StartInfo = { FileName = "cmd.exe", UseShellExecute = false, RedirectStandardI... 阅读全文
posted @ 2013-05-15 17:23 fish_1949 阅读(275) 评论(0) 推荐(0) 编辑

导航