diff options
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MainView.xaml.cs')
| -rw-r--r-- | Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MainView.xaml.cs | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MainView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MainView.xaml.cs index bcf52aff0..97412178e 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MainView.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MainView.xaml.cs @@ -12,6 +12,9 @@ using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; +using Tango.DAL.Observables; +using Tango.DragAndDrop; +using Tango.MachineStudio.MachineDesigner.ViewModels; namespace Tango.MachineStudio.MachineDesigner.Views { @@ -20,9 +23,41 @@ namespace Tango.MachineStudio.MachineDesigner.Views /// </summary> public partial class MainView : UserControl { + private MainViewVM _vm; + public MainView() { InitializeComponent(); + DraggingSurface = dragSufrace; + this.Loaded += (x, y) => _vm = DataContext as MainViewVM; + } + + public DraggingSurface DraggingSurface + { + get { return (DraggingSurface)GetValue(DraggingSurfaceProperty); } + set { SetValue(DraggingSurfaceProperty, value); } + } + public static readonly DependencyProperty DraggingSurfaceProperty = + DependencyProperty.Register("DraggingSurface", typeof(DraggingSurface), typeof(MainView), new PropertyMetadata(null)); + + private void OnDroppedDispenser(object sender, DropEventArgs e) + { + if (e.Draggable.DataContext is Dispenser) + { + _vm.DropDispenser(e.Draggable.DataContext as Dispenser, e.Droppable.DataContext as IdsPack); + } + else if (e.Draggable.DataContext is LiquidType) + { + _vm.DropLiquidType(e.Draggable.DataContext as LiquidType, e.Droppable.DataContext as IdsPack); + } + else if (e.Draggable.DataContext is CartridgeType) + { + _vm.DropCartridgeType(e.Draggable.DataContext as CartridgeType, e.Droppable.DataContext as IdsPack); + } + else if (e.Draggable.DataContext is MidTankType) + { + _vm.DropMidTankType(e.Draggable.DataContext as MidTankType, e.Droppable.DataContext as IdsPack); + } } } } |
