js面向对象开发互联网机顶盒应用头端之四

 

Dare.InitSetting = function () {
  this.className = 'Dare.InitSetting';
  this.stylePath = '../style/default/';
  this.currentFocus = 'menu_item1';

  this.currentMenuIndex = 1; //当前菜单焦点位置
  this.menuIndex = 0; //当前菜单在数组中索引位置
  this.menuCount = 3;  //菜单总数
  this.menuArray = ['视频设置', '初始设置', '音频设置'];  //菜单项目

  this.currentFormIndex = 3; //当前表单焦点位置
  this.formIndex = 0; //当前表单在数组中索引位置
  this.formCount = 9;  //表单总数
  this.formArray = ['字幕大小:', '字幕颜色:', '下载路径:',
                    '电视机标准:', '电视视频比例:', '网络设置:',
                    '软件与信息查询:', '磁盘管理:', '账户设置:'];


  this.currentTvOutIndex = 0; //当前电视模式tvOut选项焦点位置
  this.tvOutIndex = 0; //当前电视模式tvOut选项在数组中索引位置
  this.tvOutCount = 2;  //电视模式tvOut选项总数
  this.tvOutArray = ['NTSC', 'PAL'];

  this.currentTvScaleIndex = 0; //当前电视比例tvScale选项焦点位置
  this.tvScaleIndex = 0; //当前电视比例tvScale选项在数组中索引位置
  this.tvScaleCount = 2;  //电视比例tvScale选项总数
  this.tvScaleArray = ['4:3', '16:9'];

  this.currentNetWorkSetIndex = 3; //当前网络设置networkSet选项焦点位置
  this.networkSetIndex = 0; //当前网络设置networkSet选项在数组中索引位置
  this.networkSetCount = 8;  //网络设置networkSet选项总数
  this.networkSetArray = ['WIFI搜索', 'WIFI动态配置', 'WIFI静态配置',
                          '动态IP配置', '静态IP配置', 'ADSL账户',
                          'ADSL登录', 'ADSL离线'];
  this.currentFontSizeIndex = 0; //当前字体大小设置fontSize选项焦点位置
  this.fontSizeIndex = 0; //当前字体大小fontSize选项在数组中索引位置
  this.fontSizeCount = 3;  //字体大小fontSize选项总数
  this.fontSizeArray = ['大字体', '中字体', '小字体'];

  this.currentDiskManagerIndex = 0; //当前磁盘管理DiskManager选项焦点位置
  this.diskManagerIndex = 0; //当前磁盘管理DiskManager选项在数组中索引位置
  this.diskManagerCount = 3;  //磁盘管理DiskManager选项总数
  this.diskManagerArray = ['本地磁盘格式化', '移动磁盘格式化', '磁盘整理'];

  this.currentAccountIndex = 0; //当前账户设置Account选项焦点位置
  this.accountIndex = 0; //当前账户设置Account选项在数组中索引位置
  this.accountCount = 1;  //账户设置Account选项总数
  this.accountArray = ['账户修改'];

  this.currentFontColorIndex = 3; //当前字体颜色设置fontColor选项焦点位置
  this.fontColorIndex = 0; //当前字体颜色fontColor选项在数组中索引位置
  this.fontColorCount = 8;  //字体颜色fontColor选项总数
  this.fontColorArray = ['红', '橙', '黄', '绿', '青', '蓝', '紫', '白'];

  this.currentDownPathIndex = 0; //当前下载路径设置downPath选项焦点位置
  this.downPathIndex = 0; //当前下载路径downPath选项在数组中索引位置
  this.downPathCount = 2;  //下载路径downPath选项总数
  this.downPathArray = ['移动硬盘', '内置硬盘'];

  this.currentSoftWareQueryIndex = 0; //当前软件查询设置SoftWareQuery选项焦点位置
  this.softWareQueryIndex = 0; //当前软件查询dSoftWareQuery选项在数组中索引位置
  this.softWareQueryCount = 4;  //软件查询SoftWareQuery选项总数
  this.softWareQueryArray = ['恢复出厂设置', '版本升级', '版本信息', '网络状态查询'];

  this.tvOutMode = TVOutMode.NTSC; //tvOutMode输出模式
  this.tvOutScaleMode = TVOutScaleMode.FOUR_TO_THREE; //tvOutScaleMode比例模式
  this.networkSetMode = NetworkSetMode.STATIC; //networkSetMode网络设置模式
  this.softWareQueryMode = SoftWareQueryMode.FACTORY; //softWareQueryMode软件信息查询模式
  this.downloadPathMode = DownloadPathMode.BUILT_IN_HARDDRIVE; //下载路径模式
  this.fontSizeMode = FontSizeMode.MIDDLE; //字体大小模式
  this.fontColorMode = FontColorMode.WHITE; //字体颜色模式

  this.NetWorkStatus = NetWorkStatusMode[3].NORMAL; //网络连接状态
  this.command = new Dare.Business.Command(); //读写命令对象
  this.statusIcon = { "red": "b1.png", "orange": "b2.png", "green": "b3.png" };
  this.formFocus = ''; //弹窗父焦点

  this.staticIPObject = {}; //静态ip设置对象
  this.adslAccountObject = {}; //ADSL账户设置对象
  this.systemAccountObject = {}; //系统账户设置对象
  this.systemVerSionInfoObject = {}; //系统版本信息对象
  this.networkStatuasObject = {}; //网络状态查询对象
  this.wifiStaticObject = {}; //WIFI静态设置对象

  this.verSionInfoFlag = false; //系统版本信息弹窗标识
  this.adslLogoutFlag = false; //ADSL离线弹窗标识
  this.netWorkStatuasInfoFlag = false; //网络状态查询弹窗标识
  this.networkDynamicFlag = false; //动态配置弹窗标识
  this.adslLoginFlag = false; //ADSL登录弹窗标识
  this.wifiSearchFlag = false; //wifi搜索弹窗标识
  this.factoryFlag = false; //恢复出厂弹窗标识
  this.wifiDynamicFlag = false; //WIFI动态配置弹窗标识

  this.intervalTime = 1000; //间隔定时器间隔时间1s
  this.outTime = 2000; //超时定时器间隔时间1s

  this.timerInterval = null; //间隔定时器
  this.timerOut = null; //超时定时器outTime

  this.wifiCount = 0; //可用无线网络总数
  this.wifiSet = 'WIFI设置'; //wifi设置标题
  this.readCount = 0; //读取命令计数器
  this.cmdValueByNull = '-1'; //命令参数值为空时,统一传入-1;
};

Dare.extend(Dare.InitSetting, Dare);

