protected virtual void OnMainwindowStateChanging(MainWindowEventArgs e) { MainWindowStateEventHandler handler = MainWindowStateChanged; if (handler != null) { handler(this, e); this.currentState = this.nextState; this.nextState = MainWindowViewState.NULL; } }
public void CGAButtonClicked() { switch (currentState) { case MainWindowViewState.VIEW1STATE: if (this.newEvent == MainWindowButtonClickEvents.CON_TO_SITE_CLK) { this.nextState = MainWindowViewState.VIEW1STATE; } else if (this.newEvent == MainWindowButtonClickEvents.OPT_CLK) { this.nextState = MainWindowViewState.VIEW2STATE; } else if (this.newEvent == MainWindowButtonClickEvents.ABT_ME_CLK) { this.nextState = MainWindowViewState.VIEW3STATE; } else { //next state is null //there must be something wrong in here... } if (this.nextState != this.currentState) { MainWindowEventArgs args = new MainWindowEventArgs(this.nextState, currentState); OnMainwindowStateChanging(args); } break; case MainWindowViewState.VIEW2STATE: if (this.newEvent == MainWindowButtonClickEvents.CON_TO_SITE_CLK) { this.nextState = MainWindowViewState.VIEW1STATE; } else if (this.newEvent == MainWindowButtonClickEvents.OPT_CLK) { this.nextState = MainWindowViewState.VIEW2STATE; } else if (this.newEvent == MainWindowButtonClickEvents.ABT_ME_CLK) { this.nextState = MainWindowViewState.VIEW3STATE; } else { //next state is null } if (this.nextState != this.currentState) { MainWindowEventArgs args = new MainWindowEventArgs(this.nextState, currentState); OnMainwindowStateChanging(args); } break; case MainWindowViewState.VIEW3STATE: if (this.newEvent == MainWindowButtonClickEvents.CON_TO_SITE_CLK) { this.nextState = MainWindowViewState.VIEW1STATE; } else if (this.newEvent == MainWindowButtonClickEvents.OPT_CLK) { this.nextState = MainWindowViewState.VIEW2STATE; } else if (this.newEvent == MainWindowButtonClickEvents.ABT_ME_CLK) { this.nextState = MainWindowViewState.VIEW3STATE; } else { //next state is null } if (this.nextState != this.currentState) { MainWindowEventArgs args = new MainWindowEventArgs(this.nextState, currentState); OnMainwindowStateChanging(args); } break; case MainWindowViewState.NULL: if (this.newEvent == MainWindowButtonClickEvents.CON_TO_SITE_CLK) { this.nextState = MainWindowViewState.VIEW1STATE; } else if (this.newEvent == MainWindowButtonClickEvents.OPT_CLK) { this.nextState = MainWindowViewState.VIEW2STATE; } else if (this.newEvent == MainWindowButtonClickEvents.ABT_ME_CLK) { this.nextState = MainWindowViewState.VIEW3STATE; } else { //next state is null } if (this.nextState != this.currentState) { MainWindowEventArgs args = new MainWindowEventArgs(this.nextState, currentState); OnMainwindowStateChanging(args); } break; default: break; } //end of switch }
public MainWindowVS() { currentState = MainWindowViewState.NULL; nextState = MainWindowViewState.NULL; }