예제 #1
0
        private void OpenFileDialog_FileOk(object sender, CancelEventArgs e)
        {
            switch (_fileType)
            {
            case FileType.Model:
                txtModelName.Text = openFileDialog.SafeFileName;
                _modelFilePath    = openFileDialog.FileName;
                ModelChangedEventArgs modelChangedEventArgs = new ModelChangedEventArgs
                {
                    ModelFilePath = openFileDialog.SafeFileName
                };
                OnModelChanged(sender, modelChangedEventArgs);
                break;

            case FileType.Material:
                txtMaterialName.Text = openFileDialog.SafeFileName;
                _materialFilePath    = openFileDialog.FileName;
                MaterialChangedEventArgs materialChangedEventArgs = new MaterialChangedEventArgs
                {
                    MaterialFilePath = openFileDialog.SafeFileName
                };
                OnMaterialChanged(sender, materialChangedEventArgs);
                break;
            }
        }
예제 #2
0
        private void MaterialName_DragDrop(object sender, DragEventArgs e)
        {
            Type type = new DragDropAsset().GetType();

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

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

                    _materialFilePath = filePath;

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

                    MaterialChangedEventArgs materialChangedEventArgs = new MaterialChangedEventArgs
                    {
                        MaterialFilePath = filePath
                    };
                    OnMaterialChanged(sender, materialChangedEventArgs);
                }
                else
                {
                    e.Effect = DragDropEffects.None;
                }
            }
            else
            {
                e.Effect = DragDropEffects.None;
            }
        }
예제 #3
0
 public virtual void OnMaterialChanged(object sender, MaterialChangedEventArgs e)
 {
     MaterialChanged?.Invoke(sender, e);
 }