/**
* @function: Init
* @description: 初始化

* @param: null
* @return: null
*/
Dare.InitSetting.prototype.Init = function () {
  this.menuInit();
  for (var i in this.formArray) {
    $('form_item_key' + i).innerText = this.formArray[i];
  }
  $('menu_item1').className = 'menu_item_hover';
  this.menuArrowDisplay('block');
  this.formArrowDisplay('none');
  this.selectArrowDisplay('none');

  this.initForm();
  this.initNetwork();
};
/**
* @function: initNetwork
* @description: 初始化网络
* @author:h* @param: statuas
* @return: null
*/
Dare.InitSetting.prototype.initNetwork = function () {
  //获取网络状态信息
  var networkStatusConfig = this.command.getNetworkStatus()
  if (networkStatusConfig.length != 0) {
    var json = new Dare.JSObject.JSON();
    var networkStatusObject = json.toObject(networkStatusConfig);
    this.NetWorkStatus = parseInt(networkStatusObject.status);
  }
  $('network_status_txt').innerText = NetWorkStatusMode[this.NetWorkStatus].name;
  $('network_status').style.backgroundImage = 'url(' + this.stylePath + this.statusIcon[NetWorkStatusMode[this.NetWorkStatus].icon] + ')';
};
/**
* @function: initForm
* @description: 初始化表单项
* @param: statuas
* @return: null
*/
Dare.InitSetting.prototype.initForm = function () {
  //获取电视输出标准
  var tvOutConfig = this.command.getTVSystem();
  if (tvOutConfig) {
    this.tvOutMode = parseInt(tvOutConfig);
  }
  switch (this.tvOutMode) {
    case TVOutMode.NTSC:
      $('form_item_value3').innerText = this.tvOutArray[0]; //'NTSC'
      break;
    case TVOutMode.PAL:
      $('form_item_value3').innerText = this.tvOutArray[1]; //'PAL'
      break;
    default:
      break;
  }

  //获取电视输出比例
  var tvScaleConfig = this.command.setTVScale();
  if (tvScaleConfig) {
    this.tvOutScaleMode = parseInt(tvScaleConfig);
  }

  switch (this.tvOutScaleMode) {
    case TVOutScaleMode.FOUR_TO_THREE: //4:3
      $('form_item_value4').innerText = this.tvScaleArray[0];
      break;
    case TVOutScaleMode.SIXTEEN_TO_NINE: //16:9
      $('form_item_value4').innerText = this.tvScaleArray[1];
      break;
    default:
      break;
  }

  //获取网络设置模式
  var networkModeConfig = this.command.getNetworkMode();
  if (networkModeConfig) {
    this.networkSetMode = parseInt(networkModeConfig);
  }

  switch (this.networkSetMode) {
    case NetworkSetMode.WIFI_SEARCH:
      $('form_item_value5').innerText = this.networkSetArray[0];
      break;
    case NetworkSetMode.WIFI_DYNAMIC:
      $('form_item_value5').innerText = this.networkSetArray[1];
      break;
    case NetworkSetMode.WIFI_STATIC:
      $('form_item_value5').innerText = this.networkSetArray[3];
      break;
    case NetworkSetMode.DYNAMIC:
      $('form_item_value5').innerText = this.networkSetArray[3];
      break;
    case NetworkSetMode.STATIC:
      $('form_item_value5').innerText = this.networkSetArray[4];
      break;
    case NetworkSetMode.ADSL_ACCOUNT:
      $('form_item_value5').innerText = this.networkSetArray[5];
      break;
    case NetworkSetMode.ADSL_LOGIN:
      $('form_item_value5').innerText = this.networkSetArray[6];
      break;
    case NetworkSetMode.ADSL_OFFLINE:
      $('form_item_value5').innerText = this.networkSetArray[7];
      break;
    default:
      break;
  }

  //获取下载路径模式
  var downPathModeConfig = this.command.getDownPath();
  if (downPathModeConfig) {
    this.downloadPathMode = parseInt(downPathModeConfig);
  }
  switch (this.downloadPathMode) {
    case DownloadPathMode.MOBILE_HARDDRIVE:
      $('form_item_value2').innerText = this.downPathArray[0]; //移动硬盘',
      break;
    case DownloadPathMode.BUILT_IN_HARDDRIVE:
      $('form_item_value2').innerText = this.downPathArray[1]; //'内置硬盘'
      break;
    default:
      break;
  }
  //获取字体大小模式
  var fontSizeModeConfig = this.command.getFontSize();
  if (fontSizeModeConfig) {
    this.fontSizeMode = parseInt(fontSizeModeConfig);
  }
  switch (this.fontSizeMode) {
    case FontSizeMode.BIG:
      $('form_item_value0').innerText = this.fontSizeArray[0]; //大字体
      break;
    case FontSizeMode.MIDDLE:
      $('form_item_value0').innerText = this.fontSizeArray[1]; //中字体
      break;
    case FontSizeMode.SMALL:
      $('form_item_value0').innerText = this.fontSizeArray[2]; //小字体
      break;
    default:
      break;
  }
  //获取字体颜色模式
  var fontColorModeConfig = this.command.getFontColor();
  if (fontColorModeConfig) {
    this.fontColorMode = parseInt(fontColorModeConfig);
  }
  switch (this.fontColorMode) {
    case FontColorMode.RED:
      $('form_item_value1').innerText = this.fontColorArray[0]; //红
      break;
    case FontColorMode.ORANGE:
      $('form_item_value1').innerText = this.fontColorArray[1]; //橙
      break;
    case FontColorMode.YELLOW:
      $('form_item_value1').innerText = this.fontColorArray[2]; //黄
      break;
    case FontColorMode.GREEN:
      $('form_item_value1').innerText = this.fontColorArray[3]; //绿
      break;
    case FontColorMode.BLUE_GREEN:
      $('form_item_value1').innerText = this.fontColorArray[4]; //青
      break;
    case FontColorMode.BLUE:
      $('form_item_value1').innerText = this.fontColorArray[5]; //蓝
      break;
    case FontColorMode.PURPLE:
      $('form_item_value1').innerText = this.fontColorArray[6]; //紫
      break;
    case FontColorMode.WHITE:
      $('form_item_value1').innerText = this.fontColorArray[7]; //白
      break;
    default:
      break;
  }
};
/**
* @function: formArrowDisplay
* @description: 设置项箭头显示状态控制
* @param: statuas
* @return: null
*/
Dare.InitSetting.prototype.formArrowDisplay = function (status) {
  $('menu_arrow_left').style.display = status;
  $('form_arrow_up').style.display = status;
  $('form_arrow_down').style.display = status;
  $('select_arrow_right').style.display = status;
};
/**
* @function: menuArrowDisplay
* @description: 菜单项箭头显示状态控制

* @param: statuas
* @return: null
*/
Dare.InitSetting.prototype.menuArrowDisplay = function (status) {
  $('menu_arrow_up').style.display = status;
  $('menu_arrow_down').style.display = status;
  $('menu_arrow_right').style.display = status;
};
/**
* @function: selectArrowDisplay
* @description: 选择项箭头显示状态控制

* @param: statuas
* @return: null
*/
Dare.InitSetting.prototype.selectArrowDisplay = function (status) {
  $('select_arrow_left').style.display = status;
  $('select_arrow_up').style.display = status;
  $('select_arrow_down').style.display = status;
};
/**
* @function: menuInit
* @description: 初始化菜单

* @param: null
* @return: null
*/
Dare.InitSetting.prototype.menuInit = function () {
  for (var i in this.menuArray) {
    $('menu_item' + i).innerText = this.menuArray[i];
  }
};
/**
* @function: keypressHandler
* @description: 按键事件

* @param: event
* @return: null
*/
Dare.InitSetting.prototype.keypressHandler = function (event) {
  var keyValue = Dare.isiPanel ? event.which : window.event.keyCode;
  switch (keyValue) {
    case KeyMap.STB_KEY_DOWN:
      this.keydownHandler();
      break;
    case KeyMap.STB_KEY_UP:
      this.keyupHandler();
      break;
    case KeyMap.STB_KEY_ENTER:
      this.keyenterHandler();
      break;
    case KeyMap.STB_KEY_LEFT:
      this.keyleftHandler();
      break;
    case KeyMap.STB_KEY_RIGHT:
      this.keyrightHandler();
      break;
    case KeyMap.STB_KEY_HOME:
      window.location.href = window.location.href;
      break;
    case KeyMap.STB_KEY_STOP:
      switch (this.currentFocus) {
        case 'txt_ip':
        case 'txt_mask_ip':
        case 'txt_networkgate':
        case 'txt_dns_ip':
        case 'txt_account_server_0':
        case 'txt_account_server_1': //IP输入框聚焦
        case 'txt_account_server_2': //IP输入框聚焦
        case 'txt_account_server_3': //IP输入框聚焦
          this.command.setSoftKeyWord('' + SoftKeyWordMode.OFF); //下发软键盘关闭指令
          break;
        default:
          window.location.href = '../main/main.html';
          break;
      }
      break;
    default:
      break;
  }
};
/**
* @function: listMenu
* @description: 列举菜单

* @param: null
* @return: null
*/
Dare.InitSetting.prototype.listMenu = function () {
  switch (this.currentFocus) {
    case 'menu_item1':
      for (var i = 0; i < this.menuCount; i++) {
        var k = this.menuIndex + i;
        if (k >= this.menuCount) k = k - this.menuCount;
        $('menu_item' + i).innerText = this.menuArray[k];
      }
      return 1;
    case 'form_item_key3':
      for (var i = 0; i < 7; i++) {
        var k = this.formIndex + i;
        if (k >= this.formCount) k = k - this.formCount;
        $('form_item_key' + i).innerText = this.formArray[k];
        var item = $('form_item_key' + i).innerText;
        switch (item) {
          case this.formArray[0]: //'字幕大小:'
            switch (this.fontSizeMode) {
              case FontSizeMode.BIG:
                $("form_item_value" + i).innerText = this.fontSizeArray[0];
                break;
              case FontSizeMode.MIDDLE:
                $("form_item_value" + i).innerText = this.fontSizeArray[1];
                break;
              case FontSizeMode.SMALL:
                $("form_item_value" + i).innerText = this.fontSizeArray[2];
                break;
              default:
                break;
            }
            break;
          case this.formArray[1]: //'字幕颜色:'
            switch (this.fontColorMode) {
              case FontColorMode.RED:
                $("form_item_value" + i).innerText = this.fontColorArray[0];
                break;
              case FontColorMode.ORANGE:
                $("form_item_value" + i).innerText = this.fontColorArray[1];
                break;
              case FontColorMode.YELLOW:
                $("form_item_value" + i).innerText = this.fontColorArray[2];
                break;
              case FontColorMode.GREEN:
                $("form_item_value" + i).innerText = this.fontColorArray[3];
                break;
              case FontColorMode.BLUE_GREEN:
                $("form_item_value" + i).innerText = this.fontColorArray[4];
                break;
              case FontColorMode.BLUE:
                $("form_item_value" + i).innerText = this.fontColorArray[5];
                break;
              case FontColorMode.PURPLE:
                $("form_item_value" + i).innerText = this.fontColorArray[6];
                break;
              case FontColorMode.WHITE:
                $("form_item_value" + i).innerText = this.fontColorArray[7];
                break;
              default:
                break;
            }
            break;
          case this.formArray[2]: //'下载路径:'
            switch (this.downloadPathMode) {
              case DownloadPathMode.MOBILE_HARDDRIVE:
                $("form_item_value" + i).innerText = this.downPathArray[0];
                break;
              case DownloadPathMode.BUILT_IN_HARDDRIVE:
                $("form_item_value" + i).innerText = this.downPathArray[1];
                break;
              default:
                break;
            }
            break;
          case this.formArray[3]: //'电视机标准:'
            switch (this.tvOutMode) {
              case TVOutMode.NTSC:
                $("form_item_value" + i).innerText = this.tvOutArray[0];
                break;
              case TVOutMode.PAL:
                $("form_item_value" + i).innerText = this.tvOutArray[1];
                break;
              default:
                break;
            }
            break;
          case this.formArray[4]: //'电视视频比例:'
            switch (this.tvOutScaleMode) {
              case TVOutScaleMode.FOUR_TO_THREE: //4:3
                $("form_item_value" + i).innerText = this.tvScaleArray[0];
                break;
              case TVOutScaleMode.SIXTEEN_TO_NINE: //16:9
                $("form_item_value" + i).innerText = this.tvScaleArray[1];
                break;
              default:
                break;
            }
            break;
          case this.formArray[5]: //'网络设置:'
            switch (this.networkSetMode) {
              case NetworkSetMode.WIFI_SEARCH:
                $("form_item_value" + i).innerText = this.networkSetArray[0];
                break;
              case NetworkSetMode.WIFI_DYNAMIC:
                $("form_item_value" + i).innerText = this.networkSetArray[1];
                break;
              case NetworkSetMode.WIFI_STATIC:
                $("form_item_value" + i).innerText = this.networkSetArray[2];
                break;
              case NetworkSetMode.DYNAMIC:
                $("form_item_value" + i).innerText = this.networkSetArray[3];
                break;
              case NetworkSetMode.STATIC:
                $("form_item_value" + i).innerText = this.networkSetArray[4];
                break;
              case NetworkSetMode.ADSL_ACCOUNT:
                $("form_item_value" + i).innerText = this.networkSetArray[5];
                break;
              case NetworkSetMode.ADSL_LOGIN:
                $("form_item_value" + i).innerText = this.networkSetArray[6];
                break;
              case NetworkSetMode.ADSL_OFFLINE:
                $("form_item_value" + i).innerText = this.networkSetArray[7];
                break;
              default:
                break;
            }
            break;
          case this.formArray[6]: //'网络与信息查询:'
            $("form_item_value" + i).innerText = '';
            break;
          case this.formArray[7]: //'磁盘管理:'
            $("form_item_value" + i).innerText = '';
            break;
          case this.formArray[8]: //'账户设置:'
            $("form_item_value" + i).innerText = '';
            break;
          default:
            break;
        }
      }

      return 3;
    case 'selecte_item0':
      var item = $('form_item_key3').innerText;
      switch (item) {
        case this.formArray[0]: //'字幕大小:'
          for (var i = 0; i < this.fontSizeCount; i++) {
            var k = this.fontSizeIndex + i;
            if (k >= this.fontSizeCount) k = k - this.fontSizeCount;
            $('selecte_item' + i).innerText = this.fontSizeArray[k];
          }
          return 0;
        case this.formArray[2]: //'下载路径:'
          for (var i = 0; i < this.downPathCount; i++) {
            var k = this.downPathIndex + i;
            if (k >= this.downPathCount) k = k - this.downPathCount;
            $('selecte_item' + i).innerText = this.downPathArray[k];
          }
          return 0;
        case this.formArray[3]: //'电视机标准:'
          for (var i = 0; i < this.tvOutCount; i++) {
            var k = this.tvOutIndex + i;
            if (k >= this.tvOutCount) k = k - this.tvOutCount;
            $('selecte_item' + i).innerText = this.tvOutArray[k];
          }
          return 0;
        case this.formArray[4]: //'电视视频比例:'
          for (var i = 0; i < this.tvScaleCount; i++) {
            var k = this.tvScaleIndex + i;
            if (k >= this.tvScaleCount) k = k - this.tvScaleCount;
            $('selecte_item' + i).innerText = this.tvScaleArray[k];
          }
          return 0;
        case this.formArray[6]: //'网络与信息查询:'
          for (var i = 0; i < this.softWareQueryCount; i++) {
            var k = this.softWareQueryIndex + i;
            if (k >= this.softWareQueryCount) k = k - this.softWareQueryCount;
            $('selecte_item' + i).innerText = this.softWareQueryArray[k];
          }
          return 0;
        case this.formArray[7]: //'磁盘管理:'
          for (var i = 0; i < this.diskManagerCount; i++) {
            var k = this.diskManagerIndex + i;
            if (k >= this.diskManagerCount) k = k - this.diskManagerCount;
            $('selecte_item' + i).innerText = this.diskManagerArray[k];
          }
          return 0;
        case this.formArray[8]: //'账户设置:'
          for (var i = 0; i < this.accountCount; i++) {
            var k = this.accountIndex + i;
            if (k >= this.accountCount) k = k - this.accountCount;
            $('selecte_item' + i).innerText = this.accountArray[k];
          }
          return 0;
        default:
          break;
      }
      break;
    case 'selecte_item3':
      var item = $('form_item_key3').innerText;
      switch (item) {
        case this.formArray[1]: //'字幕颜色:'
          for (var i = 0; i < 7; i++) {
            var k = this.fontColorIndex + i;
            if (k >= this.fontColorCount) k = k - this.fontColorCount;
            $('selecte_item' + i).innerText = this.fontColorArray[k];
          }
          return 3;
        case this.formArray[5]: //'网络设置:'
          for (var i = 0; i < 7; i++) {
            var k = this.networkSetIndex + i;
            if (k >= this.networkSetCount) k = k - this.networkSetCount;
            $('selecte_item' + i).innerText = this.networkSetArray[k];
          }
          return 1;
        default:
          break;
      }
    default:
      break;
  }

};

