Exemplo n.º 1
0
        public void Add(Attach model)
        {
            bool foundMatch = false;

            foundMatch = modelList.Exists(item => item.Value.Name == model.Name);             // change this to something more robust when proper hashing of objects is implemented

            if (!foundMatch)
            {
                modelList.Add(new KeyValuePair <int, Attach>(model.GetHashCode(), model));
                attachListRenders.Add(new KeyValuePair <int, Bitmap>(model.GetHashCode(), renderFailureBitmap));
                meshes.Add(model.CreateD3DMesh());

                if (Visible)
                {
                    RenderModel(modelList.Count - 1, true);                          // todo: I think these Add calls are getting called while a separate thread is open, and thus causing locking issues
                }
                // perhaps we could find a way to defer all of this until after the file load operation is complete

                if (!suppressingListUpateEvents)
                {
                    if (Visible)
                    {
                        PopulateListView();
                    }
                }
                else
                {
                    listChangedWhileSuppressed = true;
                }
            }
        }