private async Task SendClickImpl(TP_PatientReport pr)
        {
            App.MyAssert(pr.ObjSentCode.IsValid());
            bool newPrObject = false;
            if (pr.ObjSentCode.GetCodeWithoutVersion() == "Y")
            {
                newPrObject = true;
                // Mark existing record as superceded (we can use copied fields in new record to get the parameter values we need)
                await App.PatientDataGroups.UpdateSendHistory(pr.PatientID, pr.ObjSentCode.GetVersionCount(), pr.SentCode, true /*superceded*/);
                pr.ObjSentCode.BumpVersion();
            }
            // else "N" or error.  to do: better treatment for error cases "Xn".

            if(deleteRequest)
                pr.ObjSentCode.ReplaceCodeKeepSuffix("QD"); // New Dec 2014
            else
                pr.ObjSentCode.ReplaceCodeKeepSuffix("Q");
            await SaveReportFieldsToObject(pr);
            await pr.DoSendEnqueue(newPrObject); // cleanup image fields, generate lp2 content, save it as file, then call SendQueue.Add, 
        }
        private async void Send_Click(object sender, RoutedEventArgs e)
        {
            App.MyAssert(App.PatientDataGroups != null);
            if (!await ConfirmOrReviseGender())
                return;
            if (!await ConfirmOrReviseAgeGroup())
                return;

            AdjustProgressBarVisibility(Visibility.Visible);
            if (Notes.Text == NOTES_TEXT_HINT) // Must match string in XAML too
                Notes.Text = "";
            if (App.RosterNames != "")
                Notes.Text += "\nRoster at Station:\n" + App.RosterNames; // DON'T DO THIS FOR RE-SEND... wait til we handle rostering smarter. 
#if SUPERCEDED_RELEASE_7
            if (SyncAndGetCaptionTextBox() == CAPTION_TEXT_HINT) // CAPTION_TEXT_HINT must match string in XAML too
                SetCaptionTextBox("");
#endif
            await SaveReportFieldsToObject(pr, "Q"); // IntendToSend
            TP_PatientReport pr2 = new TP_PatientReport(pr); // create a new object for each report, that will be passed through the queue
            // and be reference from the _outbox and _allstations lists.
            await pr2.DoSendEnqueue(true); // cleanup image fields, generate lp2 content, save it as file, then call SendQueue.Add, 

            // Move to later: await pr.DoSendPart2(); // Update outbox and allstations in both memory and local storage.  As well as sorted/filtered version in memory

            Clear_Entry_Click(sender, e); // Also increments patient ID
            // Save incremented value, with prefix removed.  Remembers it to OtherSettings.xml, and clears App.CurrentPatient:
            await pr2.DoSendPart3(PatientIdTextBox.Text.Remove(0, App.OrgPolicy.OrgPatientIdPrefixText.Length));


#if DIDNT_WORK
            double op = 100.0;
            while(true)
            {
                op -= 0.00001;
                LastSentMsg.Opacity = op;
                if(op <= 0.0)
                    break;
            }
            LastSentMsg.Opacity = 100.0;
#endif

            Int32 count;
            while (true)
            {
                count = TP_SendQueue.reportsToSend.Count();
                // Tried subsituting data-bound LastSentMessage for LastSentMsg.Text below, but didn't help with bindings that change with visual state
                if (count > 0)
                    AdjustLastSentMsgText("Reports waiting to send:  " + count);
                else
                {
                    AdjustProgressBarVisibility(Visibility.Collapsed);
                    AdjustLastSentMsgText("Sent");
                }

                await Task.Delay(2000); // see message for 2 seconds
                if (count == 0 || count <= TP_SendQueue.reportsToSend.Count()) // if count doesn't decrease after 2 seconds, then don't wait further in this loop
                    break;
            }
            AdjustProgressBarVisibility(Visibility.Collapsed);
            // Maybe not: if(!LastSentMsg.Text.StartsWith("Reports waiting to send")) // Let count of waiting reports persist
            /* was: LastSentMsg.Text */
            AdjustLastSentMsgText("");
        }