private void ZoomBorder_Drop(object sender, DragEventArgs e) { // Files. if (e.Data.GetDataPresent(DataFormats.FileDrop)) { try { var files = (string[])e.Data.GetData(DataFormats.FileDrop); if (_projectEditor.OnDropFiles(files)) { e.Handled = true; } } catch (Exception ex) { _projectEditor?.Log?.LogError($"{ex.Message}{Environment.NewLine}{ex.StackTrace}"); } } // Shapes. if (e.Data.GetDataPresent(typeof(IBaseShape))) { try { if (e.Data.GetData(typeof(IBaseShape)) is IBaseShape shape) { var p = e.GetPosition(drawableControl); _projectEditor.OnDropShape(shape, p.X, p.Y); e.Handled = true; } } catch (Exception ex) { _projectEditor?.Log?.LogError($"{ex.Message}{Environment.NewLine}{ex.StackTrace}"); } } // Groups. if (e.Data.GetDataPresent(typeof(IGroupShape))) { try { if (e.Data.GetData(typeof(IGroupShape)) is IGroupShape group) { var p = e.GetPosition(drawableControl); _projectEditor.OnDropShapeAsClone(group, p.X, p.Y); e.Handled = true; } } catch (Exception ex) { _projectEditor?.Log?.LogError($"{ex.Message}{Environment.NewLine}{ex.StackTrace}"); } } // Records. if (e.Data.GetDataPresent(typeof(IRecord))) { try { if (e.Data.GetData(typeof(IRecord)) is IRecord record) { var p = e.GetPosition(drawableControl); _projectEditor.OnDropRecord(record, p.X, p.Y); e.Handled = true; } } catch (Exception ex) { _projectEditor?.Log?.LogError($"{ex.Message}{Environment.NewLine}{ex.StackTrace}"); } } // Styles. if (e.Data.GetDataPresent(typeof(IShapeStyle))) { try { if (e.Data.GetData(typeof(IShapeStyle)) is IShapeStyle style) { var p = e.GetPosition(drawableControl); _projectEditor.OnDropStyle(style, p.X, p.Y); e.Handled = true; } } catch (Exception ex) { _projectEditor?.Log?.LogError($"{ex.Message}{Environment.NewLine}{ex.StackTrace}"); } } // Templates. if (e.Data.GetDataPresent(typeof(IPageContainer))) { try { if (e.Data.GetData(typeof(IPageContainer)) is IPageContainer template) { _projectEditor.OnApplyTemplate(template); e.Handled = true; } } catch (Exception ex) { _projectEditor?.Log?.LogError($"{ex.Message}{Environment.NewLine}{ex.StackTrace}"); } } }