/**
* @function: menuDirectModel
* @description: 菜单跳转模块

* @param: null
* @return: null
*/
Dare.InitSetting.prototype.menuDirectModel = function (menuItem) {
  switch (menuItem) {
    case this.menuArray[1]: //'初始设置'
      window.location.href = 'initsetting.html';
      break;
    case this.menuArray[2]: //'音频设置'
      window.location.href = 'audiosetting.html';
      break;
    case this.menuArray[0]: //'视频设置'
      window.location.href = 'videosetting.html';
      break;
    default:
      break;
  }
};
/**
* @function: menuDown
* @description: 向下操作菜单

* @param: null
* @return: null
*/
Dare.InitSetting.prototype.menuDown = function () {
  switch (this.currentFocus) {
    case 'menu_item1':
      this.menuIndex++;
      if (this.menuIndex > this.menuCount - 1) {
        this.menuIndex = 0;
      }
      var index = this.listMenu();
      this.currentMenuIndex = 1;
      $('menu_item' + this.currentMenuIndex).className = 'menu_item_hover';
      var item = $('menu_item1').innerText;
      this.menuDirectModel(item);
      break;
    case 'form_item_key3':
      this.initForm();
      this.formIndex++;
      if (this.formIndex > this.formCount - 1) {
        this.formIndex = 0;
      }
      var index = this.listMenu();
      this.currentFormIndex = 3;
      $('form_item_key' + this.currentFormIndex).className = 'form_item_key_hover';
      $('form_item_value' + this.currentFormIndex).className = 'form_item_value_hover';
      break;
    case 'selecte_item0':
      var item = $('form_item_key3').innerText;
      switch (item) {
        case this.formArray[0]: //'字幕大小:'
          this.fontSizeIndex++;
          if (this.fontSizeIndex > this.fontSizeCount - 1) {
            this.fontSizeIndex = 0;
          }
          var index = this.listMenu();
          this.currentFontSizeIndex = 0;
          $('selecte_item' + this.currentFontSizeIndex).className = 'selecte_item_hover';
          break;
        case this.formArray[2]: //'下载路径:'
          this.downPathIndex++;
          if (this.downPathIndex > this.downPathCount - 1) {
            this.downPathIndex = 0;
          }
          var index = this.listMenu();
          this.currentDownPathIndex = 0;
          $('selecte_item' + this.currentDownPathIndex).className = 'selecte_item_hover';
          break;
        case this.formArray[3]: //'电视机标准:'
          this.tvOutIndex++;
          if (this.tvOutIndex > this.tvOutCount - 1) {
            this.tvOutIndex = 0;
          }
          var index = this.listMenu();
          this.currentTvOutIndex = 0;
          $('selecte_item' + this.currentTvOutIndex).className = 'selecte_item_hover';
          break;
        case this.formArray[4]: //'电视视频比例:'
          this.tvScaleIndex++;
          if (this.tvScaleIndex > this.tvScaleCount - 1) {
            this.tvScaleIndex = 0;
          }
          var index = this.listMenu();
          this.currentTvScaleIndex = 0;
          $('selecte_item' + this.currentTvScaleIndex).className = 'selecte_item_hover';
          break;
        case this.formArray[6]: //'软件与信息查询:'
          this.softWareQueryIndex++;
          if (this.softWareQueryIndex > this.softWareQueryCount - 1) {
            this.softWareQueryIndex = 0;
          }
          var index = this.listMenu();
          this.currentSoftWareQueryIndex = 0;
          $('selecte_item' + this.currentSoftWareQueryIndex).className = 'selecte_item_hover';
          break;
        case this.formArray[7]: //'磁盘管理:'
          this.diskManagerIndex++;
          if (this.diskManagerIndex > this.diskManagerCount - 1) {
            this.diskManagerIndex = 0;
          }
          var index = this.listMenu();
          this.currentDiskManagerIndex = 0;
          $('selecte_item' + this.currentDiskManagerIndex).className = 'selecte_item_hover';
          break;
        case this.formArray[8]: //'账户设置:'
          this.accountIndex++;
          if (this.accountIndex > this.accountCount - 1) {
            this.accountIndex = 0;
          }
          var index = this.listMenu();
          this.currentAccountIndex = 0;
          $('selecte_item' + this.currentAccountIndex).className = 'selecte_item_hover';
          break;
        default:
          break;
      }
      break;
    case 'selecte_item3':
      var item = $('form_item_key3').innerText;
      switch (item) {
        case this.formArray[1]: //'字幕颜色:'
          this.fontColorIndex++;
          if (this.fontColorIndex > this.fontColorCount - 1) {
            this.fontColorIndex = 0;
          }
          var index = this.listMenu();
          this.currentFontColorIndex = 3;
          $('selecte_item' + this.currentFontColorIndex).className = 'selecte_item_hover';
          var result = $('form_item_key3').innerText;
          this.getFontColorList(result);
          break;
        case this.formArray[5]: //'网络设置:'
          this.networkSetIndex++;
          if (this.networkSetIndex > this.networkSetCount - 1) {
            this.networkSetIndex = 0;
          }
          var index = this.listMenu();
          this.currentNetWorkSetIndex = 3;
          $('selecte_item' + this.currentNetWorkSetIndex).className = 'selecte_item_hover';
          break;
        default:
          break;
      }
      break;
    default:
      break;
  }

};
/**
* @function: menuUp
* @description: 向上操作菜单

* @param: null
* @return: null
*/
Dare.InitSetting.prototype.menuUp = function () {
  switch (this.currentFocus) {
    case 'menu_item1':
      //alert(this.currentFocus);
      this.menuIndex--;
      if (this.menuIndex < 0) {
        this.menuIndex = this.menuCount - 1;
      }
      var index = this.listMenu();
      this.currentMenuIndex = 1;
      $('menu_item' + this.currentMenuIndex).className = 'menu_item_hover';
      var item = $('menu_item1').innerText;
      this.menuDirectModel(item);
      break;
    case 'form_item_key3':
      this.initForm();
      this.formIndex--;
      if (this.formIndex < 0) {
        this.formIndex = this.formCount - 1;
      }
      var index = this.listMenu();
      this.currentFormIndex = 3;
      $('form_item_key' + this.currentFormIndex).className = 'form_item_key_hover';
      $('form_item_value' + this.currentFormIndex).className = 'form_item_value_hover';
      break;
    case 'selecte_item0':
      var item = $('form_item_key3').innerText;
      switch (item) {
        case this.formArray[0]: //'字幕大小:'
          this.fontSizeIndex--;
          if (this.fontSizeIndex < 0) {
            this.fontSizeIndex = this.fontSizeCount - 1;
          }
          var index = this.listMenu();
          this.currentFontSizeIndex = 0;
          $('selecte_item' + this.currentFontSizeIndex).className = 'selecte_item_hover';
          break;
        case this.formArray[2]: //'下载路径:'
          this.downPathIndex--;
          if (this.downPathIndex < 0) {
            this.downPathIndex = this.downPathCount - 1;
          }
          var index = this.listMenu();
          this.currentDownPathIndex = 0;
          $('selecte_item' + this.currentDownPathIndex).className = 'selecte_item_hover';
          break;
        case this.formArray[3]: //'电视机标准:'
          this.tvOutIndex--;
          if (this.tvOutIndex < 0) {
            this.tvOutIndex = this.tvOutCount - 1;
          }
          var index = this.listMenu();
          this.currentTvOutIndex = 0;
          $('selecte_item' + this.currentTvOutIndex).className = 'selecte_item_hover';
          break;
        case this.formArray[4]: //'电视视频比例:'
          this.tvScaleIndex--;
          if (this.tvScaleIndex < 0) {
            this.tvScaleIndex = this.tvScaleCount - 1;
          }
          var index = this.listMenu();
          this.currentTvScaleIndex = 0;
          $('selecte_item' + this.currentTvScaleIndex).className = 'selecte_item_hover';
          break;
        case this.formArray[6]: //'软件与信息查询:'
          this.softWareQueryIndex--;
          if (this.softWareQueryIndex < 0) {
            this.softWareQueryIndex = this.softWareQueryCount - 1;
          }
          var index = this.listMenu();
          this.currentSoftWareQueryIndex = 0;
          $('selecte_item' + this.currentSoftWareQueryIndex).className = 'selecte_item_hover';
          break;
        case this.formArray[7]: //'磁盘管理:'
          this.diskManagerIndex--;
          if (this.diskManagerIndex < 0) {
            this.diskManagerIndex = this.diskManagerCount - 1;
          }
          var index = this.listMenu();
          this.currentDiskManagerIndex = 0;
          $('selecte_item' + this.currentDiskManagerIndex).className = 'selecte_item_hover';
          break;
        case this.formArray[8]: //'账户设置:'
          this.accountIndex--;
          if (this.accountIndex < 0) {
            this.accountIndex = this.accountCount - 1;
          }
          var index = this.listMenu();
          this.currentAccountIndex = 0;
          $('selecte_item' + this.currentAccountIndex).className = 'selecte_item_hover';
          break;
        default:
          break;
      }

      break;
    case 'selecte_item3':
      var item = $('form_item_key3').innerText;
      switch (item) {
        case this.formArray[1]: //'字幕颜色:'
          this.fontColorIndex--;
          if (this.fontColorIndex < 0) {
            this.fontColorIndex = this.fontColorCount - 1;
          }
          var index = this.listMenu();
          this.currentFontColorIndex = 3;
          $('selecte_item' + this.currentFontColorIndex).className = 'selecte_item_hover';

          var result = $('form_item_key3').innerText;
          this.getFontColorList(result);
          break;
        case this.formArray[5]: //'网络设置:'
          this.networkSetIndex--;
          if (this.networkSetIndex < 0) {
            this.networkSetIndex = this.networkSetCount - 1;
          }
          var index = this.listMenu();
          this.currentNetWorkSetIndex = 1;
          $('selecte_item' + this.currentNetWorkSetIndex).className = 'selecte_item_hover';
          break;
        default:
          break;
      }
      break;
    default:
      break;
  }

};
/**
* @function: keydownHandler
* @description: 向下操作按键事件

* @param: null
* @return: null
*/
Dare.InitSetting.prototype.keydownHandler = function () {
  //  $('menubug').innerHTML += this.currentFocus + '
';
  if (this.verSionInfoFlag) return;
  if (this.netWorkStatuasInfoFlag) return;
  if (this.networkDynamicFlag) return;
  if (this.adslLoginFlag) return;
  if (this.factoryFlag) return;
  switch (this.currentFocus) {
    case 'txt_ip':
      this.currentFocus = 'txt_mask_ip';
      break;
    case 'txt_mask_ip':
      this.currentFocus = 'txt_networkgate';
      break;
    case 'txt_networkgate':
      this.currentFocus = 'txt_dns_ip';
      break;
    case 'txt_dns_ip':
      this.currentFocus = 'btnok';
      $('btnok').className = 'btnok_over';
      $('txt_ip').blur();
      break;
    case 'txt_wifistatic_ip':
      this.currentFocus = 'txt_wifistatic_maskip';
      break;
    case 'txt_wifistatic_maskip':
      this.currentFocus = 'txt_wifistatic_networkgate';
      break;
    case 'txt_wifistatic_networkgate':
      this.currentFocus = 'txt_wifistatic_dnsip';
      break;
    case 'txt_wifistatic_dnsip':
      this.currentFocus = 'btnok';
      $('btnok').className = 'btnok_over';
      $('txt_wifistatic_ip').blur();
      break;
    case 'txt_adsl_name':
      this.currentFocus = 'txt_adsl_password';
      break;
    case 'txt_adsl_password':
      this.currentFocus = 'btnok';
      $('btnok').className = 'btnok_over';
      $('txt_adsl_name').blur();
      break;
    case 'txt_wifi_password':
      this.currentFocus = 'btnok';
      $('btnok').className = 'btnok_over';
      $('txt_wifi_password').blur();
      break;
    case 'txt_account_server_0':
    case 'select_account_server':
      this.currentFocus = 'btnok';
      $('btnok').className = 'btnok_over';
      $('select_account_server').blur();
      $('txt_account_server_0').blur();
      break;
    case 'btnok':
    case 'btncancel':
      $('txt_ip').blur();
      $('txt_adsl_name').blur();
      $('txt_wifi_password').blur();
      $('select_account_server').blur();
      $('txt_account_server_0').blur();
      $('txt_wifistatic_ip').blur();
      break;
    default:
      this.menuDown();
      var foucusId = this.currentFocus.substr(2, 1);
      var id = parseInt(foucusId);
      if (id < this.wifiCount) {
        var i = id + 1;
        if ($('wn' + i)) {
          $('wn' + id).className = 'wifi_item_name';
          $('wn' + i).className = 'wifi_item_name_hover';

          $('wv' + id).className = 'wifi_item_value';
          $('wv' + i).className = 'wifi_item_value_hover';
          this.currentFocus = 'wn' + i;
        }
        else {
          var j = (this.wifiCount - 1);
          $('wn' + j).className = 'wifi_item_name';
          $('wv' + j).className = 'wifi_item_value';
          this.cancelButtonPosition();
        }
      }
      break;
  }
};

