public void setInterfaceMode(InterfaceMode mode)
        {
            switch(mode)
            {
                case InterfaceMode.MENU:
                setScreen(new MenuScreen(quinoa));
                break;

                case InterfaceMode.ADVENTURE:
                setScreen(new AdventureScreen(quinoa));
                break;
            }
        }
        //=================================================================================================//
        protected bool SetInterfaceMode(InterfaceMode interfaceMode)
        {
            const String methodName = "SetInterfaceMode";
            Logfile.WriteCalled(logLevel, STR_ClassName, methodName,
                String.Format(STRLOG_InterfaceMode_arg, Enum.GetName(typeof(InterfaceMode), interfaceMode)));

            bool success = false;

            try
            {
                /*
                 * Write the command and get the received data, should be the command echoed back
                 */
                byte[] readData = WriteReadData(new byte[] { (byte)interfaceMode }, 1, DATALEN_CMD_Interface);
                if (readData == null || readData.Length != DATALEN_CMD_Interface || readData[0] != (byte)interfaceMode)
                {
                    throw new ApplicationException(STRERR_FailedToSetInterfaceMode);
                }

                success = true;
            }
            catch (Exception ex)
            {
                Logfile.WriteError(ex.Message);
                this.lastError = ex.Message;
            }

            Logfile.WriteCompleted(logLevel, STR_ClassName, methodName,
                    String.Format(STRLOG_Success_arg, success));

            return success;
        }
Пример #3
0
 public void SetInterfaceMode(InterfaceMode mode)
 {
     lock (this)
     {
         SendCommand(new byte[] { (byte)RNCommands.SetConnectionMode, (byte)mode });
     }
 }