public void LoadData() { if (RunState) { return; } RunState = true; PageIndex++; //加载第一页数据 API.MainPage(PageIndex, new Action <List <Image>, int>((list, pageSize) => { //homePage.Dispatcher.Invoke(); if (!Waterfall)//瀑布 { Execute.OnUIThread(() => { ImageList.Clear(); }); } foreach (var item in list) { Execute.OnUIThread(() => { ImageList.Add(item); }); } Thread.Sleep(500); Execute.OnUIThread(() => { PageCount = pageSize; }); RunState = false; }), new Action <Exception>((ex) => { Execute.OnUIThread(() => { PageIndex--; }); RunState = false; })); }
private void ClearAll() { App.Current.Dispatcher.Invoke(new Action(() => { ImageList.Clear(); })); }
private void loadImages() { Singleton.getDialogueBox().showSearch(ConfigurationManager.AppSettings["load_message"]); Dispose(); ImageList.Clear(); //----[ Bill Image ] // get invoice image and create listener on image info change _billImageDisplay.PropertyChanged += onFilePathChange_updateUIImage; _billImageDisplay.PropertyChanged += onImageInfoChange; ImageList.Add(_billImageDisplay); //----[ Logo Image ] // get logo image and create listener on image info change _logoImageDisplay.PropertyChanged += onFilePathChange_updateUIImage; _logoImageDisplay.PropertyChanged += onImageInfoChange; ImageList.Add(_logoImageDisplay); //----[ Header Image ] // get header image and create listener on image info change _headerImageDisplay.PropertyChanged += onFilePathChange_updateUIImage; _headerImageDisplay.PropertyChanged += onImageInfoChange; ImageList.Add(_headerImageDisplay); Singleton.getDialogueBox().IsDialogOpen = false; }
private void SelectContentInContentManager(ContentIconAndName content) { var type = service.GetTypeOfContent(content.Name); if (type == ContentType.ImageAnimation) { var newAnimation = ContentLoader.Load <ImageAnimation>(content.Name); AnimationName = content.Name; var imageNames = newAnimation.MetaData.Get("ImageNames", "").SplitAndTrim(','); ImageList.Clear(); foreach (var imageName in imageNames) { ImageList.Add(imageName); } Duration = float.Parse(newAnimation.MetaData.Get("DefaultDuration", "")); } if (type == ContentType.SpriteSheetAnimation) { var spritesheet = ContentLoader.Load <SpriteSheetAnimation>(content.Name); AnimationName = content.Name; var imageNames = spritesheet.MetaData.Get("ImageName", "").SplitAndTrim(','); ImageList.Clear(); foreach (var imageName in imageNames) { ImageList.Add(imageName); } Duration = float.Parse(animation.MetaData.Get("DefaultDuration", "")); SubImageSize = spritesheet.MetaData.Get("SubImageSize", Size.Zero); } }
private async void OpenImageFolder() { var source = _uiService.OpenFolderDialog(); if (string.IsNullOrEmpty(source)) { return; } var prevImageList = new List <PrevImage>(); await Task.Factory.StartNew(() => { var filters = new[] { "jpg", "jpeg", "png", "gif", "tiff", "bmp" }; var files = FileUtils.GetFilesFrom(source, filters, true); foreach (var image in files.Select(x => new Models.PrevImage(x))) { prevImageList.Add(image); } }); if (!prevImageList.Any()) { _uiService.ShowError(Constants.MissingImage); return; } else { ImageList.Clear(); foreach (var image in prevImageList) { ImageList.Add(image); } RefreshCommands(); } }
public void RefreshOnContentChange() { ImageList.Clear(); MaterialList.Clear(); LoadImageList(); LoadMaterials(); RaisePropertyChanged("ImageList"); RaisePropertyChanged("MaterialList"); }
public void RefreshOnContentChange() { LoadedImageList.Clear(); ImageList.Clear(); LoadImagesFromProject(); LoadAnimationsFromProject(); CreateDefaultMaterial2D(); RaisePropertyChanged("ImageList"); }
protected override void OnPropertyChanged(string propertyName = null) { base.OnPropertyChanged(propertyName); if (propertyName == ImagesProperty.PropertyName) { ImageList.Clear(); CurrentImage = null; addImagesAsChildren(); } }
protected override void OnPropertyChanged(string propertyName = null) { base.OnPropertyChanged(propertyName); //if the Images property has changed, clear our ImageList of images and add all the new images as children if (propertyName == ImagesProperty.PropertyName) { ImageList.Clear(); CurrentImage = null; addImagesAsChildren(); } }
/// <summary> /// /// </summary> /// <param name="image"></param> public override void LoadImage(Image image) { // create a list with one texture to pass it in to the common loading method ImageList images = new ImageList(); images.Add(image); // load this image LoadImages(images); // clear the temp list of images images.Clear(); }
public async void GetAllImagesAsync() { ImageList.Clear(); VideoImageList.Clear(); var folder = Windows.Storage.ApplicationData.Current.LocalFolder; var allFiles = await folder.GetFilesAsync(); foreach (var file in allFiles) { if (file.FileType.Equals(".jpg") || file.FileType.Equals(".png") || file.FileType.Equals(".jpeg")) { ImageProperties imageProperties = await file.Properties.GetImagePropertiesAsync(); StorageItemThumbnail storageItemThumbnail = await file.GetThumbnailAsync(ThumbnailMode.PicturesView, 200, ThumbnailOptions.UseCurrentScale); var Picture = new BitmapImage(); Picture.SetSource(storageItemThumbnail); Images p = new Images { Name = file.Name, imageFileName = file.Name, Collection = Picture }; var imageid = await FileHelper.GetImageIDAsync(p, FILE_NAME); p.ID = imageid; ImageList.Add(p); } if (file.FileType.Equals(".mp4")) { VideoProperties videoProperties = await file.Properties.GetVideoPropertiesAsync(); StorageItemThumbnail storageItemThumbnail = await file.GetThumbnailAsync(ThumbnailMode.VideosView, 200, ThumbnailOptions.UseCurrentScale); var video = new BitmapImage(); video.SetSource(storageItemThumbnail); Images v = new Images { Name = file.Name, videoFileName = file.Name, Collection = video }; var videoid = await FileHelper.GetImageIDAsync(v, FILE_NAME); v.ID = videoid; VideoImageList.Add(v); } } }
private void LoadPDF(string filename) { ImageList.Clear(); using (var reader = new PdfReader(filename)) { var parser = new PdfReaderContentParser(reader); var listener = new RenderListener(); for (int pageNumber = 1; pageNumber <= reader.NumberOfPages; pageNumber++) { parser.ProcessContent(pageNumber, listener); } ImageList.AddRange(listener.Images); } ShowPage(0); }
public void DisplayImage(string type = "FengJing", int page = 1) { if (type == currentType && page == CurrentPage) { return; } string pageParam = page > 1 ? $"_{page}" : ""; var result = Utils.GetNetBianImage($"{netbianHost}/4k{type.ToLower()}/index{pageParam}.html"); TotalPage = result.TotalPage; CurrentPage = page; currentType = type; ImageList.Clear(); foreach (var item in result.ImageInfo) { ImageList.Add(new NetBianImage(item.Name, netbianHost + item.Source, netbianHost + item.Detail)); } }
private async void FastCreated() { var ran = new Random(); while (true) { await Task.Delay(100).ContinueWith(_ => { ImageList.Clear(); var n = ran.Next(int.MaxValue / 10); for (int i = n; i < n + 1000; i++) { try { DrawingVisual drawingVisual = new DrawingVisual(); DrawingContext drawingContext = drawingVisual.RenderOpen(); var text = new FormattedText(i.ToString(), CultureInfo.GetCultureInfo("zh-cn"), FlowDirection.LeftToRight, new Typeface("Verdana"), 36, Brushes.Black); drawingContext.DrawText(text, new Point(0, 0)); drawingContext.Close(); var image = new RenderTargetBitmap((int)text.Width, (int)text.Height, 96, 96, PixelFormats.Pbgra32); image.Render(drawingVisual); ImageList.Add(image); } catch (Exception e) { // RenderTargetBitmap throws COM exception when created too fast: MILERR_WIN32ERROR (Exception from HRESULT: 0x88980003) Console.WriteLine(e); } GC.WaitForPendingFinalizers(); } }, TaskScheduler.FromCurrentSynchronizationContext()); } }
private void DisplayProducts(object obj) { if (SearchText == null) { return; } AllergenList = null; if (ImageList != null) { ImageList.Clear(); } switch (SearchSelected) { case "Contin:": switch (TypeSelected) { case "Preparat:": ClientProductsList = new ObservableCollection <ClientProductsDisplay>(productsBll.GetProductsContainingName(categorySelected, SearchText)); break; default: ClientProductsList = new ObservableCollection <ClientProductsDisplay>(productsBll.GetProductsContainingAllergen(categorySelected, SearchText)); break; } break; default: switch (TypeSelected) { case "Preparat:": ClientProductsList = new ObservableCollection <ClientProductsDisplay>(productsBll.GetProductsNotContainingName(categorySelected, SearchText)); break; default: ClientProductsList = new ObservableCollection <ClientProductsDisplay>(productsBll.GetProductsWithoutAllergens(categorySelected, SearchText)); break; } break; } }
private async void Search(string filer) { try { filter.f_search = filer; ImageList.Clear(); NowPageIndex = 0; //将当前页数据转为json格式的字符串 string js = "reload();"; //将数据添加到前台页面 await View.InvokeScriptAsync("eval", new[] { js }); //View.Refresh(); LoadDataByPage(); } catch (Exception ex) { ShowMessage(ex.Message); } }
public void CreateAnimationFromFile() { if (renderExample != null) { renderExample.IsActive = false; } ImageList.Clear(); Material material; try { material = new Material(ShaderFlags.Position2DTextured, animationName); CreateNewRendereExample(material); if (material.Animation != null) { foreach (var image in material.Animation.Frames) { ImageList.Add(image.Name); } Duration = material.Animation.DefaultDuration; } else { ImageList.Add(material.SpriteSheet.Image.Name); Duration = material.SpriteSheet.DefaultDuration; SubImageSize = material.SpriteSheet.SubImageSize; } SetButtonEnableStates(); } //ncrunch: no coverage start catch { Logger.Warning( "Some of this animation's images were missing. Make sure all the content of your project is present."); material = CreateDefaultMaterial2D(); CreateNewRendereExample(material); } //ncrunch: no coverage end }
protected void SyncImages(List <DirKey> lstDk) { if (lstDk == null) { throw new ArgumentNullException(nameof(lstDk)); } Response.Clear(); Response.Write(String.Format(CultureInfo.InvariantCulture, "<html><head><link href=\"{0}\" rel=\"stylesheet\" type=\"text/css\" /></head><body><p>", VirtualPathUtility.ToAbsolute("~/Public/stylesheet.css"))); DateTime dtStart = DateTime.Now; int cNewImages = 0; int cChangedImages = 0; int cDeletedImages = 0; int cImagesExamined = 0; List <MFBImageInfo> lstMfbiiNewOrChanged = new List <MFBImageInfo>(); try { // Get a list of all of the images in the DB for this category: UpdateProgress(1, 0, String.Format(CultureInfo.CurrentCulture, "Getting images for {0} from DB", CurrentSource.ToString())); Dictionary <string, MFBImageInfo> dictDBResults = MFBImageInfo.AllImagesForClass(CurrentSource); int cDBEntriesToStart = dictDBResults.Count; // Get a list of all of the images in this category: int cDirectories = lstDk.Count; int cDirectoriesProcessed = 0; int c5Percent = Math.Max(1, cDirectories / 20); UpdateProgress(2, 0, String.Format(CultureInfo.CurrentCulture, "Getting images for {0} ({1} folders)...", CurrentSource.ToString(), cDirectories)); ImageList il = new ImageList { Class = CurrentSource }; foreach (DirKey dk in lstDk) { il.Key = dk.Key; il.Refresh(true); foreach (MFBImageInfo mfbii in il.ImageArray) { MFBImageInfo mfbiiMatch = dictDBResults.ContainsKey(mfbii.PrimaryKey) ? dictDBResults[mfbii.PrimaryKey] : null; if (mfbiiMatch == null) { // If no match was found, it's a new image lstMfbiiNewOrChanged.Add(mfbii); cNewImages++; } else { bool fCommentChanged = String.Compare(mfbii.Comment, mfbiiMatch.Comment, StringComparison.CurrentCultureIgnoreCase) != 0; bool fLocChanged = !MyFlightbook.Geography.LatLong.AreEqual(mfbii.Location, mfbiiMatch.Location); // if it's changed, we need to update it. if (fCommentChanged || fLocChanged) { if (mfbii.Location != null && !mfbii.Location.IsValid) { mfbii.Location = null; } UpdateProgress(2, (100 * cDirectoriesProcessed) / cDirectories, String.Format(CultureInfo.CurrentCulture, "Changed {0}:{1}{2}", mfbii.PrimaryKey, fCommentChanged ? String.Format(CultureInfo.CurrentCulture, "<br /> Comment: {0} => {1}", mfbiiMatch.Comment, mfbii.Comment) : string.Empty, fLocChanged ? String.Format(CultureInfo.CurrentCulture, "<br /> Location: {0} => {1}", (mfbiiMatch.Location == null ? "null" : mfbiiMatch.Location.ToString()), (mfbii.Location == null ? "null" : mfbii.Location.ToString())) : string.Empty)); lstMfbiiNewOrChanged.Add(mfbii); cChangedImages++; } // Now remove it from the list of DB images. dictDBResults.Remove(mfbii.PrimaryKey); mfbiiMatch.UnCache(); mfbiiMatch = null; // save some memory? } mfbii.UnCache(); cImagesExamined++; } il.Clear(); if (++cDirectoriesProcessed % c5Percent == 0) { GC.Collect(); UpdateProgress(2, (100 * cDirectoriesProcessed) / cDirectories, String.Format(CultureInfo.CurrentCulture, "{0} Folders processed, {1} images found", cDirectoriesProcessed, cImagesExamined)); } } UpdateProgress(3, 100, String.Format(CultureInfo.CurrentCulture, "Elapsed Time: {0} seconds", DateTime.Now.Subtract(dtStart).TotalSeconds)); UpdateProgress(4, 0, String.Format(CultureInfo.CurrentCulture, "{0} image files found, {1} images in DB", cImagesExamined, cDBEntriesToStart)); // Now see if anything got deleted but not from the DB int cImagesToDelete = dictDBResults.Values.Count; if (String.IsNullOrEmpty(Request["preview"])) { UpdateProgress(5, 0, String.Format(CultureInfo.CurrentCulture, "{0} images found in DB that weren't found as files; deleting these.", cImagesToDelete)); foreach (MFBImageInfo mfbii in dictDBResults.Values) { mfbii.DeleteFromDB(); cDeletedImages++; if (cDeletedImages % 100 == 0) { UpdateProgress(5, (100 * cDeletedImages) / cImagesToDelete, String.Format(CultureInfo.CurrentCulture, "Deleted {0} images from DB", cDeletedImages)); } } // And finally add new images back UpdateProgress(6, 0, String.Format(CultureInfo.CurrentCulture, "{0} new and {1} changed images (total of {2}) to be added to/updated in the DB", cNewImages, cChangedImages, lstMfbiiNewOrChanged.Count)); lstMfbiiNewOrChanged.ForEach((mfbii) => { try { mfbii.ToDB(); } catch (Exception ex) when(ex is MyFlightbookException) { Response.Write(String.Format(CultureInfo.InvariantCulture, "<p class=\"error\">Exception sync'ing DB: {0}</p>", ex.Message)); } }); } else { UpdateProgress(5, 0, String.Format(CultureInfo.CurrentCulture, "{0} images found in DB that weren't found as files; these are:", cImagesToDelete)); foreach (MFBImageInfo mfbii in dictDBResults.Values) { UpdateProgress(5, 0, mfbii.PathThumbnail); } UpdateProgress(6, 0, String.Format(CultureInfo.CurrentCulture, "{0} images found that are new or changed that weren't in DB; these are:", cNewImages + cChangedImages)); lstMfbiiNewOrChanged.ForEach((mfbii) => { UpdateProgress(6, 0, mfbii.PathThumbnail); }); } UpdateProgress(6, 100, "Finished!"); } catch (Exception ex) when(!(ex is OutOfMemoryException)) { Response.Write(String.Format(CultureInfo.InvariantCulture, "<p class=\"error\">Exception sync'ing DB: {0}</p>", ex.Message)); } Response.Write("</p></body></html>"); Response.End(); }
private void OnGetImages(object obj) { ImageList.Clear(); // typ wyszukiwania (rozpoczynamy od pacjenta) gdcm.ERootType typ = gdcm.ERootType.ePatientRootType; // do jakiego poziomu wyszukujemy gdcm.EQueryLevel poziom = gdcm.EQueryLevel.ePatient; // zobacz inne // klucze (filtrowanie lub okreœlenie, które dane s¹ potrzebne) gdcm.KeyValuePairArrayType klucze = new gdcm.KeyValuePairArrayType(); if (SelectedPatient == null) { State = "Wybierz pacjenta"; return; } gdcm.KeyValuePairType klucz1 = new gdcm.KeyValuePairType(new gdcm.Tag(0x0010, 0x0020), SelectedPatient); // NIE WOLNO TU STOSOWAC *; tutaj PatientID="01" klucze.Add(klucz1); // skonstruuj zapytanie gdcm.BaseRootQuery zapytanie = gdcm.CompositeNetworkFunctions.ConstructQuery(typ, poziom, klucze, true); // sprawdŸ, czy zapytanie spe³nia kryteria if (!zapytanie.ValidateQuery()) { State = "MOVE b³êdne zapytanie!"; return; } // przygotuj katalog na wyniki String odebrane = System.IO.Path.Combine(".", "odebrane"); // podkatalog odebrane w bie¿¹cym katalogu if (!System.IO.Directory.Exists(odebrane)) // jeœli nie istnieje { System.IO.Directory.CreateDirectory(odebrane); // utwórz go } String dane = System.IO.Path.Combine(odebrane, System.IO.Path.GetRandomFileName()); // wygeneruj losow¹ nazwê podkatalogu System.IO.Directory.CreateDirectory(dane); // i go utwórz // wykonaj zapytanie - pobierz do katalogu jak w zmiennej 'dane' bool stan = gdcm.CompositeNetworkFunctions.CMove(IP, ushort.Parse(Port), zapytanie, portMove, AET, aec, dane); // sprawdŸ stan if (!stan) { State = "MOVE nie dzia³a!"; return; } List <string> pliki = new List <string>(System.IO.Directory.EnumerateFiles(dane)); foreach (String plik in pliki) { // MOVE + konwersja // przeczytaj pixele gdcm.PixmapReader reader = new gdcm.PixmapReader(); reader.SetFileName(plik); if (!reader.Read()) { // najpewniej nie jest to obraz continue; } // przekonwertuj na "znany format" gdcm.Bitmap bmjpeg2000 = pxmap2jpeg2000(reader.GetPixmap()); // przekonwertuj na .NET bitmapê Bitmap[] X = gdcmBitmap2Bitmap(bmjpeg2000); // zapisz for (int i = 0; i < X.Length; i++) { String name = String.Format("{0}_warstwa{1}.jpg", plik, i); X[i].Save(name); ImageList.Add(name); } } }