/**
* @function: keydownHandler
* @description: 向上操作按键事件

* @param: null
* @return: null
*/
Dare.InitSetting.prototype.keyupHandler = function () {
  if (this.verSionInfoFlag) return;
  if (this.netWorkStatuasInfoFlag) return;
  if (this.networkDynamicFlag) return;
  if (this.adslLoginFlag) return;
  if (this.factoryFlag) return;
  if (this.wifiDynamicFlag) return;
  if (this.wifiSearchFlag) {
    if (this.currentFocus == 'btncancel') {
      var j = this.wifiCount - 1;
      this.currentFocus = 'wn' + j;
      $('wn' + j).className = 'wifi_item_name_hover';
      $('wv' + j).className = 'wifi_item_value_hover';
      $('btncancel').className = 'btncancel';
      $('btncancel').style.marginLeft = '270px';
      return;
    }
  }
  switch (this.currentFocus) {
    case 'btncancel':
    case 'btnok':
      $('btnok').className = 'btnok';
      $('btncancel').className = 'btncancel';
      if (txt_dns_ip) {
        this.currentFocus = 'txt_dns_ip';
        $('txt_dns_ip').focus();
      }
      if (txt_adsl_password) {
        this.currentFocus = 'txt_adsl_password';
        $('txt_adsl_password').focus();
      }
      if (txt_wifi_password) {
        this.currentFocus = 'txt_wifi_password';
        $('txt_wifi_password').focus();
      }
      if (txt_wifistatic_dnsip) {
        this.currentFocus = 'txt_wifistatic_dnsip';
        $('txt_wifistatic_dnsip').focus();
      }
      var mode = parseInt(iPanel.getGlobalVar('ipmode') == null ? '0' : iPanel.getGlobalVar('ipmode'));
      switch (mode) {
        case ServerAddressMode.OPTIONAL: //0 可选
          this.currentFocus = 'select_account_server';
          $('select_account_server').focus();
          break;
        case ServerAddressMode.CUSTOM: //1 定制
          this.currentFocus = 'txt_account_server_0';
          $('txt_account_server_0').focus();
          break;
        default:
          break;
      }
      break;
    case 'txt_dns_ip':
      this.currentFocus = 'txt_networkgate';
      $('txt_networkgate').focus();
      break;
    case 'txt_networkgate':
      this.currentFocus = 'txt_mask_ip';
      $('txt_mask_ip').focus();
      break;
    case 'txt_mask_ip':
      this.currentFocus = 'txt_ip';
      $('txt_ip').focus();
      break;
    case 'txt_wifistatic_dnsip':
      this.currentFocus = 'txt_wifistatic_networkgate';
      $('txt_wifistatic_networkgate').focus();
      break;
    case 'txt_wifistatic_networkgate':
      this.currentFocus = 'txt_wifistatic_maskip';
      $('txt_wifistatic_maskip').focus();
      break;
    case 'txt_wifistatic_maskip':
      this.currentFocus = 'txt_wifistatic_ip';
      $('txt_wifistatic_ip').focus();
      break;
    case 'txt_adsl_password':
      this.currentFocus = 'txt_adsl_name';
      $('txt_adsl_name').focus();
      break;
    case 'txt_account_server_0':
      this.currentFocus = 'txt_account_server_0';
      $('txt_account_server_0').focus();
      break;
    case 'select_account_server':
      this.currentFocus = 'select_account_server';
      $('select_account_server').focus();
      break;
    default:
      this.menuUp();
      var foucusId = this.currentFocus.substr(2, 1);
      var id = parseInt(foucusId);
      if (id < this.wifiCount) {
        var i = id - 1;
        if ($('wn' + i)) {
          $('wn' + id).className = 'wifi_item_name';
          $('wn' + i).className = 'wifi_item_name_hover';

          $('wv' + id).className = 'wifi_item_value';
          $('wv' + i).className = 'wifi_item_value_hover';
          this.currentFocus = 'wn' + i;
        }
      }
      break;
  }
};

/**
* @function: keyleftHandler
* @description: 向左操作按键事件

* @param: null
* @return: null
*/
Dare.InitSetting.prototype.keyleftHandler = function () {
  if (this.verSionInfoFlag) return;
  if (this.netWorkStatuasInfoFlag) return;
  if (this.networkDynamicFlag) return;
  if (this.adslLoginFlag) return;
  if (this.factoryFlag) return;
  if (this.wifiDynamicFlag) return;
  switch (this.currentFocus) {
    case 'btncancel':
      this.currentFocus = 'btnok';
      $('btnok').className = 'btnok_over';
      $('btncancel').className = 'btncancel';
      if (txt_ip) {
        $('txt_ip').blur();
      }
      if (txt_adsl_name) {
        $('txt_adsl_name').blur();
      }
      if (txt_wifi_password) {
        $('txt_wifi_password').blur();
      }
      if (select_account_server) {
        $('select_account_server').blur();
      }
      if (txt_account_server_0) {
        $('txt_account_server_0').blur();
      }
      if (txt_wifistatic_ip) {
        $('txt_wifistatic_ip').blur();
      }
      break;
    default:
      switch (this.currentFocus) {
        case 'selecte_item0':
        case 'selecte_item1':
        case 'selecte_item3':
          this.selectArrowDisplay('none');
          this.formArrowDisplay('block');
          this.currentFocus = 'form_item_key3';
          $('form_item_key3').className = 'form_item_key_hover';
          $('form_item_value3').className = 'form_item_value_hover';
          $('selecter_right').innerHTML = '';
          $('select_arrow_left').style.display = 'none';
          break;
        case 'form_item_key3':
          this.formArrowDisplay('none');
          this.menuArrowDisplay('block');
          this.currentFocus = 'menu_item1';
          $('menu_item1').className = 'menu_item_hover';
          $('form_item_key3').className = 'form_item_key';
          $('form_item_value3').className = 'form_item_value';
          break;
        default:
          break;
      }
      break;
  }
};

