private void setEmitterImage(int idx, string path) { if (path == "") { return; } if (idx < 0 || idx >= ctl.lstVM.Count) { return; } ParticleEditVM vm = ctl.lstVM[idx]; ParticleEditModel md = MainModel.ins.particleEditModel; if (md == null) { return; } vm.md.path = MainCtl.formatPath(md.path, path); MainCtl.ins.particleEditCtl.updateImage(idx); particleRenderBox.updateEmitterImage(idx); }
private void grdEmitterBox_Drop(object sender, DragEventArgs e) { ParticleEditVM vm = (sender as Grid)?.Tag as ParticleEditVM; if (vm == null) { return; } int idx = vm.idx; string path = ""; //拖拽文件 try { string[] docPath = (string[])e.Data.GetData(DataFormats.FileDrop); if (docPath.Length > 0) { //txt.Text = docPath[0]; path = docPath[0]; } } catch (Exception) { } if (path == "") { return; } setEmitterImage(idx, path); }
private void imgEmitter_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { ParticleEditVM vm = (sender as Image)?.Tag as ParticleEditVM; if (vm == null) { return; } int idx = vm.idx; string path = selectFile(vm.md.path); setEmitterImage(idx, path); }