From dd18ae0c096a34048477297ba848a089a99eece1 Mon Sep 17 00:00:00 2001 From: Roy Date: Sun, 7 Jan 2018 09:27:42 +0200 Subject: Progress on machine designer... --- .../Views/MainView.xaml | 685 +++++++++++++-------- .../Views/MainView.xaml.cs | 74 ++- 2 files changed, 512 insertions(+), 247 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MainView.xaml index 48b90aa6b..03a3e2636 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MainView.xaml @@ -79,16 +79,16 @@ - + - - MACHINE DESIGNER - - + + + MACHINE DESIGNER + - + @@ -100,17 +100,39 @@ + + + - - - - + + + + + - + + + + + + + + + + + + + + + Hardware + + + + Add IDS @@ -131,7 +153,7 @@ - + + + + + + + + + + + + + + + + + + + @@ -226,59 +280,60 @@ - + - + - - - - - - - + + + + + + + + - - + + - Touch Panel: + Touch Panel - Embedded Firmware: + Embedded Firmware - Dispensers: + Dispensers - Mid Tanks: + Mid Tanks - + @@ -286,18 +341,32 @@ + - + + + + - - - - + + + + + + - - + + + + + + + + + + @@ -343,238 +412,362 @@ - - + + - - - - - - - - - - - - - - - + + + + + + Serial Number + + + Machine Name + + + Machine Version + + + Organization + + + + Enable Synchronization + + + + Configuration Name + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - v - - - - - + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - v + + + + + + + + + + + + + + + + + + + + v + + + + + + - - - - - - - - - - - - - - - - - - - - - v + + + + + + + + + + + + + + + + + + + + v + - - - - - - - - - - - - - - - - - - - - - v + + + + + + + + + + + + + + + + + + + + v + - - - - - - - - - - - - - - - - - - - - - v + + + + + + + + + + + + + + + + + + + + v + - - - - - - - - - + + + + + + + + + + + + + + + + + + + + v + + + + + + + + + + + + + + + + + + + + + + + v + + + + + + + + + + + + + + + + + + + + + + + v + + + + + + + + + + + + - + 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 ebf45624d..7c2a38401 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 @@ -10,6 +10,7 @@ using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; +using System.Windows.Media.Animation; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; @@ -25,15 +26,54 @@ namespace Tango.MachineStudio.MachineDesigner.Views public partial class MainView : UserControl { private MainViewVM _vm; + private Rectangle _highlightRect; + private bool _highlightShown; + private DoubleAnimation _highlightAnimation; public MainView() { InitializeComponent(); DraggingSurface = dragSufrace; - this.Loaded += (x, y) => + this.Loaded += (x, y) => { _vm = DataContext as MainViewVM; }; + + DragAndDropService.DragStarted += DragAndDropService_DragStarted; + DragAndDropService.DragEnded += DragAndDropService_DragEnded; + + _highlightRect = new Rectangle(); + _highlightRect.IsHitTestVisible = false; + _highlightRect.Stroke = Application.Current.Resources["AccentColorBrush"] as Brush; + _highlightRect.StrokeThickness = 2; + _highlightRect.StrokeDashArray = new DoubleCollection(new double[] { 3, 3, 3, 3 }); + } + + private void DragAndDropService_DragEnded(object sender, FrameworkElement e) + { + canvas.Children.Remove(_highlightRect); + _highlightShown = false; + _highlightRect.BeginAnimation(Rectangle.OpacityProperty, null); + } + + private void DragAndDropService_DragStarted(object sender, FrameworkElement e) + { + if (e.DataContext is HardwareVersion) + { + SetHighlightRegion(hardwareGrid); + } + else if (e.DataContext is ApplicationVersion || e.DataContext is ApplicationOsVersion || e.DataContext is ApplicationDisplayPanelVersion) + { + SetHighlightRegion(gridTablet); + } + else if (e.DataContext is EmbeddedFirmwareVersion || e.DataContext is EmbeddedSoftwareVersion) + { + SetHighlightRegion(gridEmbedded); + } + else if (e.DataContext is Dispenser || e.DataContext is Cartridge || e.DataContext is LiquidType || e.DataContext is MidTankType) + { + SetHighlightRegion(gridIds); + } } public DraggingSurface DraggingSurface @@ -74,6 +114,10 @@ namespace Tango.MachineStudio.MachineDesigner.Views { _vm.DropApplicationVersion(e.Draggable.DataContext as ApplicationVersion); } + else if (e.Draggable.DataContext is ApplicationOsVersion) + { + _vm.DropApplicationOsVersion(e.Draggable.DataContext as ApplicationOsVersion); + } } private void OnEmbeddedDrop(object sender, DropEventArgs e) @@ -87,5 +131,33 @@ namespace Tango.MachineStudio.MachineDesigner.Views _vm.DropEmbeddedSoftware(e.Draggable.DataContext as EmbeddedSoftwareVersion); } } + + private void MachineDrop(object sender, DropEventArgs e) + { + if (e.Draggable.DataContext is HardwareVersion) + { + _vm.DropHardwareVersion(e.Draggable.DataContext as HardwareVersion); + } + } + + private void SetHighlightRegion(FrameworkElement element) + { + if (!_highlightShown) + { + _highlightRect.Width = element.Width; + _highlightRect.Height = element.Height; + Canvas.SetLeft(_highlightRect, Canvas.GetLeft(element)); + Canvas.SetTop(_highlightRect, Canvas.GetTop(element)); + canvas.Children.Add(_highlightRect); + _highlightShown = true; + _highlightAnimation = new DoubleAnimation(); + _highlightAnimation.From = 0; + _highlightAnimation.To = 1; + _highlightAnimation.Duration = TimeSpan.FromSeconds(0.2); + _highlightAnimation.AutoReverse = true; + _highlightAnimation.RepeatBehavior = RepeatBehavior.Forever; + _highlightRect.BeginAnimation(Rectangle.OpacityProperty, _highlightAnimation); + } + } } } -- cgit v1.3.1