/* * The phone mediator responds to state changes */ public override void HandleNotification(INotification notification) { switch (notification.Name) { case Notifications.SEND_STATE_CHANGE: ApplicationStates state = (ApplicationStates)notification.Body; switch (state) { case ApplicationStates.REVIEWING_PHOTO_PREVIEW: GetViewComponent().DeActivateCamera(); FileVO file = GetUserDataProxy().GetData().SelectedPhoto; GetViewComponent().ShowPreview(file.bytes); break; case ApplicationStates.SHOWING_RESULTS: break; case ApplicationStates.USING_CAMERA: GetViewComponent().HidePreview(); GetViewComponent().ActivateCamera(); break; default: break; } break; default: break; } }
/// <summary> /// Запускает главный контроллер /// </summary> public void Start() { _currentState = ApplicationStates.MenuWork; _currentFactoryOfControllers = new FactoryOfMenuControllers(); ChangeState(_currentState, _currentFactoryOfControllers); _platform.Initialize(); }
private void AddSlideDirection(ApplicationStates from, ApplicationStates to, SlideDirection dir) { // There . . . SlideDirections.Add(new Tuple <ApplicationStates, ApplicationStates, SlideDirection>(from, to, dir)); // . . . And Back Again SlideDirection back = dir; if (dir == SlideDirection.Down) { back = SlideDirection.Up; } else if (dir == SlideDirection.Up) { back = SlideDirection.Down; } else if (dir == SlideDirection.Left) { back = SlideDirection.Right; } else if (dir == SlideDirection.Right) { back = SlideDirection.Left; } SlideDirections.Add(new Tuple <ApplicationStates, ApplicationStates, SlideDirection>(to, from, back)); // By Bilbo Baggins }
public override void HandleNotification(INotification notification) { switch (notification.Name) { case Notifications.SEND_STATE_CHANGE: ApplicationStates state = (ApplicationStates)notification.Body; switch (state) { case ApplicationStates.REVIEWING_PHOTO_PREVIEW: switch (GetViewComponent().Config.actions) { case UIActions.TAKE_PHOTO: case UIActions.LOAD_PHOTO: GetViewComponent().Hide(); break; case UIActions.RESET_PHOTO: case UIActions.UPLOAD_PHOTO: GetViewComponent().Show(); break; default: break; } break; case ApplicationStates.SHOWING_RESULTS: break; case ApplicationStates.USING_CAMERA: switch (GetViewComponent().Config.actions) { case UIActions.TAKE_PHOTO: case UIActions.LOAD_PHOTO: GetViewComponent().Show(); break; case UIActions.RESET_PHOTO: case UIActions.UPLOAD_PHOTO: GetViewComponent().Hide(); break; default: break; } break; default: break; } break; default: break; } }
public ApplicationState GetState(ApplicationStates state) { ApplicationState result = null; // lookup and return the state if (m_StateTable.ContainsKey(state)) { result = m_StateTable[state]; } return(result); }
public void SetState(ApplicationStates state) { if (GetState() != state) { (Data as StateVO).CurrentState = state; Debug.Log("setting state to: " + state); SendNotification(Notifications.SEND_STATE_CHANGE, state); } else { Debug.Log("same state: " + state); } }
public void PushState(ApplicationStates state) { if (m_StateTable.ContainsKey(state)) { // lookup the state ApplicationState activeState = m_StateTable[state]; // add the state to the stack m_StateStack.Add(activeState); // call the enter method now that the state is active activeState.OnStateEnter(); } }
/// <summary> /// Изменяет состояние приложения /// </summary> /// <param name="parState">Состояние приложения</param> /// <param name="parFactoryOfContollers">Фабрика контроллера</param> private void ChangeState(ApplicationStates parState, FactoryOfContollers parFactoryOfContollers) { _currentState = parState; _currentFactoryOfControllers = parFactoryOfContollers; if (parState != ApplicationStates.Exit) { _currentController = _currentFactoryOfControllers.CreateController(_platform); _currentController.ChangeState += OnChangeState; } else { _platform.Drop(); } }
public void SetState(ApplicationStates stateToSet) { foreach (GameObject iterator in stateParents) { if (iterator.name != stateToSet.ToString()) { iterator.SetActive(false); } else { iterator.SetActive(true); appState = stateToSet; } } }
private void GotoState(ApplicationStates state) { ApplicationStates cur = App.CurrentState; if (state == ApplicationStates.Back) { if (App.PreviousState == ApplicationStates.Back) { return; } state = App.PreviousState; } if (state == App.CurrentState) { return; } FrameworkElement view = (FrameworkElement)IoC.Repository[state.ToString() + "View"]; if (view == null) { return; } //BaseViewModel vm = (BaseViewModel)IoC.Repository[state.ToString() + "ViewModel"]; //if (vm != null) // view.DataContext = vm; SlideDirection direction = SlideDirection.Left; var dir = App.SlideDirections.Where(s => s.Item1 == cur && s.Item2 == state).FirstOrDefault(); if (dir != null) { direction = dir.Item3; } slide.Slide(view, direction); App.PreviousState = App.CurrentState; App.CurrentState = state; }
/// <summary> /// Switches the application state to the state provided. /// </summary> /// <param name="StateType"></param> public void SwitchAppState(ApplicationStates StateType) { try { ApplicationState state; state = (ApplicationState)_states[StateType]; if (state != _app_state) { state.SetActiveState(); _app_state = state; } } catch (System.Exception ex) { MessageBox.Show("There was an error switching application states.", "VLoop Error", MessageBoxButtons.OK, MessageBoxIcon.Error); _errors.Add(ex); _last_error = ex; } }
public void PopState(ApplicationStates state) { // if state exists if (m_StateTable.ContainsKey(state)) { // lookup the state ApplicationState activeState = m_StateTable[state]; // find the state on the stack and remove it for (int i = 0; i < m_StateStack.Count; ++i) { if (m_StateStack[i] == activeState) { // notify the state it is no longer active activeState.OnStateExit(); // remove the state from the stack m_StateStack.RemoveAt(i); } } } }
/// <summary> /// Конструктор /// </summary> /// <param name="parFactory">Фабрика контроллеров</param> /// <param name="parState">Состояние приложения</param> public ChangeStateArgs(FactoryOfContollers parFactory, ApplicationStates parState) { _factoryOfContollers = parFactory; _applicationState = parState; }
public ERROR_CODES OpenOrCloseInstrument() { if (applicationState == ApplicationStates.InstrumentDisconnected) { managedForm.UpdateConnectedInstrumentsStatus(applicationController.OpenAllInstruments()); applicationController.InitializeSignalGenerator(); applicationController.InitializeLockingAmplifer(); applicationState = ApplicationStates.InstrumentConnected; } else { managedForm.UpdateConnectedInstrumentsStatus(applicationController.CloseAllInstruments()); applicationState = ApplicationStates.InstrumentDisconnected; } managedForm.ChangeFormState(applicationState); return ERROR_CODES.AA_OK; }
public StateVO() { CurrentState = ApplicationStates.STARTUP; }