@@ -28,6 +28,8 @@ public ControlPanel(bool hide)
2828 unlockPasswordHash = File . ReadAllText ( TimeControlFile . PassLocation ) ;
2929 PasswordSet ( ) ;
3030 }
31+ else
32+ unlockPasswordRemoveButton . Enabled = false ;
3133
3234 appController = new ( usageBox , processMonitorTimer ) ;
3335 fileSaveTimer . Start ( ) ;
@@ -41,39 +43,6 @@ public ControlPanel(bool hide)
4143 }
4244 }
4345
44- #region LockPage
45-
46- private void StartButton_Click ( object sender , EventArgs e ) //启动屏保程序
47- {
48- StartLock ( unlockPasswordHash , ( int ) timeBox . Value ) ;
49- }
50-
51- private static void StartLock ( string unlockPasswordHash , int minutes = 0 )
52- {
53- IntPtr nowDesktop = Dllimport . GetThreadDesktop ( Dllimport . GetCurrentThreadId ( ) ) ;
54- IntPtr newDesktop = Dllimport . CreateDesktop ( "Lock" , null , null , 0 , Dllimport . ACCESS_MASK . GENERIC_ALL , IntPtr . Zero ) ;
55- Dllimport . SwitchDesktop ( newDesktop ) ;
56- Task . Factory . StartNew ( ( ) =>
57- {
58- Dllimport . SetThreadDesktop ( newDesktop ) ;
59- Lock _lock ;
60- if ( minutes != 0 )
61- _lock = new ( minutes , unlockPasswordHash ) ;
62- else
63- _lock = new ( unlockPasswordHash ) ;
64- Application . Run ( _lock ) ;
65- } ) . Wait ( ) ;
66- Dllimport . SwitchDesktop ( nowDesktop ) ;
67- Dllimport . CloseDesktop ( newDesktop ) ;
68- }
69-
70- private void WhiteProcessBox_TextChanged ( object sender , EventArgs e )
71- {
72- File . WriteAllText ( TimeControlFile . WhiteAppLocation , whiteProcessBox . Text ) ;
73- }
74-
75- #endregion LockPage
76-
7746 #region Form
7847
7948 private void NotifyIcon_MouseDoubleClick ( object sender , MouseEventArgs e ) //打开界面
@@ -130,6 +99,39 @@ private void ControlPanel_Shown(object sender, EventArgs e)//启动隐藏参数
13099
131100 #endregion Form
132101
102+ #region LockPage
103+
104+ private void StartButton_Click ( object sender , EventArgs e ) //启动屏保程序
105+ {
106+ StartLock ( unlockPasswordHash , ( int ) timeBox . Value ) ;
107+ }
108+
109+ private static void StartLock ( string unlockPasswordHash , int minutes = 0 )
110+ {
111+ IntPtr nowDesktop = Dllimport . GetThreadDesktop ( Dllimport . GetCurrentThreadId ( ) ) ;
112+ IntPtr newDesktop = Dllimport . CreateDesktop ( "Lock" , null , null , 0 , Dllimport . ACCESS_MASK . GENERIC_ALL , IntPtr . Zero ) ;
113+ Dllimport . SwitchDesktop ( newDesktop ) ;
114+ Task . Factory . StartNew ( ( ) =>
115+ {
116+ Dllimport . SetThreadDesktop ( newDesktop ) ;
117+ Lock _lock ;
118+ if ( minutes != 0 )
119+ _lock = new ( minutes , unlockPasswordHash ) ;
120+ else
121+ _lock = new ( unlockPasswordHash ) ;
122+ Application . Run ( _lock ) ;
123+ } ) . Wait ( ) ;
124+ Dllimport . SwitchDesktop ( nowDesktop ) ;
125+ Dllimport . CloseDesktop ( newDesktop ) ;
126+ }
127+
128+ private void WhiteProcessBox_TextChanged ( object sender , EventArgs e )
129+ {
130+ File . WriteAllText ( TimeControlFile . WhiteAppLocation , whiteProcessBox . Text ) ;
131+ }
132+
133+ #endregion LockPage
134+
133135 #region ProcessPage
134136
135137 private void FileSaveTimer_Tick ( object sender , EventArgs e )
0 commit comments