Change shutdown listeners (#4282)

* change shutdown to use proper notification

* change to use storage service

* remove unused imports

* fix test

* change shutdown methods to private

* remove unusde imports

* fix tests

* formatting
This commit is contained in:
Anthony Dresser
2019-03-13 15:15:51 -07:00
committed by GitHub
parent 08d4cc9690
commit b6584c9ddf
16 changed files with 51 additions and 43 deletions

View File

@@ -51,7 +51,7 @@ export class AccountManagementService implements IAccountManagementService {
private _mementoObj: object,
@IInstantiationService private _instantiationService: IInstantiationService,
@IStorageService private _storageService: IStorageService,
@IClipboardService private _clipboardService: IClipboardService,
@IClipboardService private _clipboardService: IClipboardService
) {
// Create the account store
if (!this._mementoObj) {
@@ -65,6 +65,8 @@ export class AccountManagementService implements IAccountManagementService {
this._removeAccountProviderEmitter = new Emitter<azdata.AccountProviderMetadata>();
this._updateAccountListEmitter = new Emitter<UpdateAccountListEventParams>();
_storageService.onWillSaveState(() => this.shutdown());
// Register status bar item
let statusbarDescriptor = new statusbar.StatusbarItemDescriptor(
AccountListStatusbarItem,
@@ -367,7 +369,7 @@ export class AccountManagementService implements IAccountManagementService {
/**
* Handler for when shutdown of the application occurs. Writes out the memento.
*/
public shutdown(): void {
private shutdown(): void {
if (this._mementoContext) {
this._mementoContext.saveMemento();
}