@@ -38,7 +38,6 @@ public partial class MainForm : Form
3838 private readonly KeyboardShortcutDispatcher _keyboardShortcutDispatcher ;
3939 private readonly UpdateManager _updateManager ;
4040 private Config _config ;
41- private bool _setVisibleCalled = false ;
4241
4342 private LgPanel _lgPanel ;
4443 private SamsungPanel _samsungPanel ;
@@ -48,8 +47,8 @@ public partial class MainForm : Form
4847
4948 private GamePanel _gamePanel ;
5049
51- public MainForm ( GlobalContext globalContext , ServiceManager serviceManager ,
52- IServiceProvider serviceProvider , ElevationService elevationService , NotifyIconManager notifyIconManager , KeyboardShortcutDispatcher keyboardShortcutDispatcher , UpdateManager updateManager )
50+ public MainForm ( GlobalContext globalContext , ServiceManager serviceManager , IServiceProvider serviceProvider , ElevationService elevationService ,
51+ NotifyIconManager notifyIconManager , KeyboardShortcutDispatcher keyboardShortcutDispatcher , UpdateManager updateManager )
5352 {
5453 InitializeComponent ( ) ;
5554
@@ -117,6 +116,8 @@ private T InitPanel<T>(string displayName) where T : UserControl, IModulePanel
117116 panel . Size = tabPage . ClientSize ;
118117 panel . BackColor = SystemColors . Window ;
119118
119+ //Logger.Debug($"Panel {panel.GetType().Name}, size: {panel.Size.Width}x{panel.Size.Height}");
120+
120121 return panel ;
121122 }
122123 catch ( Exception ex )
@@ -136,7 +137,12 @@ public void OpenForm()
136137
137138 private void MainForm_FormClosing ( object sender , FormClosingEventArgs e )
138139 {
139- if ( ! ( SystemShutdown || EndSession || Program . UserExit ) && _config . MinimizeOnClose )
140+ if ( Program . UserExit )
141+ {
142+ return ;
143+ }
144+
145+ if ( ! ( SystemShutdown || EndSession ) && _config . MinimizeOnClose )
140146 {
141147 e . Cancel = true ;
142148 WindowState = FormWindowState . Minimized ;
@@ -149,9 +155,9 @@ private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
149155 if ( SystemShutdown )
150156 {
151157 Logger . Debug ( $ "MainForm_FormClosing: SystemShutdown") ;
152-
153- //_powerEventDispatcher.SendEvent(PowerEventDispatcher.Event_Shutdown);
154158 }
159+
160+ Program . Exit ( ) ;
155161 }
156162
157163 private void GlobalSave ( )
@@ -232,33 +238,13 @@ private void SaveConfig()
232238 Utils . WriteObject ( Program . ConfigFilename , _config ) ;
233239 }
234240
235- private async void MainForm_Shown ( object sender , EventArgs e )
241+ private void MainForm_Shown ( object sender , EventArgs e )
236242 {
237243 InitSelectedTab ( ) ;
238244
239245 _elevationService . CheckElevationMethod ( ) ;
240246 }
241247
242- protected override void SetVisibleCore ( bool value )
243- {
244- //if (!_setVisibleCalled && _config.StartMinimized && !Debugger.IsAttached)
245- //{
246- // _setVisibleCalled = true;
247- // if (_config.MinimizeToTray)
248- // {
249- // value = false;
250- // }
251- // else
252- // {
253- // WindowState = FormWindowState.Minimized;
254- // }
255- //}
256- if ( ! IsDisposed )
257- {
258- base . SetVisibleCore ( value ) ;
259- }
260- }
261-
262248 private void tabControl1_SelectedIndexChanged ( object sender , EventArgs e )
263249 {
264250 InitSelectedTab ( ) ;
@@ -282,7 +268,7 @@ private void InitSelectedTab()
282268
283269 private void InitOptionsTab ( )
284270 {
285- if ( tabInfo . Controls . Count > 0 )
271+ if ( tabOptions . Controls . Count > 0 )
286272 {
287273 return ;
288274 }
@@ -328,10 +314,6 @@ private async Task AfterInitialized()
328314 {
329315 await _amdPanel . AfterInitialized ( ) ;
330316 }
331- //if (_trayIcon.Visible)
332- //{
333- // await CheckForUpdates();
334- //}
335317 }
336318
337319 private void MainForm_Deactivate ( object sender , EventArgs e )
0 commit comments