Ensure drag-drop GCode is disallowed on part tabs

- Issue MatterHackers/MCCentral#3318
Drag-drop GCode to part tab should not be allowed
This commit is contained in:
John Lewin 2018-05-09 07:35:42 -07:00
parent 474823feba
commit 50ec91ea2f

View file

@ -805,7 +805,12 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
// File system Drop validation
mouseEvent.AcceptDrop = this.AllowDragDrop()
&& mouseEvent.DragFiles?.Count > 0
&& mouseEvent.DragFiles.TrueForAll(filePath => ApplicationController.Instance.IsLoadableFile(filePath));
&& mouseEvent.DragFiles.TrueForAll(filePath =>
{
return ApplicationController.Instance.IsLoadableFile(filePath)
// Disallow GCode drop in part view
&& (this.Printer != null || string.Equals(System.IO.Path.GetExtension(filePath), ".gcode", StringComparison.OrdinalIgnoreCase));
});
// View3DWidgets Filesystem DropDrop handler
if (mouseEvent.AcceptDrop