private string GetDistributionID(TP_OrgContactInfo oci)
 {
     // Compare Win 7 ReportPersonFormatting.cs GetDistributionID()
     string distributionID = oci.OrgNPI + " " + _dateEDXL;
     return distributionID.Replace(",", "-");
 }
        public static async Task DoStartup()
        {
            await ErrorLog.Init();
            await App.ErrorLog.ReportToErrorLog("FYI: Beginning App.Launch", "", false);

            UserWin8Account = await GetUserWin8Account();  // May be empty string if PC Settings/Privacy/"Let apps use my name and account picture" is false
            DeviceName = GetDeviceName();
            StorePackageVersionMajorDotMinor = GetStorePackageVersionMajorDotMinor();  // new June 2015 v 3.4

            // WAS BEFORE v33, but no longer have web service to allow get list without password:
              // await OrgDataList.Init(); // get list of all hospitals/organizations defined at our TriageTrak.  Don't need username/password for this.
              // Do this early so startup wizard has info it needs.

            await UserAndVersions.Init(); // Need PL password for web services to work.  Also init's pd.  Startup wiz called here.
            // Also called within, after v32: OrgDataList.Init().  June, 2015: will try to refresh token if it expired.
            // Initialize app model before navigating to home page, so groups will be set up
            PingString = GetPingString(); // new June 2015 v 3.4
#if MAYBE_NOT_ANY_MORE
            //DefaultFilterProfile.ResetFilterProfileToDefault();
            //Was here first, then moved to flyout, then moved back: 
            CurrentFilterProfile.ResetFilterProfileToDefault(); // will change more further below
            CurrentFilterProfile.AControlChanged = false;
#endif
            //DelayedMessageToUserOnStartup += "  - TEST OF DELAYED MESSAGE";
            PatientDataGroups = new TP_PatientDataGroups(); // which will use CurrentFilterProfile
            await PatientDataGroups.Init(); // reads in outbox data.  See Init2 further below
            App.RegisterSettings(); // Added for settings flyout
            // Initialize from events data model.  Take first disaster event in list as default for now.
            //var evcol = new ObservableCollection<TP_EventsDataItem>();
            //evcol = TP_EventsDataList.GetEvents();
            await CurrentDisasterList.Init();
            CurrentDisaster.CopyFrom(CurrentDisasterList.FirstOrDefault());
            await CurrentDisasterListFilters.InitAsFilters();
            // NO LONGER NEEDED ONCE BUG FIXED: CloneDisasterListForCombo();

            // Moved earlier: await OrgDataList.Init(); // get list of all hospitals/organizations defined at our PL/Vesuvius

            if (String.IsNullOrEmpty(CurrentOrgContactInfo.OrgAbbrOrShortName)) // usually already setup
            {
                await OrgContactInfoList.Init();
                if (OrgContactInfoList.Count() > 0)
                    CurrentOrgContactInfo = OrgContactInfoList.First(); // causes too many problems elsewhere: FirstOrDefault();
            }

            await ZoneChoices.Init(); // does minimal.  Just done in case OrgPolicyList.Init() runs into trouble.
            await OrgPolicyList.Init(); // Will also fetch data for ZoneChoices.
            if (OrgPolicyList.Count() > 0)
                OrgPolicy = OrgPolicyList.First(); // FirstOrDefault(); // will return null if nothing in list

            CurrentFilterProfile = await FilterProfileList.GetDefaultForCurrentOrg();

            await CurrentOtherSettingsList.Init(); // initializes ACTUAL value for App.CurrentDisaster
            if (CurrentOtherSettingsList.Count() > 0)
                CurrentOtherSettings = CurrentOtherSettingsList.First();

            PatientDataGroups.Init2(); // See Init further above.  Init2 handles work after CurrentFilterProfile, actual App.CurrentDisaster have been defined.

            // Moved to later in call sequence: sendQueue.StartWork(); // DON'T await
            await App.ErrorLog.ReportToErrorLog("FYI: Ending App.Launch", "", false);
        }
 private string GetSenderID(TP_OrgContactInfo oci)
 {
     // Compare Win 7 ReportPersonFormatting.cs GetSenderID()
     string senderID = oci.OrgEmail;  // email address shouldn't contain commas.  But if it does, retain it... more important than distr ID
     if (senderID == "")
     {
         App.MyAssert(!String.IsNullOrEmpty(oci.OrgName));
         senderID = oci.OrgName;
         if (!String.IsNullOrEmpty(oci.OrgPhone))
             senderID += " " + oci.OrgPhone;
         // In first version of EDXL-DE, distribution reference may contain multiple sender IDs separated by commas.
         // EDXL-DE spec didn't define way to escape commas within a senderID when used in distribution reference.
         // So have to screen out commas.  No perfect substitution character... hyphen arguably no worse than others (space or ; / _).
         senderID = senderID.Replace(",", "-");
     }
     return senderID;
 }