public void CGAButtonClicked() { switch (currentState) { case MainWindoViewState.VIEW1STATE: if (this.newEvent == MainWindowButtonClickEvents.CON_TO_SITE_CLK) { this.nextState = MainWindoViewState.VIEW1STATE; } else if (this.newEvent == MainWindowButtonClickEvents.OPT_CLK) { this.nextState = MainWindoViewState.VIEW2STATE; } else if (this.newEvent == MainWindowButtonClickEvents.ABT_ME_CLK) { this.nextState = MainWindoViewState.VIEW3STATE; } else { //next state is null } if (this.nextState != this.currentState) { MainWindowEventArgs args = new MainWindowEventArgs(this.nextState, currentState); OnMainwindowStateChanged(args); } case MainWindoViewState.VIEW2STATE: } }
protected virtual void OnMainwindowStateChanging(MainWindowEventArgs e) { MainWindowButtonEventHandler handler = MainWindowButtonClick; if (handler != null) { handler(this, e); this.currentState = this.nextState; this.nextState = null; } }
protected virtual void OnMainwindowStateChanging(MainWindowEventArgs e) { MainWindowStateEventHandler handler = MainWindowStateChanged; if (handler != null) { handler(this, e); this.currentState = this.nextState; this.nextState = MainWindowViewState.NULL; } }
private void CGBViewChanged(object sender, MainWindowEventArgs e) { //View change has been initiated yet not set. if (e.NextState == MainWindowVS.MainWindowViewState.VIEW1STATE) { if (!View1Initiated) { View1Initiate(); } } }
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 }