Example #1
0
        private void ModelName_DragDrop(object sender, DragEventArgs e)
        {
            Type type = new DragDropAsset().GetType();

            DragDropAsset dropAsset = (DragDropAsset)e.Data.GetData(type);

            if (dropAsset != null)
            {
                if (dropAsset.Type == DragDropAsset.AssetType.Model)
                {
                    _fileType = FileType.Model;
                    string filePath = dropAsset.FileName;

                    _modelFilePath = filePath;

                    txtModelName.Text = filePath.Substring(filePath.LastIndexOf('\\') + 1);

                    ModelChangedEventArgs modelChangedEventArgs = new ModelChangedEventArgs
                    {
                        ModelFilePath = filePath
                    };
                    OnModelChanged(sender, modelChangedEventArgs);
                }
                else
                {
                    e.Effect = DragDropEffects.None;
                }
            }
            else
            {
                e.Effect = DragDropEffects.None;
            }
        }
Example #2
0
        private void ModelName_DragEnter(object sender, DragEventArgs e)
        {
            DragDropAsset dropAsset = new DragDropAsset();
            Type          type      = dropAsset.GetType();

            DragDropAsset data = (DragDropAsset)e.Data.GetData(type);

            if (data.Type == DragDropAsset.AssetType.Model)
            {
                e.Effect = DragDropEffects.Copy;
            }
            else
            {
                e.Effect = DragDropEffects.None;
            }
        }