private void startComputerUpdates() {
    if (managerBinder != null) {
      if (runningPolling) {
        return;
      }

      freezeUpdates = false;
      managerBinder.startPolling(
          new ComputerManagerListener() {
            @Override
            public void notifyComputerUpdated(final ComputerDetails details) {
              if (!freezeUpdates) {
                PcView.this.runOnUiThread(
                    new Runnable() {
                      @Override
                      public void run() {
                        updateComputer(details);
                      }
                    });
              }
            }
          });
      runningPolling = true;
    }
  }
  private void stopComputerUpdates(boolean wait) {
    if (managerBinder != null) {
      if (!runningPolling) {
        return;
      }

      freezeUpdates = true;

      managerBinder.stopPolling();

      if (wait) {
        managerBinder.waitForPollingStopped();
      }

      runningPolling = false;
    }
  }
  @Override
  public boolean onContextItemSelected(MenuItem item) {
    AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
    final ComputerObject computer = (ComputerObject) pcGridAdapter.getItem(info.position);
    switch (item.getItemId()) {
      case PAIR_ID:
        doPair(computer.details);
        return true;

      case UNPAIR_ID:
        doUnpair(computer.details);
        return true;

      case WOL_ID:
        doWakeOnLan(computer.details);
        return true;

      case DELETE_ID:
        if (managerBinder == null) {
          Toast.makeText(
                  PcView.this,
                  getResources().getString(R.string.error_manager_not_running),
                  Toast.LENGTH_LONG)
              .show();
          return true;
        }
        managerBinder.removeComputer(computer.details.name);
        removeComputer(computer.details);
        return true;

      case APP_LIST_ID:
        doAppList(computer.details);
        return true;

      case RESUME_ID:
        if (managerBinder == null) {
          Toast.makeText(
                  PcView.this,
                  getResources().getString(R.string.error_manager_not_running),
                  Toast.LENGTH_LONG)
              .show();
          return true;
        }

        ServerHelper.doStart(
            this,
            new NvApp("app", computer.details.runningGameId),
            computer.details,
            managerBinder);
        return true;

      case QUIT_ID:
        if (managerBinder == null) {
          Toast.makeText(
                  PcView.this,
                  getResources().getString(R.string.error_manager_not_running),
                  Toast.LENGTH_LONG)
              .show();
          return true;
        }

        // Display a confirmation dialog first
        UiHelper.displayQuitConfirmationDialog(
            this,
            new Runnable() {
              @Override
              public void run() {
                ServerHelper.doQuit(
                    PcView.this,
                    ServerHelper.getCurrentAddressFromComputer(computer.details),
                    new NvApp("app", 0),
                    managerBinder,
                    null);
              }
            },
            null);
        return true;

      default:
        return super.onContextItemSelected(item);
    }
  }