/**
* @function: keyrightHandler
* @description: 向右操作按键事件

* @param: null
* @return: null
*/
Dare.InitSetting.prototype.keyrightHandler = function () {
  if (this.verSionInfoFlag) return;
  if (this.netWorkStatuasInfoFlag) return;
  if (this.networkDynamicFlag) return;
  if (this.adslLoginFlag) return;
  if (this.factoryFlag) return;
  if (this.wifiDynamicFlag) return;
  switch (this.currentFocus) {
    case 'btnok':
      this.currentFocus = 'btncancel';
      $('btnok').className = 'btnok';
      $('btncancel').className = 'btncancel_over';
      if (txt_ip) {
        $('txt_ip').blur();
      }
      if (txt_adsl_name) {
        $('txt_adsl_name').blur();
      }
      if (txt_wifi_password) {
        $('txt_wifi_password').blur();
      }
      if (select_account_server) {
        $('select_account_server').blur();
      }
      if (txt_account_server_0) {
        $('txt_account_server_0').blur();
      }
      if (txt_wifistatic_ip) {
        $('txt_wifistatic_ip').blur();
      }
      break;
    default:
      var item = '';
      switch (this.currentFocus) {
        case 'menu_item1':
          this.formArrowDisplay('block');
          this.menuArrowDisplay('none');
          this.currentFocus = 'form_item_key3';
          $('menu_item1').className = 'menu_item';
          $(this.currentFocus).className = 'form_item_key_hover';
          $('form_item_key3').className = 'form_item_key_hover';
          $('form_item_value3').className = 'form_item_value_hover';
          break;
        case 'form_item_key3':
          this.formArrowDisplay('none');
          this.selectArrowDisplay('block');
          $('form_item_key3').className = 'form_item_key';
          $('form_item_value3').className = 'form_item_value';
          $('select_arrow_left').style.display = 'block';
          $('select_arrow_up').style.display = 'block';
          $('select_arrow_down').style.display = 'block';
          item = $('form_item_key3').innerText;
          switch (item) {
            case this.formArray[0]: //'字幕大小:'
              $('selecter_right').innerHTML = this.createSelectItem(3, this.fontSizeArray);
              this.currentFocus = 'selecte_item0';
              break;
            case this.formArray[1]: //'字幕颜色:'
              $('selecter_right').innerHTML = this.createSelectItem(7, this.fontColorArray);
              this.currentFocus = 'selecte_item3';
              break;
            case this.formArray[2]: //'下载路径:'
              $('selecter_right').innerHTML = this.createSelectItem(2, this.downPathArray);
              this.currentFocus = 'selecte_item0';
              break;
            case this.formArray[3]: //'电视机标准:'
              $('selecter_right').innerHTML = this.createSelectItem(2, this.tvOutArray);
              this.currentFocus = 'selecte_item0';
              break;
            case this.formArray[4]: //'电视视频比例:'
              $('selecter_right').innerHTML = this.createSelectItem(2, this.tvScaleArray);
              this.currentFocus = 'selecte_item0';
              break;
            case this.formArray[5]: //'网络设置:'
              $('selecter_right').innerHTML = this.createSelectItem(7, this.networkSetArray);
              this.currentFocus = 'selecte_item3';
              break;
            case this.formArray[6]: //'软件与信息查询:'
              $('selecter_right').innerHTML = this.createSelectItem(4, this.softWareQueryArray);
              this.currentFocus = 'selecte_item0';
              break;
            case this.formArray[7]: //'磁盘管理:'
              $('selecter_right').innerHTML = this.createSelectItem(3, this.diskManagerArray);
              this.currentFocus = 'selecte_item0';
              break;
            case this.formArray[8]: //'账户设置:'
              $('selecter_right').innerHTML = this.createSelectItem(1, this.accountArray);
              this.currentFocus = 'selecte_item0';
              break;
            default:
              break;
          }
          $(this.currentFocus).className = 'selecte_item_hover';
          this.getFontColorList(item);
          break;
        default:
          break;
      }
      break;
  }
};
/**
* @function: keyenterHandler
* @description: 确定事件

* @param: null
* @return: null
*/
Dare.InitSetting.prototype.keyenterHandler = function () {
  switch (this.currentFocus) {
    case 'selecte_item0':
      var val = $('selecte_item0').innerText;
      $('form_item_value3').innerText = val;
      var item = $('form_item_key3').innerText;
      switch (item) {
        case this.formArray[0]: //'字幕大小:'
          switch (val) {
            case this.fontSizeArray[0]: //大字体
              this.command.setFontSize('' + FontSizeMode.BIG);
              break;
            case this.fontSizeArray[1]: //中字体
              this.command.setFontSize('' + FontSizeMode.MIDDLE);
              break;
            case this.fontSizeArray[2]: //小字体
              this.command.setFontSize('' + FontSizeMode.SMALL);
              break;
            default:
              break;
          }
          break;
        case this.formArray[2]: //'下载路径:'
          switch (val) {
            case this.downPathArray[0]: //移动硬盘',
              this.command.setDownPath('' + DownloadPathMode.MOBILE_HARDDRIVE);
              break;
            case this.downPathArray[1]: //内置硬盘',
              this.command.setDownPath('' + DownloadPathMode.BUILT_IN_HARDDRIVE);
              break;
            default:
              break;
          }
          break;
        case this.formArray[3]: //'电视机标准:'
          switch (val) {
            case this.tvOutArray[0]: //'NTSC'
              this.command.setTVSystem('' + TVOutMode.NTSC);
              break;
            case this.tvOutArray[1]: //PAL
              this.command.setTVSystem('' + TVOutMode.PAL);
              break;
            default:
              break;
          }
          break;
        case this.formArray[4]: //'电视视频比例:'
          switch (val) {
            case this.tvScaleArray[0]: //4:3
              this.command.setTVScale('' + TVOutScaleMode.FOUR_TO_THREE);
              break;
            case this.tvScaleArray[1]: //16:9
              this.command.setTVScale('' + TVOutScaleMode.SIXTEEN_TO_NINE);
              break;
            default:
              break;
          }
          break;
        case this.formArray[6]: //'软件与信息查询:'
          $('form_item_value3').innerText = '';
          switch (val) {
            case this.softWareQueryArray[0]: //出厂设置'
              $('overform').style.display = 'block';
              $('form_title').innerText = this.softWareQueryArray[0];
              this.formFocus = 'selecte_item0';
              this.currentFocus = 'btnok';
              $(this.currentFocus).className = 'btnok_over';
              $('form_content').innerHTML = '

' + this.softWareQueryArray[0] + '
';
              $('form_content').style.textAlign = 'center';
              $('form_content').style.fontSize = '31px';
              this.factoryFlag = true;
              break;
            case this.softWareQueryArray[1]: //版本升级
              $('overform').style.display = 'block';
              $('form_title').innerText = this.softWareQueryArray[1];
              this.formFocus = 'selecte_item0';
              this.currentFocus = 'btnok';
              $(this.currentFocus).className = 'btnok_over';
              $('form_content').innerHTML = '
版本升级,升级过程中请勿断电或关机!
';
              $('form_content').style.textAlign = 'center';
              $('form_content').style.fontSize = '31px';
              //this.factoryFlag = true;
              break;
            case this.softWareQueryArray[2]: //版本信息
              this.displayForm(this.softWareQueryArray[2]);
              var jsonStr = this.command.getVersion();
              var json = new Dare.JSObject.JSON();
              this.systemVerSionInfoObject = json.toObject(jsonStr);
              $('form_content').innerHTML = this.createForm(this.softWareQueryArray[2]);
              this.verSionInfoFlag = true;
              break;
            case this.softWareQueryArray[3]: //网络状态查询
              this.displayForm(this.softWareQueryArray[3]);
              var jsonStr = this.command.getNetworkStatus();
              var json = new Dare.JSObject.JSON();
              this.networkStatuasObject = json.toObject(jsonStr);
              $('form_content').innerHTML = this.createForm(this.softWareQueryArray[3]);
              this.netWorkStatuasInfoFlag = true;
              break;
            default:
              break;
          }
          break;
        case this.formArray[7]: //'磁盘管理:'
          $('form_item_value3').innerText = '';
          break;
        case this.formArray[8]: //'账户设置:'
          $('form_item_value3').innerText = '';
          $('overform').style.display = 'block';
          $('form_title').innerText = this.accountArray[0];
          this.formFocus = 'selecte_item0';

          var jsonStr = this.command.getAcount();
          var json = new Dare.JSObject.JSON();
          this.systemAccountObject = json.toObject(jsonStr);

          $('form_content').innerHTML = this.createForm(this.accountArray[0]);
          $('txt_account_name').innerText = this.systemAccountObject.name;
          $('txt_account_password').innerText = this.systemAccountObject.password;
          var ipfamilyObject = this.systemAccountObject.selectedipfamily;
          var ip = ipfamilyObject.ip;
          var ipObject = dareUtil.joinDotArr(ip); // (ip.length == 0 ? '000.000.000.000' : ip).split('.');
          this.setIPValue('txt_account_server', ipObject);
          this.currentFocus = 'select_account_server';
          $('select_account_server').focus();
          break;
        default:
          break;
      }
      break;
    case 'select_account_server': //服务器地址设置
      this.setAccountIPSelectChange();
      break;
    case 'txt_ip':
    case 'txt_mask_ip':
    case 'txt_networkgate':
    case 'txt_dns_ip':
    case 'txt_account_server_0':
    case 'txt_account_server_1': //IP输入框聚焦
    case 'txt_account_server_2': //IP输入框聚焦
    case 'txt_account_server_3': //IP输入框聚焦
      //alert(this.currentFocus);
      this.command.setSoftKeyWord('' + SoftKeyWordMode.ON); //下发软件盘打开指令
      break;
    case 'selecte_item3':
      var val = $('selecte_item3').innerText;
      $('form_item_value3').innerText = val;
      var item = $('form_item_key3').innerText;
      switch (item) {
        case this.formArray[1]: //'字幕颜色:'
          switch (val) {
            case this.fontColorArray[0]: //红
              this.command.setFontColor('' + FontColorMode.RED);
              break;
            case this.fontColorArray[1]: //橙
              this.command.setFontColor('' + FontColorMode.ORANGE);
              break;
            case this.fontColorArray[2]: //黄
              this.command.setFontColor('' + FontColorMode.YELLOW);
              break;
            case this.fontColorArray[3]: //绿
              this.command.setFontColor('' + FontColorMode.GREEN);
              break;
            case this.fontColorArray[4]: //青
              this.command.setFontColor('' + FontColorMode.BLUE_GREEN);
              break;
            case this.fontColorArray[5]: //蓝
              this.command.setFontColor('' + FontColorMode.BLUE);
              break;
            case this.fontColorArray[6]: //紫
              this.command.setFontColor('' + FontColorMode.PURPLE);
              break;
            case this.fontColorArray[7]: //白
              this.command.setFontColor('' + FontColorMode.WHITE);
              break;
            default:
              break;
          }
          break;
        case this.formArray[5]: //'网络设置:'
          switch (val) {
            case this.networkSetArray[0]: //WIFI搜索
              $('overform').style.display = 'block';
              $('form_title').innerText = this.networkSetArray[0];
              this.formFocus = 'selecte_item3';
              var wifiStatuas = parseInt(this.command.getWiFiStatus());
              switch (wifiStatuas) {
                case WiFiMode.YES:
                  this.currentFocus = 'btnok';
                  $(this.currentFocus).className = 'btnok_over';
                  $('form_content').innerHTML = '

' + this.networkSetArray[0] + '
';
                  $('form_content').style.textAlign = 'center';
                  $('form_content').style.fontSize = '31px';
                  break;
                case WiFiMode.NO:
                  var html = '';
                  html = '
无法识别的硬件设备!请先安装无线网卡。
';
                  $('form_content').innerHTML = html;
                  $('form_content').style.textAlign = 'center';
                  $('form_content').style.fontSize = '31px';
                  $('btnok').style.display = 'none';
                  this.cancelButtonPosition();
                  break;
                default:
                  break;
              }
              break;
            case this.networkSetArray[1]: //WIFI动态配置
              $('overform').style.display = 'block';
              $('form_title').innerText = this.networkSetArray[1];
              this.formFocus = 'selecte_item3';
              var wifiStatuas = parseInt(this.command.getWiFiStatus());
              switch (wifiStatuas) {
                case WiFiMode.YES:
                  this.currentFocus = 'btnok';
                  $(this.currentFocus).className = 'btnok_over';
                  $('form_content').innerHTML = '
' + this.networkSetArray[1] + '
';
                  $('form_content').style.textAlign = 'center';
                  $('form_content').style.fontSize = '31px';
                  break;
                case WiFiMode.NO:
                  var html = '';
                  html = '
无法识别的硬件设备!请先安装无线网卡。
';
                  $('form_content').innerHTML = html;
                  $('form_content').style.textAlign = 'center';
                  $('form_content').style.fontSize = '31px';
                  $('btnok').style.display = 'none';
                  this.cancelButtonPosition();
                  break;
                default:
                  break;
              }
              break;
            case this.networkSetArray[2]: //WIFI静态配置
              $('overform').style.display = 'block';
              $('form_title').innerText = this.networkSetArray[2];
              this.formFocus = 'selecte_item3';
              var wifiStatuas = parseInt(this.command.getWiFiStatus());
              switch (wifiStatuas) {
                case WiFiMode.YES:
                  $('overform').style.display = 'block';
                  $('form_title').innerText = this.networkSetArray[2];
                  this.currentFocus = 'txt_wifistatic_ip';
                  this.formFocus = 'selecte_item3';
                  $('form_content').innerHTML = this.createForm(this.networkSetArray[2]);

                  var jsonStr = this.command.getWIFIStatic();
                  var json = new Dare.JSObject.JSON();
                  this.wifiStaticObject = json.toObject(jsonStr);
                  $('txt_wifistatic_ip').value = dareUtil.joinDot(this.wifiStaticObject.ip);
                  $('txt_wifistatic_maskip').value = dareUtil.joinDot(this.wifiStaticObject.mask);
                  $('txt_wifistatic_networkgate').value = dareUtil.joinDot(this.wifiStaticObject.gateway);
                  $('txt_wifistatic_dnsip').value = dareUtil.joinDot(this.wifiStaticObject.dns);
                  break;
                case WiFiMode.NO:
                  var html = '';
                  html = '

无法识别的硬件设备!请先安装无线网卡。
';
                  $('form_content').innerHTML = html;
                  $('form_content').style.textAlign = 'center';
                  $('form_content').style.fontSize = '31px';
                  $('btnok').style.display = 'none';
                  this.cancelButtonPosition();
                  break;
                default:
                  break;
              }
              break;
            case this.networkSetArray[3]: //IP动态配置'
              $('overform').style.display = 'block';
              $('form_title').innerText = this.networkSetArray[3];
              this.currentFocus = 'btnok';
              $(this.currentFocus).className = 'btnok_over';
              this.formFocus = 'selecte_item3';
              $('form_content').innerHTML = this.createForm(this.networkSetArray[3]);
              $('form_content').style.textAlign = 'center';
              $('form_content').style.fontSize = '31px';
              break;
            case this.networkSetArray[4]: //IP静态配置
              $('overform').style.display = 'block';
              $('form_title').innerText = this.networkSetArray[4];
              this.currentFocus = 'txt_ip';
              this.formFocus = 'selecte_item3';
              $('form_content').innerHTML = this.createForm(this.networkSetArray[4]);

              var jsonStr = this.command.getNetworkStatic();
              var json = new Dare.JSObject.JSON();
              this.staticIPObject = json.toObject(jsonStr);
              $('txt_ip').value = dareUtil.joinDot(this.staticIPObject.ip);
              $('txt_mask_ip').value = dareUtil.joinDot(this.staticIPObject.mask);
              $('txt_networkgate').value = dareUtil.joinDot(this.staticIPObject.gateway);
              $('txt_dns_ip').value = dareUtil.joinDot(this.staticIPObject.dns);
              break;
            case this.networkSetArray[5]: //ADSL账户
              $('overform').style.display = 'block';
              $('form_title').innerText = this.networkSetArray[5];
              this.currentFocus = 'txt_adsl_name';
              this.formFocus = 'selecte_item3';
              $('form_content').innerHTML = this.createForm(this.networkSetArray[5]);

              var jsonStr = this.command.getNetworkADSLAccount();
              var json = new Dare.JSObject.JSON();
              this.adslAccountObject = json.toObject(jsonStr);
              $('txt_adsl_name').value = this.adslAccountObject.name;
              $('txt_adsl_password').value = this.adslAccountObject.password;
              break;
            case this.networkSetArray[6]: //ADSL登录
              $('overform').style.display = 'block';
              $('form_title').innerText = this.networkSetArray[6];
              this.currentFocus = 'btnok';
              $(this.currentFocus).className = 'btnok_over';
              this.formFocus = 'selecte_item3';
              $('form_content').innerHTML = this.createForm(this.networkSetArray[6]);
              $('form_content').style.textAlign = 'center';
              $('form_content').style.fontSize = '31px';
              break;
            case this.networkSetArray[7]: //ADSL离线
              $('overform').style.display = 'block';
              $('form_title').innerText = this.networkSetArray[7];
              this.currentFocus = 'btnok';
              $(this.currentFocus).className = 'btnok_over';
              this.formFocus = 'selecte_item3';
              $('form_content').innerHTML = this.createForm(this.networkSetArray[7]);
              $('form_content').style.textAlign = 'center';
              $('form_content').style.fontSize = '31px';
              break;
            default:
              break;
          }
          break;
        default:
          break;
      }
      break;
    case 'btncancel':
      this.clearForm();
      break;
    case 'btnok': //窗体发送命令
      var item = $('form_title').innerText;
      switch (item) {
        case this.wifiSet: //WIFI设置
          var accountObject = {};
          var name = $('txt_wifi_name').innerText;
          var password = $('txt_wifi_password').value;

          accountObject.name = name;
          accountObject.password = password;
          var json = new Dare.JSObject.JSON();
          var jsonStr = json.parse(accountObject);
          this.command.setWIFILogin(jsonStr);

          this.okCancelDisplay(false);
          this.formFocus = 'selecte_item3';

          var html = '';
          html += '

';
          html += '
WIFI正在登陆...,请稍等!
';
          $('form_content').innerHTML = html;

          if (this.timerInterval)
            clearInterval(this.timerInterval)
          this.timerInterval = setInterval('dareInitSetting.wifiLoginDispatch();', this.intervalTime);
          break;
        case this.softWareQueryArray[0]: //恢复出厂设置
          this.command.setFactory(this.cmdValueByNull);
          this.clearForm();
          break;
        case this.softWareQueryArray[1]: //版本升级
          this.command.setUpgrade(this.cmdValueByNull);
          this.clearForm();
          break;
        case this.networkSetArray[0]: //WIFI搜索
          this.okCancelDisplay(false);
          this.formFocus = 'selecte_item3';
          var html = '';
          html += '

';
          html += '
正在搜索可用的WIFI...,请稍等!
';
          $('form_content').innerHTML = html;

          if (this.timerInterval)
            clearInterval(this.timerInterval)
          this.timerInterval = setInterval('dareInitSetting.searchWiFiDispatch();', this.intervalTime);
          break;
        case this.networkSetArray[1]: //WIFI动态配置
          this.okCancelDisplay(false);
          this.formFocus = 'selecte_item3';
          var html = '';
          html += '

';
          html += '
正在动态配置WIFI...,请稍等!
';
          $('form_content').innerHTML = html;

          this.command.setWIFIDynamic(this.cmdValueByNull);
          this.readCount = 0;
          if (this.timerInterval)
            clearInterval(this.timerInterval)
          this.timerInterval = setInterval('dareInitSetting.wifiDynamicDispatch();', this.intervalTime);
          break;
        case this.networkSetArray[2]: //WIFI静态配置
          var ip = dareUtil.trimDot($('txt_wifistatic_ip').value);
          var mask = dareUtil.trimDot($('txt_wifistatic_maskip').value);
          var networkgate = trimDot.joinDot($('txt_wifistatic_networkgate').value);
          var dns = dareUtil.trimDot($('txt_wifistatic_dnsip').value);

          this.wifiStaticObject.ip = ip;
          this.wifiStaticObject.mask = mask;
          this.wifiStaticObject.gateway = networkgate;
          this.wifiStaticObject.dns = dns;

          var json = new Dare.JSObject.JSON();
          var jsonStr = json.parse(this.wifiStaticObject);
          this.command.setWIFIStatic(jsonStr);
          this.clearForm();
          break;
        case this.networkSetArray[3]: //动态配置'
          this.okCancelDisplay(false);
          this.formFocus = 'selecte_item3';
          var html = '';
          html += '

';
          html += '
正在设置DHCP...,请稍等!
';
          $('form_content').innerHTML = html;

          this.command.setNetworkDynamic(this.cmdValueByNull);
          this.readCount = 0;
          if (this.timerInterval)
            clearInterval(this.timerInterval)
          this.timerInterval = setInterval('dareInitSetting.networkDynamicDispatch();', this.intervalTime);
          break;
        case this.networkSetArray[4]: //静态IP配置
          var ip = dareUtil.trimDot($('txt_ip').value);
          var mask = dareUtil.trimDot($('txt_mask_ip').value);
          var networkgate = trimDot.joinDot($('txt_networkgate').value);
          var dns = dareUtil.trimDot($('txt_dns_ip').value);

          this.staticIPObject.ip = ip;
          this.staticIPObject.mask = mask;
          this.staticIPObject.gateway = networkgate;
          this.staticIPObject.dns = dns;

          var json = new Dare.JSObject.JSON();
          var jsonStr = json.parse(this.staticIPObject);
          this.command.setNetworkStatic(jsonStr);
          this.clearForm();
          break;
        case this.networkSetArray[5]: //ADSL账户配置
          var msgArray = [];
          var name = $('txt_adsl_name').value;
          var password = $('txt_adsl_password').value;
          if (name.length == 0) {
            msgArray.push('请输入用户名.');
            $('txt_adsl_name').focus();
            this.currentFocus = 'txt_adsl_name';
          }
          else {
            if (name.length > 25) {
              msgArray.push('对不起,用户名长度最大25位.');
              $('txt_adsl_name').focus();
              this.currentFocus = 'txt_adsl_name';
            }
          }
          if (password.length == 0) {
            msgArray.push('请输入密码.');
            $('txt_adsl_password').focus();
            this.currentFocus = 'txt_adsl_password';
          }
          else {
            if (password.length > 15) {
              msgArray.push('对不起,密码长度最大15位.');
              $('txt_adsl_password').focus();
              this.currentFocus = 'txt_adsl_password';
            }
          }
          if (msgArray.length > 0) {
            $('btnok').className = 'btnok';
            this.showMsg(msgArray);
            return;
          }
          var adslObject = {};
          adslObject.name = name;
          adslObject.password = password;

          var json = new Dare.JSObject.JSON();
          var jsonStr = json.parse(adslObject);
          this.command.setNetworkADSLAccount(jsonStr);
          this.clearForm();
          break;
        case this.networkSetArray[6]: //ADSL登录
          this.okCancelDisplay(false);
          this.formFocus = 'selecte_item3';
          var html = '';
          html += '

';
          html += '
正在登录ADSL,请稍等!
';
          $('form_content').innerHTML = html;

          this.command.setNetworkADSLLogin(this.cmdValueByNull);
          this.readCount = 0;
          if (this.timerInterval)
            clearInterval(this.timerInterval)
          this.timerInterval = setInterval('dareInitSetting.adslLoginDispatch()', this.intervalTime);
          break;
        case this.networkSetArray[7]: //ADSL离线
          this.okCancelDisplay(false);
          this.formFocus = 'selecte_item3';
          var html = '';
          html += '

';
          html += '
ADSL正准备离线,请稍等!
';
          $('form_content').innerHTML = html;

          this.command.setNetworkADSLLogout(this.cmdValueByNull);
          this.readCount = 0;
          if (this.timerInterval)
            clearInterval(this.timerInterval)
          this.timerInterval = setInterval('dareInitSetting.adslLogoutDispatch()', this.intervalTime);
          break;
        case this.accountArray[0]: //账户修改
          var accountObject = {};
          var name = $('txt_account_name').innerText;
          var password = $('txt_account_password').innerText;
          var ip = this.getIPValue('txt_account_server'); //$('txt_account_server').value;
          accountObject.name = name;
          accountObject.password = password;
          var mode = parseInt(iPanel.getGlobalVar('ipmode') == null ? '0' : iPanel.getGlobalVar('ipmode'));
          switch (mode) {
            case ServerAddressMode.OPTIONAL: //0 可选
              var ipSelected = dareUtil.getOptionValue($('select_account_server'));
              accountObject.ip = ipSelected;
              var ipfamilyArray = this.systemAccountObject.ipfamily;
              var length = ipfamilyArray.length;
              if (length > 0) {
                for (var i = 0; i < length; i++) {
                  if (ipfamilyArray[i].ip == ipSelected) {
                    accountObject.ipname = ipfamilyArray[i].ipname;
                    break;
                  }
                }
              }
              break;
            case ServerAddressMode.CUSTOM: //1 定制
              accountObject.ip = ip;
              accountObject.ipname = null;
              break;
            default:
              break;
          }
          var json = new Dare.JSObject.JSON();
          var jsonStr = json.parse(accountObject);
          this.command.setAcount(jsonStr);
          this.clearForm();
          break;
        default:
          break;
      }
      break;
    default:
      if (this.currentFocus.indexOf('wn') >= 0) {
        var foucusId = this.currentFocus.substr(2, 1);
        var val = $('wo' + foucusId).innerText;
        var json = new Dare.JSObject.JSON();
        var wiFi = json.toObject(val);

        this.clearForm();
        $('overform').style.display = 'block';
        $('form_title').innerText = this.wifiSet;
        this.formFocus = 'selecte_item3';
        this.currentFocus = 'txt_wifi_password';

        var html = '';
        html += '

       WIFI名(SSID):
';
        html += '
';
        html += '
' + wiFi.name + '
';
        html += '
       WIFI密钥:
';
        html += '
';
        html += '
';
        html += '
';
        $('form_content').innerHTML = html;
      }
      break;
  }
};
/**
* @function: clearForm
* @description: 清除关闭表单

* @param: itemCount, itemArray
* @return: null
*/
Dare.InitSetting.prototype.clearForm = function () {
  $('overform').style.display = 'none';
  $('form_content').innerHTML = '';
  $('form_content').className = 'form_content';
  $('btnok').className = 'btnok';
  $('btncancel').className = 'btncancel';
  this.currentFocus = this.formFocus;
  this.verSionInfoFlag = false;
  this.netWorkStatuasInfoFlag = false;
  this.adslLoginFlag = false;
  this.networkDynamicFlag = false;
  this.adslLogoutFlag = false;
  this.wifiSearchFlag = false;
  this.factoryFlag = false;
  this.wifiDynamicFlag = false;

  this.staticIPObject = null;
  this.wifiStaticObject = null;
  this.systemAccountObject = null;

  this.readCount = 0;
  if (this.timerInterval)
    clearInterval(this.timerInterval);
  if (this.timerOut)
    clearTimeout(this.timerOut);
};
/**
* @function: okCancelDisplay
* @description: 确定取消按钮显示关闭事件

* @param: null
* @return: null
*/
Dare.InitSetting.prototype.okCancelDisplay = function (flag) {
  if (flag) {
    $('btnok').style.display = 'block';
    $('btncancel').style.display = 'block';
  }
  else {
    $('btnok').style.display = 'none';
    $('btncancel').style.display = 'none';
  }
};
/**
* @function: displayForm
* @description: 显示窗体

* @param: null
* @return: null
*/
Dare.InitSetting.prototype.displayForm = function (title) {
  $('overform').style.display = 'block';
  $('form_title').innerText = title;
  this.currentFocus = 'btncancel';
  $(this.currentFocus).className = 'btncancel_over';
  $('btnok').style.display = 'none';
  this.formFocus = 'selecte_item0';
  $(this.currentFocus).style.marginLeft = '270px';
};
/**
* @function: cancelButtonPosition
* @description: 取消按钮聚焦定位事件

* @param: itemCount, itemArray
* @return: null
*/
Dare.InitSetting.prototype.cancelButtonPosition = function () {
  $('btncancel').style.display = 'block';
  this.currentFocus = 'btncancel';
  $(this.currentFocus).className = 'btncancel_over';
  $('btncancel').style.marginLeft = '270px';
};
/**
* @function: wifiLogin
* @description: wifi登录结果事件

* @param: null
* @return: null
*/
Dare.InitSetting.prototype.wifiLogin = function (val) {
  if (this.timerInterval)
    clearInterval(this.timerInterval);

  $('form_content').innerHTML = '

' + val + '
';
  this.okCancelDisplay(false);

  if (this.timerOut)
    clearTimeout(this.timerOut);
  this.timerOut = setTimeout('dareInitSetting.clearForm();', this.outTime);
};
/**
* @function: wifiLoginDispatch
* @description: wifi登录提交事件

* @param: null
* @return: null
*/
Dare.InitSetting.prototype.wifiLoginDispatch = function () {
  var result = parseInt(this.command.getWIFILogin());
  var val = '';
  switch (result) {
    case ResultMode.SUCCESS: //成功
      val = 'WIFI登录成功!正在动态获取ip...'
      this.wifiLogin(val)
      this.initNetwork();//初始化网络状态信息
      break;
    case ResultMode.FAIL: //失败
      this.readCount++;
      if (this.readCount > 4) {
        val = 'WIFI登录失败!请检查WIFI设置及网络连接...';
        this.wifiLogin(val)
        return;
      }
      break;
    default:
      break;
  }
};
/**
* @function: networkDynamic
* @description: 动态IP分配结果事件

* @param: null
* @return: null
*/
Dare.InitSetting.prototype.networkDynamic = function (val) {
  if (this.timerInterval)
    clearInterval(this.timerInterval);

  $('form_content').innerHTML = '

' + val + '
';
  this.okCancelDisplay(false);
  this.networkDynamicFlag = true;

  if (this.timerOut)
    clearTimeout(this.timerOut);
  this.timerOut = setTimeout('dareInitSetting.clearForm();', this.outTime);
};
/**
* @function: networkDynamicDispatch
* @description: 动态IP分配提交事件

* @param: null
* @return: null
*/
Dare.InitSetting.prototype.networkDynamicDispatch = function () {
  var result = parseInt(this.command.getNetworkDynamic());
  var val = '';
  switch (result) {
    case ResultMode.SUCCESS: //成功
      val = 'DHCP设置成功!'
      this.networkDynamic(val)
      break;
    case ResultMode.FAIL: //失败
      this.readCount++;
      if (this.readCount > 4) {
        val = 'DHCP设置失败!';
        this.networkDynamic(val)
        return;
      }
      break;
    default:
      break;
  }
};
/**
* @function: wifiDynamic
* @description: 动态WIFI分配结果事件

* @param: null
* @return: null
*/
Dare.InitSetting.prototype.wifiDynamic = function (val) {
  if (this.timerInterval)
    clearInterval(this.timerInterval);

  $('form_content').innerHTML = '

' + val + '
';
  this.okCancelDisplay(false);
  this.wifiDynamicFlag = true;

  if (this.timerOut)
    clearTimeout(this.timerOut);
  this.timerOut = setTimeout('dareInitSetting.clearForm();', this.outTime);
};
/**
* @function: wifiDynamicDispatch
* @description: 动态WIFI分配提交事件

* @param: null
* @return: null
*/
Dare.InitSetting.prototype.wifiDynamicDispatch = function () {
  var result = parseInt(this.command.getWIFIDynamic());
  var val = '';
  switch (result) {
    case ResultMode.SUCCESS: //成功
      val = 'WIFI动态设置成功!'
      this.wifiDynamic(val)
      break;
    case ResultMode.FAIL: //失败
      this.readCount++;
      if (this.readCount > 4) {
        val = 'WIFI动态设置失败!';
        this.wifiDynamic(val)
        return;
      }
      break;
    default:
      break;
  }
};
/**
* @function: adslLogin
* @description: ADSL登录结果事件

* @param: null
* @return: null
*/
Dare.InitSetting.prototype.adslLogin = function (val) {
  if (this.timerInterval)
    clearInterval(this.timerInterval);

  $('form_content').innerHTML = '

' + val + '
';
  this.okCancelDisplay(false);
  this.adslLoginFlag = true;

  if (this.timerOut)
    clearTimeout(this.timerOut);
  this.timerOut = setTimeout('dareInitSetting.clearForm();', this.outTime);
};
/**
* @function: adslLoginDispatch
* @description: ADSL登录提交事件

* @param: null
* @return: null
*/
Dare.InitSetting.prototype.adslLoginDispatch = function () {
  var result = parseInt(this.command.getNetworkADSLLogin());
  var val = '';
  switch (result) {
    case ResultMode.SUCCESS: //成功
      val = 'ADSL登录成功!'
      this.adslLogin(val)
      break;
    case ResultMode.FAIL: //失败
      this.readCount++;
      if (this.readCount > 4) {
        val = 'ADSL登录失败!';
        this.adslLogin(val)
        return;
      }
      break;
    default:
      break;
  }
};
/**
* @function: adslLogout
* @description: ADSL退出结果事件

* @param: null
* @return: null
*/
Dare.InitSetting.prototype.adslLogout = function (val) {
  if (this.timerInterval)
    clearInterval(this.timerInterval);

  $('form_content').innerHTML = '

' + val + '
';
  this.okCancelDisplay(false);
  this.adslLogoutFlag = true;

  if (this.timerOut)
    clearTimeout(this.timerOut);
  this.timerOut = setTimeout('dareInitSetting.clearForm();', this.outTime);
};
/**
* @function: adslLogoutDispatch
* @description: ADSL退出提交事件

* @param: null
* @return: null
*/
Dare.InitSetting.prototype.adslLogoutDispatch = function () {
  var result = parseInt(this.command.getNetworkADSLLogout());
  var val = '';
  switch (result) {
    case ResultMode.SUCCESS: //成功
      val = 'ADSL离线成功!'
      this.adslLogout(val)
      break;
    case ResultMode.FAIL: //失败
      this.readCount++;
      if (this.readCount > 4) {
        val = 'ADSL离线失败!';
        this.adslLogout(val)
        return;
      }
      break;
    default:
      break;
  }
};
/**
* @function: searchWiFiDispatch
* @description: 无线网络搜索

* @param: null
* @return: null
*/
Dare.InitSetting.prototype.searchWiFiDispatch = function () {
  var result = this.command.getWiFiList();
  var json = new Dare.JSObject.JSON();
  var wifiList = json.toObject(result);
  this.wifiCount = wifiList.length;
  if (this.wifiCount != 0) {
    if (this.timerInterval)
      clearInterval(this.timerInterval)

    var html = '';
    html += '

        WIFI名称
';
    html += '
信号强度
';
    //for (var i in wifiList)
    for (var i = 0; i < this.wifiCount; i++) {
      var wifiName = 'wn' + i;
      var wifiValue = 'wv' + i;
      var wiFi = 'wo' + i;
      var val = '{"name":"' + wifiList[i].name + '","ip":"' + wifiList[i].ip + '","strongvalue":"' + wifiList[i].strongvalue + '"}';
      html += '
        ' + wifiList[i].name + '
';
      html += '
' + wifiList[i].strongvalue + '%
';
    }
    $('form_content').innerHTML = html;
    this.currentFocus = 'wn0';
    $('wn0').className = 'wifi_item_name_hover';
    $('wv0').className = 'wifi_item_value_hover';

    $('btncancel').style.display = 'block';
    $('btncancel').className = 'btncancel';
    $('btncancel').style.marginLeft = '270px';
  }
  else {
    if (this.timerInterval)
      clearInterval(this.timerInterval)

    this.currentFocus = 'btnok'
    this.okCancelDisplay(true);
    $('form_content').innerHTML = '

未搜索到可用的WIFI!
';
  }
  this.wifiSearchFlag = true;
};

/**
* @function: showMsg
* @description: 显示消息框

* @param:  msg
* @return: null
*/
Dare.InitSetting.prototype.showMsg = function (msgArray) {
  var html = '';
  for (var i in msgArray) {
    html += '

';
    html += '
' + msgArray[i] + '
';
  }
  $('form_msg').innerHTML = html;
};
/**
* @function: getIPValue
* @description: 获取ip输入值

* @param: itemCount, itemArray
* @return: null
*/
Dare.InitSetting.prototype.getIPValue = function (key) {
  var input_0 = $(key + '_0').value;
  var input_1 = $(key + '_1').value;
  var input_2 = $(key + '_2').value;
  var input_3 = $(key + '_3').value;
  return input_0 + input_1 + input_2 + input_3;
  //return input_0 + "." + input_1 + "." + input_2 + "." + input_3;
};
/**
* @function: setIPValue
* @description: 设置ip输入值

* @param: itemCount, itemArray
* @return: null
*/
Dare.InitSetting.prototype.setIPValue = function (key, obj) {
  $(key + '_0').value = obj[0];
  $(key + '_1').value = obj[1];
  $(key + '_2').value = obj[2];
  $(key + '_3').value = obj[3];
};
/**
* @function: setAccountIPSelectChange
* @description: 设置账户服务器IP下拉切换

* @param: itemCount, itemArray
* @return: null
*/
Dare.InitSetting.prototype.setAccountIPSelectChange = function () {
  var mode = dareUtil.getOptionValue($('select_account_server'));
  if (mode == '-1') {
    $('select_account_server').style.display = 'none';
    $('txt_account_server').style.display = 'block';
    this.currentFocus = 'txt_account_server_0';
    $('txt_account_server_0').focus();
    iPanel.setGlobalVar('ipmode', '' + ServerAddressMode.CUSTOM); //1 定制
  }
  else {
    this.currentFocus = 'select_account_server';
    iPanel.setGlobalVar('ipmode', '' + ServerAddressMode.OPTIONAL); //0 可选
  }
};
/**
* @function: createForm
* @description: 表单构造器

* @param: itemCount, itemArray
* @return: null
*/
Dare.InitSetting.prototype.createForm = function (item) {
  var html = '';
  switch (item) {
    case this.networkSetArray[2]: //WIFI静态配置
      html += '

            IP地址:
';
      html += '
';
      html += '
';
      html += '
            子网掩码:
';
      html += '
';
      html += '
';
      html += '
            网关:
';
      html += '
';
      html += '
';
      html += '
            DNS IP:
';
      html += '
';
      html += '
';
      break;
    case this.networkSetArray[3]: //动态配置'
      html += '
系统动态分配IP。
';
      break;
    case this.networkSetArray[4]: //静态IP
      html += '
            IP地址:
';
      html += '
';
      html += '
';
      html += '
            子网掩码:
';
      html += '
';
      html += '
';
      html += '
            网关:
';
      html += '
';
      html += '
';
      html += '
            DNS IP:
';
      html += '
';
      html += '
';
      //      html += '
';
      break;
    case this.networkSetArray[5]: //ADSL账户
      html += '
      用户名:
';
      html += '
';
      html += '
';
      html += '
      密码:
';
      html += '
';
      html += '
';
      html += '
';
      break;
    case this.networkSetArray[6]: //ADSL登录
      html += '
登录ADSL。
';
      break;
    case this.networkSetArray[7]: //ADSL离线
      html += '
ADSL离线。
';
      break;
    case this.accountArray[0]: //账户设置
      html += '
      用户名:
';
      html += '
';
      html += '
';
      html += '
      密码:
';
      html += '
';
      html += '
******
';
      html += '
      服务器:
';
      html += '
';
      html += '';
      html += '
';
      break;
    case this.softWareQueryArray[2]: //版本信息
      html += '
功能版本:
';
      html += '
' + this.systemVerSionInfoObject.functionver + '
';
      html += '
页面版本:
';
      html += '
' + this.systemVerSionInfoObject.pagever + '
';
      html += '
输出设置:
';
      html += '
' + this.systemVerSionInfoObject.vedioout + '
';
      html += '
视频比例:
';
      html += '
' + this.systemVerSionInfoObject.vedioscale + '
';
      html += '
本地磁盘容量:
';
      html += '
' + this.systemVerSionInfoObject.localvolumn + '
';
      html += '
本地磁盘剩余容量:
';
      html += '
' + this.systemVerSionInfoObject.localremainvolumn + '
';
      html += '
移动磁盘容量:
';
      html += '
' + this.systemVerSionInfoObject.mobilevolumn + '
';
      html += '
移动磁盘剩余容量:
';
      html += '
' + this.systemVerSionInfoObject.mobileremainvolumn + '
';
      break;
    case this.softWareQueryArray[3]: //网络状态查询
      html += '
连接状态:
';
      var statuas = parseInt(this.networkStatuasObject.status);
      switch (statuas) {
        case NetWorkStatusMode[0].ERROR:
          html += '
' + NetWorkStatusMode[0].name + '
';
          break;
        case NetWorkStatusMode[1].CONNECTING:
          html += '
' + NetWorkStatusMode[1].name + '
';
          break;
        case NetWorkStatusMode[2].SUCCESS:
          html += '
' + NetWorkStatusMode[2].name + '
';
          break;
        case NetWorkStatusMode[3].NORMAL:
          html += '
' + NetWorkStatusMode[3].name + '
';
          break;
        case NetWorkStatusMode[4].W_ERROR:
          html += '
' + NetWorkStatusMode[4].name + '
';
          break;
        case NetWorkStatusMode[5].W_CONNECTING:
          html += '
' + NetWorkStatusMode[5].name + '
';
          break;
        case NetWorkStatusMode[6].W_SUCCESS:
          html += '
' + NetWorkStatusMode[6].name + '
';
          break;
        case NetWorkStatusMode[7].W_NORMAL:
          html += '
' + NetWorkStatusMode[7].name + '
';
          break;
        default:
          break;
      }
      html += '
当前登录方式:
';
      var method = parseInt(this.networkStatuasObject.method);
      switch (method) {
        case NetworkSetMode.DYNAMIC:
          html += '
动态分配IP
';
          break;
        case NetworkSetMode.STATIC:
          html += '
静态IP
';
          break;
        case NetworkSetMode.ADSL_ACCOUNT:
          html += '
ADSL账户
';
          break;
        case NetworkSetMode.WIFI_DYNAMIC:
          html += '
WIFI动态
';
          break;
        case NetworkSetMode.WIFI_STATIC:
          html += '
WIFI静态
';
          break;
        default:
          break;
      }
      html += '
MAC地址:
';
      html += '
' + this.networkStatuasObject.macaddress + '
';
      html += '
当前IP地址:
';
      html += '
' + this.networkStatuasObject.currentip + '
';
      break;
    default:
      break;
  }
  return html;
};
/**
* @function: keyrightHandler
* @description: 字幕颜色遍历

* @param: null
* @return: null
*/
Dare.InitSetting.prototype.getFontColorList = function (itemKey) {
  if (itemKey == this.formArray[1]) {//'字幕颜色:'
    for (var i = 0; i < 7; i++) {
      var result = $('selecte_item' + i).innerText;
      switch (result) {
        case this.fontColorArray[0]: //'红'
          $('selecte_item' + i).style.backgroundColor = 'Red';
          $('selecte_item' + i).style.textAlign = 'center';
          $('selecte_item' + i).style.color = 'White';
          break;
        case this.fontColorArray[1]: //'橙'
          $('selecte_item' + i).style.backgroundColor = 'Orange';
          $('selecte_item' + i).style.textAlign = 'center';
          $('selecte_item' + i).style.color = 'White';
          break;
        case this.fontColorArray[2]: //'黄'
          $('selecte_item' + i).style.backgroundColor = 'Yellow';
          $('selecte_item' + i).style.textAlign = 'center';
          $('selecte_item' + i).style.color = 'Black';
          break;
        case this.fontColorArray[3]: //'绿'
          $('selecte_item' + i).style.backgroundColor = 'Green';
          $('selecte_item' + i).style.textAlign = 'center';
          $('selecte_item' + i).style.color = 'White';
          break;
        case this.fontColorArray[4]: //'青'
          $('selecte_item' + i).style.backgroundColor = '#98CEE2';
          $('selecte_item' + i).style.textAlign = 'center';
          $('selecte_item' + i).style.color = 'White';
          break;
        case this.fontColorArray[5]: //'蓝'
          $('selecte_item' + i).style.backgroundColor = 'Blue';
          $('selecte_item' + i).style.textAlign = 'center';
          $('selecte_item' + i).style.color = 'White';
          break;
        case this.fontColorArray[6]: //'紫'
          $('selecte_item' + i).style.backgroundColor = 'Purple';
          $('selecte_item' + i).style.textAlign = 'center';
          $('selecte_item' + i).style.color = 'White';
          break;
        case this.fontColorArray[7]: //'白'
          $('selecte_item' + i).style.backgroundColor = 'White';
          $('selecte_item' + i).style.textAlign = 'center';
          $('selecte_item' + i).style.color = 'Black';
          break;
        default:
          break;
      }
    }
  }
};
/**
* @function: listSelectMenu
* @description: 选项容器构造器

* @param: itemCount, itemArray
* @return: null
*/
Dare.InitSetting.prototype.createSelectItem = function (itemCount, itemArray) {
  var html = '';
  switch (itemCount) {
    case 1: //currentIndex = 0;
      html += '

';
      html += '
';
      html += '
';
      html += '
';
      html += '
';
      html += '
';
      html += '
';
      html += '
' + itemArray[0] + '
';
      html += '
';
      html += '
';
      html += '
';
      html += '
';
      html += '
';
      html += '
';
      html += '
';
      break;
    case 2: //currentIndex = 0;
      html += '
';
      html += '
';
      html += '
';
      html += '
';
      html += '
';
      html += '
';
      html += '
';
      html += '
' + itemArray[0] + '
';
      html += '
';
      html += '
';
      html += '
' + itemArray[1] + '
';
      html += '
';
      html += '
';
      html += '
';
      html += '
';
      break;
    case 3: //currentIndex = 0;
      html += '
';
      html += '
';
      html += '
';
      html += '
';
      html += '
';
      html += '
';
      html += '
';
      html += '
' + itemArray[0] + '
';
      html += '
';
      html += '
';
      html += '
' + itemArray[1] + '
';
      html += '
';
      html += '
' + itemArray[2] + '
';
      html += '
';
      html += '
';
      break;
    case 4: //currentIndex = 0;
      html += '
';
      html += '
';
      html += '
';
      html += '
';
      html += '
';
      html += '
';
      html += '
';
      html += '
' + itemArray[0] + '
';
      html += '
';
      html += '
';
      html += '
' + itemArray[1] + '
';
      html += '
';
      html += '
' + itemArray[2] + '
';
      html += '
';
      html += '
' + itemArray[3] + '
';
      break;
    case 5: //currentIndex = 1;
      html += '
';
      html += '
';
      html += '
';
      html += '
';
      html += '
' + itemArray[0] + '
';
      html += '
';
      html += '
';
      html += '
' + itemArray[1] + '
';
      html += '
';
      html += '
';
      html += '
' + itemArray[2] + '
';
      html += '
';
      html += '
' + itemArray[3] + '
';
      html += '
';
      html += '
' + itemArray[4] + '
';
      break;
    case 7: //currentIndex = 3;
      html += '
' + itemArray[0] + '
';
      html += '
';
      html += '
' + itemArray[1] + '
';
      html += '
';
      html += '
' + itemArray[2] + '
';
      html += '
';
      html += '
';
      html += '
' + itemArray[3] + '
';
      html += '
';
      html += '
';
      html += '
' + itemArray[4] + '
';
      html += '
';
      html += '
' + itemArray[5] + '
';
      html += '
';
      html += '
' + itemArray[6] + '
';
      break;
    default:
      break;
  }
  return html;
};
var dareInitSetting = new Dare.InitSetting();
document.onkeypress = function (event) {
  dareInitSetting.keypressHandler(event);
};

 

你可能感兴趣的:(json,运维)