File tree Expand file tree Collapse file tree 1 file changed +17
-6
lines changed
Expand file tree Collapse file tree 1 file changed +17
-6
lines changed Original file line number Diff line number Diff line change 11using System ;
2- using System . Collections . Generic ;
3- using System . Linq ;
4- using System . Threading . Tasks ;
2+ using System . Threading ;
53using System . Windows . Forms ;
64
75namespace SPDIFKA
@@ -14,9 +12,22 @@ static class SPDIFKA
1412 [ STAThread ]
1513 static void Main ( )
1614 {
17- Application . EnableVisualStyles ( ) ;
18- Application . SetCompatibleTextRenderingDefault ( false ) ;
19- Application . Run ( new SPDIFKAGUI ( ) ) ;
15+ using ( Mutex mutex = new Mutex ( false , @"Global\" + "spdif-ka_mutex" ) )
16+ {
17+ try
18+ {
19+ if ( mutex . WaitOne ( 0 , false ) ) // This is the only instance
20+ {
21+ Application . EnableVisualStyles ( ) ;
22+ Application . SetCompatibleTextRenderingDefault ( false ) ;
23+ Application . Run ( new SPDIFKAGUI ( ) ) ;
24+ }
25+ }
26+ finally
27+ {
28+ mutex . Close ( ) ;
29+ }
30+ }
2031 }
2132 }
2233}
You can’t perform that action at this time.
0 commit comments