File tree Expand file tree Collapse file tree 3 files changed +20
-6
lines changed
Expand file tree Collapse file tree 3 files changed +20
-6
lines changed Original file line number Diff line number Diff line change 33using System . Linq ;
44using System . Threading . Tasks ;
55using System . Windows . Forms ;
6+ using System . Diagnostics ;
67
78namespace TimeControl
89{
@@ -22,6 +23,24 @@ static void Main(string[] args)
2223 hide = true ;
2324 }
2425 }
26+ Process [ ] processes = Process . GetProcessesByName ( "TimeControl" ) ;
27+ if ( processes . Length > 1 )
28+ {
29+ if ( MessageBox . Show (
30+ "当前已经启动TimeControl,不能启动多个实例,是否要重新启动?" ,
31+ "提示" ,
32+ MessageBoxButtons . OKCancel ,
33+ MessageBoxIcon . Information ) == DialogResult . OK )
34+ {
35+ foreach ( Process process in processes )
36+ {
37+ if ( process . Id != Environment . ProcessId )
38+ process . Kill ( ) ;
39+ }
40+ }
41+ else
42+ return ;
43+ }
2544 Application . SetHighDpiMode ( HighDpiMode . SystemAware ) ;
2645 Application . EnableVisualStyles ( ) ;
2746 Application . SetCompatibleTextRenderingDefault ( false ) ;
Original file line number Diff line number Diff line change 1313 <PlatformTarget >AnyCPU</PlatformTarget >
1414 <SupportedOSPlatformVersion >7.0</SupportedOSPlatformVersion >
1515 <Platforms >AnyCPU;x64;x86</Platforms >
16+ <GenerateDocumentationFile >False</GenerateDocumentationFile >
1617 </PropertyGroup >
1718
1819 <PropertyGroup Condition =" '$(Configuration)|$(Platform)'=='Release|AnyCPU'" >
5859 </None >
5960 </ItemGroup >
6061
61- <Target Name =" PreBuild" BeforeTargets =" PreBuildEvent" >
62- <Exec Command =" cmd /c killtc.bat" />
63- </Target >
64-
6562</Project >
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments