File tree Expand file tree Collapse file tree 2 files changed +18
-18
lines changed
Expand file tree Collapse file tree 2 files changed +18
-18
lines changed Original file line number Diff line number Diff line change @@ -26,24 +26,6 @@ private static void Main(string[] args)
2626 hide = true ;
2727 }
2828 }
29- Process [ ] processes = Process . GetProcessesByName ( "TimeControl" ) ;
30- if ( processes . Length > 1 )
31- {
32- if ( MessageBox . Show (
33- "当前已经启动TimeControl,不能启动多个实例,是否要重新启动?" ,
34- "提示" ,
35- MessageBoxButtons . OKCancel ,
36- MessageBoxIcon . Information ) == DialogResult . OK )
37- {
38- foreach ( Process process in processes )
39- {
40- if ( process . Id != Environment . ProcessId )
41- process . Kill ( ) ;
42- }
43- }
44- else
45- return ;
46- }
4729 if ( ! Debugger . IsAttached )
4830 {
4931 Application . ThreadException += ExceptionHandler ;
Original file line number Diff line number Diff line change @@ -22,6 +22,24 @@ public partial class ControlPanel : Form
2222 private TimeData timeData ; //数据
2323 public ControlPanel ( bool hide )
2424 {
25+ Process [ ] processes = Process . GetProcessesByName ( "TimeControl" ) ;
26+ if ( processes . Length > 1 )
27+ {
28+ if ( MessageBox . Show (
29+ "当前已经启动TimeControl,不能启动多个实例,是否要重新启动?" ,
30+ "提示" ,
31+ MessageBoxButtons . OKCancel ,
32+ MessageBoxIcon . Information ) == DialogResult . OK )
33+ {
34+ foreach ( Process process in processes )
35+ {
36+ if ( process . Id != Environment . ProcessId )
37+ process . Kill ( ) ;
38+ }
39+ }
40+ else
41+ Environment . Exit ( 0 ) ;
42+ }
2543 InitializeComponent ( ) ;
2644 this . hide = hide ;
2745 //数据记录
You can’t perform that action at this time.
0 commit comments