Esempio n. 1
0
  private void ApplyChanges() {
    if ((MetersInfo == null) || (Device == null)) return; // . ->
    ArrayList<String> _MeterIDs = new ArrayList<String>();
    for (int I = 0; I < MetersInfo.length; I++)
      if (lvMeters.isItemChecked(I)) _MeterIDs.add(MetersInfo[I].Descriptor.ID);
    final String[] MeterIDs = _MeterIDs.toArray(new String[0]);
    // .
    TAsyncProcessing Processing =
        new TAsyncProcessing(this, getString(R.string.SWaitAMoment)) {

          private TDEVICEModule Device = TSensorsMetersPanel.this.Device;

          @Override
          public void Process() throws Exception {
            Device.SensorsModule.Meters.Items_ValidateActivity(MeterIDs);
          }

          @Override
          public void DoOnCompleted() throws Exception {
            StartUpdating();
          }

          @Override
          public void DoOnException(Exception E) {
            Toast.makeText(TSensorsMetersPanel.this, E.getMessage(), Toast.LENGTH_LONG).show();
          }
        };
    Processing.Start();
  }
Esempio n. 2
0
  @Override
  public void Open(Context context, Object Params) throws Exception {
    TAsyncProcessing Opening =
        new TAsyncProcessing(context) {

          private TUserDescriptor UserInfo;

          @Override
          public void Process() throws Exception {
            UserInfo = User.GetUserInfo(idComponent);
            // .
            Thread.sleep(100);
          }

          @Override
          public void DoOnCompleted() throws Exception {
            if (Canceller.flCancel) return; // . ->
            // .
            TUserChatPanel UCP = TUserChatPanel.Panels.get(User.UserID);
            if (UCP != null) UCP.finish();
            Intent intent = new Intent(context, TUserChatPanel.class);
            intent.putExtra("UserID", UserInfo.UserID);
            intent.putExtra("UserIsDisabled", UserInfo.UserIsDisabled);
            intent.putExtra("UserIsOnline", UserInfo.UserIsOnline);
            intent.putExtra("UserName", UserInfo.UserName);
            intent.putExtra("UserFullName", UserInfo.UserFullName);
            intent.putExtra("UserContactInfo", UserInfo.UserContactInfo);
            context.startActivity(intent);
          }

          @Override
          public void DoOnException(Exception E) {
            Toast.makeText(context, E.getMessage(), Toast.LENGTH_LONG).show();
          }
        };
    Opening.Start();
  }