// ======================================================================
 // SaveSpecial:
 // (1) try update
 // (2) insert if a new record
 //
 // The record construct is via the 'itemsDBTable' class (itemsDBTable.cs)
 // ======================================================================
 public Task <int> SaveSpecialItemAsync(itemsDBTable item)
 {
     if (item.ID != 0)
     {
         return(database.UpdateAsync(item));
     }
     else
     {
         return(database.InsertAsync(item));
     }
 }
    // :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    // Save. Save will display "no input" alert.
    //
    // Input via:
    // Id          =  ID (auto increment while adding the record) 
    // Run Date    =  DateTime.Now.ToString("MM/dd/yyyy hh:mm tt");
    // goodCPR     =  goodCPR;
    // schallowCPR =  flatCPR;
    // deepCPR     =  deepCPR;
    // :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    private async void btResults_Clicked(object sender, EventArgs e)
    {
      string strLL;
      string strMM;
      string errMSGHeader = AppResources.CPRSimulResultMsg1; // "CPR Simulated Training Result";
      inPrinting = true;

      try
      {
        // noActions is on (true), we have NO RESULT(S), don't save
        //
        if (noActions)
        {
          //
          strLL = AppResources.CPRSimulResultMsg2; // "\nNo CPR Simulation Result available.\n"
                  //+ "___________________________________\n\n"
            //+ "  Please run a set of simulated CPR's\n"
            //+ "    and try again.\n";
          await Gen_Utility_1.DisplaySfPopupAlert(errMSGHeader, strLL, AppResources.CPRSimulGotit, "");
          if (Alles.PopupAccepted)
          {
          }
          inPrinting = false;
        }
        else
        {
          BindingContext = new itemsDBTable();
          var sqlitem = (itemsDBTable)BindingContext;
          sqlitem.datetimeCPR = DateTime.Now.ToString("MM/dd/yyyy hh:mm tt");
          sqlitem.goodCPR = totalCorrectCPR.ToString();
          sqlitem.shallowCPR = totalFlatCPR.ToString();
          sqlitem.deepCPR = totalTooDeepCPR.ToString();

          // announce, and let user decide if yes/no
          //////strMM = "\n  Adding CPR Simulation Results:\n"
          //////        + "  ______________________________\n\n"
          //////+ " Good Compressions .. .. .. .. .".PadRight(40) + sqlitem.goodCPR + "\n"
          //////+ " Compressions too Shallow..".PadRight(37) + sqlitem.shallowCPR + "\n"
          //////+ " Compressions to Deep .. .. ..".PadRight(40) + sqlitem.deepCPR + "\n\n";

          String data11 = String.Format("{0,-40} {1,-10}", AppResources.CPRSimulResultdata11, sqlitem.goodCPR);
          String data22 = String.Format("{0,-36} {1,-10}", AppResources.CPRSimulResultdata22, sqlitem.shallowCPR);
          String data33 = String.Format("{0,-38} {1,-10}", AppResources.CPRSimulResultdata33, sqlitem.deepCPR);

          strMM = AppResources.CPRSimulResultstm // "\n  Adding CPR Simulation Results:\n"
                  //+ "  ______________________________\n\n"
          + data11 + "\n"
          + data22 + "\n"
          + data33 + "\n\n";


          await Gen_Utility_1.DisplaySfPopupAlert(errMSGHeader, strMM, AppResources.CPRSimulResultYes, AppResources.CPRSimulCancel);
          if (Alles.PopupAccepted)
          {
            await App.Database.SaveItemAsync(sqlitem);
            readyBeep.IsOn = false;     // the first hit (false) is needed to set the 'stage'
            zeroOut();
            this.getAccelerometer();
            if (Alles.popupmsg_001) _ = popup001();
            await this.Navigation.PushAsync(new Results());
          }
          else
          {
            inPrinting = false;
          }
        }
      }
      catch (Exception sqle1)
      {
        _ = (sqle1.Message.ToString());
      }


    }
 // ======================================================================
 // Delete a record
 //
 // ======================================================================
 public Task <int> DeleteItemAsync(itemsDBTable item)
 {
     return(database.DeleteAsync(item));
 }