// was before v 3.5: private async void LoadSampleDataGroupFromPatientDataList(SampleDataGroup g, TP_PatientReports p) private async Task LoadSampleDataGroupFromPatientDataList(SampleDataGroup g, TP_PatientReports p) { g.Items.Clear(); //string encodedTemp; foreach (TP_PatientReport pdi in p) { pdi.ImageEncoded = await pdi.FormatImageEncoded(); g.Items.Add(new SampleDataItem( pdi.FormatUniqueID(), pdi.FormatTitle(), pdi.FormatSubtitle(), pdi.ImageEncoded, // freshened above pdi.FormatImageBorderColor(), pdi.FormatDescription(), pdi.FormatContent(), g)); } }
// was before 3.5: public void DefineItemsFiltered(SampleDataGroup g) public async Task DefineItemsFiltered(SampleDataGroup g) { // if (App.PatientDataGroups == null) { // App.PatientDataGroups = new TP_PatientDataGroups(); // await App.PatientDataGroups.Init(); } App.MyAssert(App.PatientDataGroups != null); TP_PatientReports lpfi; if (g.UniqueId == "Outbox") { //lpfi = App.PatientDataGroups.GetOutbox(); //LoadSampleDataGroupFromPatientDataList(g, lpfi); //lpfi = App.PatientDataGroups.GetOutboxSorted(); //LoadSampleDataGroupFromPatientDataList(g, lpfi); lpfi = App.PatientDataGroups.GetOutboxSortedAndFiltered(); await LoadSampleDataGroupFromPatientDataList(g, lpfi); // v 3.5 add await } else if (g.UniqueId == "AllStations") { //lpfi = App.PatientDataGroups.GetAllStations(); //LoadSampleDataGroupFromPatientDataList(g, lpfi); //lpfi = App.PatientDataGroups.GetAllStationsSorted(); //LoadSampleDataGroupFromPatientDataList(g, lpfi); lpfi = App.PatientDataGroups.GetAllStationsSortedAndFiltered(); await LoadSampleDataGroupFromPatientDataList(g, lpfi); // v 3.5 add await } else { App.MyAssert(false); } }
public SampleDataSource() { //String ITEM_CONTENT = String.Format("Item Content: {0}\n\n{0}\n\n{0}\n\n{0}\n\n{0}\n\n{0}\n\n{0}", // "Curabitur class aliquam vestibulum nam curae maecenas sed integer cras phasellus suspendisse quisque donec dis praesent accumsan bibendum pellentesque condimentum adipiscing etiam consequat vivamus dictumst aliquam duis convallis scelerisque est parturient ullamcorper aliquet fusce suspendisse nunc hac eleifend amet blandit facilisi condimentum commodo scelerisque faucibus aenean ullamcorper ante mauris dignissim consectetuer nullam lorem vestibulum habitant conubia elementum pellentesque morbi facilisis arcu sollicitudin diam cubilia aptent vestibulum auctor eget dapibus pellentesque inceptos leo egestas interdum nulla consectetuer suspendisse adipiscing pellentesque proin lobortis sollicitudin augue elit mus congue fermentum parturient fringilla euismod feugiat"); //String ITEM_TITLE = "John Doe"; //If specific examples not used // Content can be fullsome, only shown when full record shown. Description is a 1 liner //String ITEM_CONTENT = String.Format("{0} {1}\n{2}", "Male", "Adult", "Zone: Green"); //String ITEM_SUBTITLE = "Mass Casualty ID 911-"; // Append specific numbers; or override with specific examples not used //String ITEM_DESCRIPTION = String.Format("{0} {1} {2}", "Male", "Adult", "Zone: Green"); // Need junk text? Here's some: // Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus tempor scelerisque lorem in vehicula. Aliquam tincidunt, // lacus ut sagittis tristique, turpis massa volutpat augue, eu rutrum ligula ante a ante. // Pellentesque porta, mauris quis interdum vehicula, urna sapien ultrices velit, nec venenatis dui odio in augue. // Cras posuere, enim a cursus convallis, neque turpis malesuada erat, ut adipiscing neque tortor ac erat. var group1 = new SampleDataGroup("Checklist", "✔ Checklist", //was: "✅ Checklist", but couldn't see with 8.1 multicolor fonts, couldn't see black outline on charcoal background "Specify Disaster Event, Station Roster",//"Group Subtitle: 1", "Assets/Red.png", "Group Description: not used"); this.AllGroups.Add(group1); var group2 = new SampleDataGroup("New", "🚑 New Report", "Report a New Arrival to this Station", "Assets/LightGray.png", "Group Description: not used"); // Evidently we have to have at least 1 item in group to show up: group2.Items.Add(new SampleDataItem("Group-2-Item-1", "Item Title: 1", "Item Subtitle: 1", "Assets/DarkGray.png", Colors.White.ToString(), // image border color, probably not used "Item Description: not used", "Item Content: not used", group2)); this.AllGroups.Add(group2); /* WAS: group2.Items.Add(new SampleDataItem("Group-2-Item-1", "Item Title: 1", "Item Subtitle: 1", "Assets/DarkGray.png", "Item Description: not used", "Item Content: not used", group2)); this.AllGroups.Add(group2); */ var groupOutbox = new SampleDataGroup("Outbox", "📮 Outbox", "View and Edit this Station's Reports", //Group Subtitle: 3", "Assets/MediumGray.png", "Group Description: not used"); DefineItemsFiltered(groupOutbox).Wait(); // Wait added for v 3.5. Since we're in constructor, can't use "await" this.AllGroups.Add(groupOutbox); // Use the timestamp as UniqueID. In Win7 TriagePic, this would be either: // EDXL format ("dateEDXL"), e.g., 2012-08-13T22:24:26Z // WhenLocalTime, e.g., 2012-08-13 18:24:26 -04:00 (with time zone "TZ" also given, e.g., EDT) // Latter is more informative var groupAllStations = new SampleDataGroup("AllStations", "👪 All Stations", "With More Filters, of All Reports", //"Group Subtitle: 4", "Assets/LightGray.png", "Group Description: not used"); DefineItemsFiltered(groupAllStations).Wait(); //Wait added for v 3.5. Since we're in constructor, can't use "await" this.AllGroups.Add(groupAllStations); var group5 = new SampleDataGroup("Statistics", "📊 Statistics", "Tables & Charts of Arrivals", "Assets/MediumGray.png", "Group Description: [TO DO]"); this.AllGroups.Add(group5); }
public SampleDataItem(String uniqueId, String title, String subtitle, String imagePath, string /*Color*/ imageBorderColor, String description, String content, SampleDataGroup group) : base(uniqueId, title, subtitle, imagePath, description) { this._content = content; this._group = group; this._imageBorderColor = imageBorderColor; // Glenn adds }
List<SearchResult> GetSearchResultList(SampleDataGroup sdg, string query) { App.MyAssert(sdg != null); // Group exists, even if no items in it. if(query == string.Empty) return ( from i in sdg.Items select new SearchResult { Image = SourceToUri(i.Image), Title = i.Title, Subtitle = i.Subtitle, UniqueId = i.UniqueId, Description = i.Description }).ToList(); //otherwise return ( from i in sdg.Items let patientName = i.Title.ToLower() let patientID = i.Subtitle.ToLower() where patientName.StartsWith(query) || patientName.Contains(" " + query) || patientID.Contains(query) where InSearchResults(i, query) select new SearchResult { Image = SourceToUri(i.Image), Title = i.Title, Subtitle = i.Subtitle, UniqueId = i.UniqueId, Description = i.Description }).ToList(); }
/// <summary> /// Matches search query against patient name and ID. Search is exact, but can do substrings. /// If query is empty, return all /// </summary> /// <param name="sdg">Data source (outbox or PL)</param> /// <param name="query">user search string</param> /// <returns>List of SearchResult</returns> List<SearchResult> GetSearchResultList(SampleDataGroup sdg, string query) { App.MyAssert(sdg != null); // Group exists, even if no items in it. // Evidently not in RT: Uri memoryResourceUri = System.IO.Packaging.PackUriHelper.Create(); return ( from i in sdg.Items //where InSearchResults(i, query) Filtering now down in construction of sdg select new SearchResult { Image = i.Image, //Uri Image = SourceToUri(i.Image) was good enough when just color swatches for images. But Image is now an ImageSource ImageBorderColor = i.ImageBorderColor, Title = i.Title, Subtitle = i.Subtitle, UniqueId = i.UniqueId, Description = i.Description }).ToList(); }