private void Dbg() { if (File.Exists(@"B:\DbgTagExplorer=1")) { string dir = @"B:\TagExplorer"; if (Directory.Exists(dir) && MessageBox.Show(dir, "Del", MessageBoxButton.OKCancel) == MessageBoxResult.OK) { Directory.Delete(dir, true); } if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); } CfgPath.SetRootPathNoSave(dir); GitHelper h = new GitHelper(); h.Clone(); } }
private void App_Startup(object sender, StartupEventArgs e) { TipsCenter.Ins.StartTime = "App:117"; if (e.Args.Length > 0) { CfgPath.SetRootPathNoSave(e.Args[0]); } Dbg(); retry: if (CfgPath.RootPath == null) { System.Windows.Forms.FolderBrowserDialog fd = new System.Windows.Forms.FolderBrowserDialog(); fd.ShowNewFolderButton = true; fd.ShowDialog(); if (Directory.Exists(fd.SelectedPath)) { CfgPath.RootPath = fd.SelectedPath; } else { if (System.Windows.MessageBox.Show("请选择一个文档存储的根目录", "首次运行设置", MessageBoxButton.OKCancel, MessageBoxImage.Question) == MessageBoxResult.OK) { goto retry; } else { System.Windows.Application.Current.Shutdown(); } } } Process process = GetRuningInstance(); if (process != null) { BringToForeground(process); Environment.Exit(0); } }