Introduces event queue processor to create a consistent UI (#11780)

This commit is contained in:
Amir Omidi
2020-08-12 14:06:49 -07:00
committed by GitHub
parent e40a81e8e1
commit 6e306461d7
3 changed files with 65 additions and 15 deletions

View File

@@ -27,6 +27,7 @@ export enum State {
export interface Model {
readonly sourceConnection: azdata.connection.Connection;
readonly currentState: State;
gatheringInformationError: string | undefined;
}
export interface StateChangeEvent {
@@ -37,6 +38,7 @@ export interface StateChangeEvent {
export class MigrationStateModel implements Model, vscode.Disposable {
private _stateChangeEventEmitter = new vscode.EventEmitter<StateChangeEvent>();
private _currentState: State;
private _gatheringInformationError: string | undefined;
constructor(private readonly _sourceConnection: azdata.connection.Connection) {
this._currentState = State.INIT;
@@ -58,6 +60,14 @@ export class MigrationStateModel implements Model, vscode.Disposable {
this._stateChangeEventEmitter.fire({ oldState, newState: this.currentState });
}
public get gatheringInformationError(): string | undefined {
return this._gatheringInformationError;
}
public set gatheringInformationError(error: string | undefined) {
this._gatheringInformationError = error;
}
public get stateChangeEvent(): vscode.Event<StateChangeEvent> {
return this._stateChangeEventEmitter.event;
}