aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Views/MainView.xaml.cs
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-02-26 20:32:55 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-02-26 20:32:55 +0200
commit718a583833613a378ac2f4e4a5927ba5b48677ce (patch)
tree70a4c13a0d4821ffafefac226e779a2eb03aa84c /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Views/MainView.xaml.cs
parent5dc0936b6d8cb9bd4c334be0b0ad8dc1f3f84273 (diff)
downloadTango-718a583833613a378ac2f4e4a5927ba5b48677ce.tar.gz
Tango-718a583833613a378ac2f4e4a5927ba5b48677ce.zip
Working on hardware designer...
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Views/MainView.xaml.cs')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Views/MainView.xaml.cs44
1 files changed, 44 insertions, 0 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Views/MainView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Views/MainView.xaml.cs
index ebd3c6c6a..b06d3bd27 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Views/MainView.xaml.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/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.DragAndDrop;
+using Tango.Integration.Observables;
+using Tango.MachineStudio.HardwareDesigner.ViewModels;
namespace Tango.MachineStudio.HardwareDesigner.Views
{
@@ -20,9 +23,50 @@ namespace Tango.MachineStudio.HardwareDesigner.Views
/// </summary>
public partial class MainView : UserControl
{
+ private MainViewVM _vm;
+
+ 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));
+
public MainView()
{
InitializeComponent();
+ DraggingSurface = dragSufrace;
+
+ Loaded += (x, y) => _vm = DataContext as MainViewVM;
+ }
+
+ private void OnMotorsDrop(object sender, DropEventArgs e)
+ {
+ if (e.Draggable.DataContext is MotorType)
+ {
+ _vm.OnMotorDrop(e.Draggable.DataContext as MotorType);
+ }
+ }
+
+ private void OnDancerDrop(object sender, DropEventArgs e)
+ {
+ if (e.Draggable.DataContext is DancerType)
+ {
+ _vm.OnDropDancer(e.Draggable.DataContext as DancerType);
+ }
+ }
+
+ private void OnTrashDrop(object sender, DropEventArgs e)
+ {
+ if (e.Draggable.DataContext is MotorType)
+ {
+ _vm.OnRemoveMotor(e.Draggable.DataContext as MotorType);
+ }
+ else if (e.Draggable.DataContext is DancerType)
+ {
+ _vm.OnRemoveDancer(e.Draggable.DataContext as DancerType);
+ }
}
}
}