/// <summary>Creates a new <see cref="GitExtensionsForm"/> indicating position restore.</summary> /// <param name="enablePositionRestore">Indicates whether the <see cref="Form"/>'s position /// will be restored upon being re-opened.</param> protected GitExtensionsForm(bool enablePositionRestore) { var needsPositionSave = enablePositionRestore; _needsPositionRestore = enablePositionRestore; FormClosing += GitExtensionsForm_FormClosing; var cancelButton = new Button(); cancelButton.Click += CancelButtonClick; CancelButton = cancelButton; void GitExtensionsForm_FormClosing(object sender, FormClosingEventArgs e) { if (!needsPositionSave) { return; } needsPositionSave = false; _windowPositionManager.SavePosition(this); TaskbarProgress.Clear(); } }
/// <summary>Creates a new <see cref="GitExtensionsForm"/> indicating position restore.</summary> /// <param name="enablePositionRestore">Indicates whether the <see cref="Form"/>'s position /// will be restored upon being re-opened.</param> protected GitExtensionsForm(bool enablePositionRestore) { var needsPositionSave = enablePositionRestore; _needsPositionRestore = enablePositionRestore; FormClosing += GitExtensionsForm_FormClosing; var cancelButton = new Button(); cancelButton.Click += CancelButtonClick; CancelButton = cancelButton; if (ThemeModule.IsDarkTheme) { // Warning: This call freezes the CI in AppVeyor, however dark theme is not used on build machines DwmApi.UseImmersiveDarkMode(Handle, true); } void GitExtensionsForm_FormClosing(object sender, FormClosingEventArgs e) { if (!needsPositionSave) { return; } needsPositionSave = false; _windowPositionManager.SavePosition(this); TaskbarProgress.Clear(); } }