using Serein.Library;
using Serein.Workbench.Customs;
using Serein.Workbench.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace Serein.Workbench.Views
{
///
/// BaseNodesView.xaml 的交互逻辑
///
public partial class BaseNodesView : UserControl
{
public BaseNodesView()
{
this.DataContext = App.GetService().BaseNodesViewModel;
InitializeComponent();
}
///
/// 基础节点的拖拽放置创建
///
///
///
private void BaseNodeControl_PreviewMouseMove(object sender, MouseEventArgs e)
{
if (sender is UserControl control)
{
if (e.LeftButton == MouseButtonState.Pressed)
{
// 创建一个 DataObject 用于拖拽操作,并设置拖拽效果
var dragData = new DataObject(MouseNodeType.CreateBaseNodeInCanvas, control.GetType());
try
{
DragDrop.DoDragDrop(control, dragData, DragDropEffects.Move);
}
catch (Exception ex)
{
SereinEnv.WriteLine(ex);
}
}
}
}
}
}