/// <summary> /// Called once application data has been loaded /// </summary> protected virtual void OnApplicationReady() { DebugLogger.Log(NAME + "::OnApplicationReady"); // Example of how to reference data and state proxies // Register Proxies in Application.Controller.Commands.Prepare.ApplicationModelPrepareCommand // Then they are available in any Mediator or Command class like this... applicationDataProxy = Facade.RetrieveProxy(ApplicationDataProxy.NAME) as ApplicationDataProxy; applicationStateProxy = Facade.RetrieveProxy(ApplicationStateProxy.NAME) as ApplicationStateProxy; InitializeViewComponent(); }
public override void Execute(INotification notification) { ApplicationStateProxy stateProxy = Facade.RetrieveProxy(ApplicationStateProxy.NAME) as ApplicationStateProxy; Mediator mediator; switch (notification.Name) { case Notifications.SEND_UI_ACTION: ViewComponentConfig config = (notification.Body as ViewComponentConfig); switch (config.actions) { /* * This space reserved for additional checks on actions. For example showing the user a modal first if confirmation is needed. */ case UIActions.TAKE_PHOTO: mediator = Facade.RetrieveMediator(PhoneCamMediator.NAME) as PhoneCamMediator; (mediator as PhoneCamMediator).TakePicture(); break; case UIActions.LOAD_PHOTO: mediator = Facade.RetrieveMediator(PhoneCamMediator.NAME) as PhoneCamMediator; (mediator as PhoneCamMediator).LoadPicture(); break; case UIActions.UPLOAD_PHOTO: SendNotification(Notifications.REQUEST_RETRIEVE_DATA); break; case UIActions.RESET_PHOTO: stateProxy.SetState(ApplicationStates.USING_CAMERA); Debug.Log("reset photo action heard"); break; default: break; } break; default: break; } }
public override void Execute(INotification notification) { DebugLogger.Log("RequestApplicationStateChangeCommand::Execute"); ApplicationStateProxy applicationStateProxy = Facade.RetrieveProxy(ApplicationStateProxy.NAME) as ApplicationStateProxy; ApplicationStateVO applicationStateVO = notification.Body as ApplicationStateVO; // First check new state is not same as old state if (applicationStateProxy.CurrentState != null && applicationStateProxy.CurrentState.state == applicationStateVO.state) { DebugLogger.LogWarning("Application State is already set to {0}", applicationStateProxy.CurrentState.state.ToString()); return; } if (applicationStateVO.previousState == null) { applicationStateVO.previousState = applicationStateProxy.CurrentState; } applicationStateProxy.CurrentState = applicationStateVO; }
public override void Execute(INotification notification) { ApplicationStateProxy stateProxy = Facade.RetrieveProxy(ApplicationStateProxy.NAME) as ApplicationStateProxy; stateProxy.SetState(ApplicationStates.USING_CAMERA); }