public TextureInspectionView(Scene scene, FlowLayoutPanel flow) : base(flow) { _scene = scene; var have = new HashSet <string>(); foreach (var mat in scene.Raw.Materials) { var textures = mat.GetAllMaterialTextures(); foreach (var tex in textures) { if (have.Contains(tex.FilePath)) { continue; } have.Add(tex.FilePath); AddTextureEntry(tex.FilePath); } } var countdown = have.Count; Scene.TextureSet.AddCallback((name, tex) => { // we need to handle this case because texture callbacks may occur late if (Flow.IsDisposed) { return(false); } if (Flow.IsHandleCreated) { Flow.BeginInvoke(new SetLabelTextDelegate(SetTextureToLoadedStatus), new object[] { name, tex } ); } else { SetTextureToLoadedStatus(name, tex); } return(--countdown > 0); }); flow.AllowDrop = true; flow.DragDrop += (sender, args) => { try { var a = (Array)args.Data.GetData(DataFormats.FileDrop, false); if (a != null) { string s = a.GetValue(0).ToString(); if (!Directory.Exists(s)) { MatchWithFolder(s); return; } } } catch (Exception ex) { Trace.WriteLine("Error in DragDrop function: " + ex.Message); } }; }