diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-01-03 19:20:56 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-01-03 19:20:56 +0200 |
| commit | 0681c34b56580e3c5c37d95bf1c3f948d95c2302 (patch) | |
| tree | 8a6042ada060b9f46e2484c0f43c4147d0c3dd06 /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MainView.xaml.cs | |
| parent | 0fc95107f2da4f93f7c135e7c29802bd7d785431 (diff) | |
| download | Tango-0681c34b56580e3c5c37d95bf1c3f948d95c2302.tar.gz Tango-0681c34b56580e3c5c37d95bf1c3f948d95c2302.zip | |
Progress on Machine Designer.
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); + } } } } |
