public async void GetImageInfoAsync() { List <ImageColorInfo> ImageColorList = await SqliteUtil.Current.QueryImageColorInfo(); if (ImageColorList == null) { return; } if (ImageColorList.Count == 0) { // await DisplayAlert("提示", "インメージが無し、ご確定してください。", "確定"); } List <NewsListItemModel> NewsListItemModelLists = new List <NewsListItemModel>(); var imageIdGroupList = ImageColorList .GroupBy(x => new { x.ImageID }) .Select(group => new { Keys = group.Key }).ToList(); foreach (var item in imageIdGroupList) { int imageId = item.Keys.ImageID; List <ImageColorInfo> ImageColorListByImageID = await SqliteUtil.Current.QueryImageColorInfoByImageID(Convert.ToInt32(imageId)); List <IamgeSaveInfo> IamgeSaveInfoList = await SqliteUtil.Current.QueryIamgeSaveInfoByImageID(imageId); NewsListItemModel newsListItemModel = new NewsListItemModel(); var imagePathGroupList = IamgeSaveInfoList .GroupBy(x => new { x.ImagePath, x.CateLogId, x.Imagebuffer }) .Select(group => new { Keys = group.Key }).ToList(); if (imagePathGroupList.Count == 0) { await DisplayAlert("", "インメージ画が無し、ご確定してください。", "確定"); await Navigation.PushModalAsync(new MainPage()); return; } newsListItemModel.ImageSrc = imagePathGroupList[imagePathGroupList.Count - 1].Keys.ImagePath; newsListItemModel.Imagebyte = imagePathGroupList[imagePathGroupList.Count - 1].Keys.Imagebuffer; int iCateLogId = imagePathGroupList[imagePathGroupList.Count - 1].Keys.CateLogId; List <CataLogInfo> CateLogIdList = await SqliteUtil.Current.QueryCataLogInfoByCateLogId(iCateLogId); var imageTitleGroupList = CateLogIdList .GroupBy(x => new { x.CateLogId, x.Title, x.Folder }) .Select(group => new { Keys = group.Key }).ToList(); if (imageTitleGroupList.Count == 0) { await DisplayAlert("", "インメージタイトルが無し、ご確定してください。", "確定"); await Navigation.PushModalAsync(new MainPage()); return; } //newsListItemModel.ImageSrc = "picDemo.PNG"; //newsListItemModel.Title = "風景タイトル"; newsListItemModel.Title = imageTitleGroupList[imageTitleGroupList.Count - 1].Keys.Title.ToString(); newsListItemModel.CateLogId = (int)imageTitleGroupList[imageTitleGroupList.Count - 1].Keys.CateLogId; string strFolderName = imageTitleGroupList[imageTitleGroupList.Count - 1].Keys.Folder.ToString(); //SaveListName.Text = strFolderName; newsListItemModel.pickcolor01 = "Transparent"; newsListItemModel.pickcolor02 = "Transparent"; newsListItemModel.pickcolor03 = "Transparent"; newsListItemModel.pickcolor04 = "Transparent"; newsListItemModel.pickcolor05 = "Transparent"; newsListItemModel.pickcolor06 = "Transparent"; newsListItemModel.pickcolor07 = "Transparent"; newsListItemModel.pickcolor08 = "Transparent"; newsListItemModel.pickcolor09 = "Transparent"; newsListItemModel.pickcolor10 = "Transparent"; for (int i = 0; i < ImageColorListByImageID.Count; i++) { switch (i) { case 0: newsListItemModel.pickcolor01 = ImageColorListByImageID[i].HEXValue; break; case 1: newsListItemModel.pickcolor02 = ImageColorListByImageID[i].HEXValue; break; case 2: newsListItemModel.pickcolor03 = ImageColorListByImageID[i].HEXValue; break; case 3: newsListItemModel.pickcolor04 = ImageColorListByImageID[i].HEXValue; break; case 4: newsListItemModel.pickcolor05 = ImageColorListByImageID[i].HEXValue; break; case 5: newsListItemModel.pickcolor06 = ImageColorListByImageID[i].HEXValue; break; case 6: newsListItemModel.pickcolor07 = ImageColorListByImageID[i].HEXValue; break; case 7: newsListItemModel.pickcolor08 = ImageColorListByImageID[i].HEXValue; break; case 8: newsListItemModel.pickcolor09 = ImageColorListByImageID[i].HEXValue; break; case 9: newsListItemModel.pickcolor10 = ImageColorListByImageID[i].HEXValue; break; } } NewsListItemModelLists.Add(newsListItemModel); } using (UserDialogs.Instance.Loading("Loading", null, null, true, MaskType.Black)) { await Task.Delay(1000); MyListView.ItemsSource = NewsListItemModelLists; } }
public async void GetImageInfoByFolder(string folder) { List <CataLogInfo> CataLogInfoList = await SqliteUtil.Current.QueryCataLogsByFolder(folder); if (CataLogInfoList == null) { return; } if (CataLogInfoList.Count == 0) { await DisplayAlert("", "インメージが無し、ご確定してください。", "確定"); //await Navigation.PushModalAsync(new MainStoreList(0)); return; } List <NewsListItemModel> _NewsListItemModelLists = new List <NewsListItemModel>(); var titleGroupList = CataLogInfoList .GroupBy(x => new { x.Title, x.CateLogId }) .Select(group => new { Keys = group.Key }).ToList(); foreach (var item in titleGroupList) { List <IamgeSaveInfo> IamgeSaveInfoList = await SqliteUtil.Current.QueryIamgeSaveInfoByCateLogId(item.Keys.CateLogId); NewsListItemModel newsListItemModel = new NewsListItemModel(); var imagePathGroupList = IamgeSaveInfoList .GroupBy(x => new { x.ImagePath, x.ImageID }) .Select(group => new { Keys = group.Key }).ToList(); foreach (var _item in imagePathGroupList) { newsListItemModel.Title = item.Keys.Title; SaveListName.Text = folder; newsListItemModel.ImageSrc = _item.Keys.ImagePath; List <ImageColorInfo> ImageColorListByImageID = await SqliteUtil.Current.QueryImageColorInfoByImageID(Convert.ToInt32(_item.Keys.ImageID)); for (int i = 0; i < ImageColorListByImageID.Count; i++) { switch (i) { case 0: newsListItemModel.pickcolor01 = ImageColorListByImageID[i].HEXValue; break; case 1: newsListItemModel.pickcolor02 = ImageColorListByImageID[i].HEXValue; break; case 2: newsListItemModel.pickcolor03 = ImageColorListByImageID[i].HEXValue; break; case 3: newsListItemModel.pickcolor04 = ImageColorListByImageID[i].HEXValue; break; case 4: newsListItemModel.pickcolor05 = ImageColorListByImageID[i].HEXValue; break; case 5: newsListItemModel.pickcolor06 = ImageColorListByImageID[i].HEXValue; break; case 6: newsListItemModel.pickcolor07 = ImageColorListByImageID[i].HEXValue; break; case 7: newsListItemModel.pickcolor08 = ImageColorListByImageID[i].HEXValue; break; case 8: newsListItemModel.pickcolor09 = ImageColorListByImageID[i].HEXValue; break; case 9: newsListItemModel.pickcolor10 = ImageColorListByImageID[i].HEXValue; break; } } _NewsListItemModelLists.Add(newsListItemModel); } } MyListView.ItemsSource = _NewsListItemModelLists; }