From 438f517fd49d1bb10d08d8a279533e82eb67801a Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Tue, 2 Oct 2018 17:54:40 +0300 Subject: Working on RML module.. --- .../Tango.MachineStudio.ColorLab.csproj | 10 +- .../ViewModels/CalibrationDataViewVM.cs | 41 +++ .../ViewModels/MainViewVM.cs | 8 + .../Views/CalibrationDataView.xaml | 72 ++++++ .../Views/CalibrationDataView.xaml.cs | 28 +++ .../Views/MainView.xaml | 40 +-- .../Tango.MachineStudio.RML/Contracts/IMainView.cs | 20 ++ .../Images/thread_128px.png | Bin 0 -> 2191 bytes .../Tango.MachineStudio.RML/Images/threads.png | Bin 0 -> 315399 bytes .../Tango.MachineStudio.RML.csproj | 25 ++ .../ViewModels/MainViewVM.cs | 275 ++++++++++++++++++-- .../Tango.MachineStudio.RML/Views/MainView.xaml | 6 +- .../Tango.MachineStudio.RML/Views/MainView.xaml.cs | 11 +- .../Tango.MachineStudio.RML/Views/RmlView.xaml | 276 ++++++++++++++++++++- .../Tango.MachineStudio.RML/Views/RmlView.xaml.cs | 23 ++ .../Tango.MachineStudio.RML/Views/RmlsView.xaml | 53 +++- .../Tango.MachineStudio.RML/packages.config | 2 + .../Tango.MachineStudio.Common/StudioViewModel.cs | 5 +- 18 files changed, 825 insertions(+), 70 deletions(-) create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/CalibrationDataViewVM.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/CalibrationDataView.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/CalibrationDataView.xaml.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Contracts/IMainView.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Images/thread_128px.png create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Images/threads.png (limited to 'Software/Visual_Studio/MachineStudio') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Tango.MachineStudio.ColorLab.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Tango.MachineStudio.ColorLab.csproj index 7e8a9e126..18d51aa09 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Tango.MachineStudio.ColorLab.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Tango.MachineStudio.ColorLab.csproj @@ -74,10 +74,14 @@ + + + CalibrationDataView.xaml + MainView.xaml @@ -157,6 +161,10 @@ + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -179,7 +187,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/CalibrationDataViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/CalibrationDataViewVM.cs new file mode 100644 index 000000000..c9c83dde0 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/CalibrationDataViewVM.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.MachineStudio.Common; +using Tango.SharedUI; + +namespace Tango.MachineStudio.ColorLab.ViewModels +{ + public class CalibrationDataViewVM : ViewModel + { + private ObservableCollection _liquidsCalibrationData; + /// + /// Gets or sets the liquids calibration data. + /// + public ObservableCollection LiquidsCalibrationData + { + get { return _liquidsCalibrationData; } + set { _liquidsCalibrationData = value; RaisePropertyChangedAuto(); } + } + + /// + /// Initializes a new instance of the class. + /// + public CalibrationDataViewVM() + { + LiquidsCalibrationData = new ObservableCollection(); + } + + /// + /// Initializes a new instance of the class. + /// + /// The liquids calibration data. + public CalibrationDataViewVM(ObservableCollection liquidsCalibrationData) + { + LiquidsCalibrationData = liquidsCalibrationData; + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/MainViewVM.cs index 02f496b1f..d0fa80a20 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/MainViewVM.cs @@ -150,6 +150,13 @@ namespace Tango.MachineStudio.ColorLab.ViewModels set { _liquidsCalibrationData = value; RaisePropertyChangedAuto(); } } + private CalibrationDataViewVM _calibrationDataViewVM; + public CalibrationDataViewVM CalibrationDataViewVM + { + get { return _calibrationDataViewVM; } + set { _calibrationDataViewVM = value; RaisePropertyChangedAuto(); } + } + private RgbVM _sourceColor; /// /// Gets or sets the color of the source. @@ -566,6 +573,7 @@ namespace Tango.MachineStudio.ColorLab.ViewModels //RmlProcessParametersTableGroup = SelectedRML.ProcessParametersTablesGroups.ToList().SingleOrDefault(x => x.Active); LiquidsCalibrationData = new ObservableCollection(); + CalibrationDataViewVM = new CalibrationDataViewVM(LiquidsCalibrationData); LiquidsCalibrationData.EnableCrossThreadOperations(); foreach (var idsPack in SelectedMachine.Configuration.NoneEmptyIdsPacks.OrderBy(x => x.PackIndex)) diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/CalibrationDataView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/CalibrationDataView.xaml new file mode 100644 index 000000000..28279bd50 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/CalibrationDataView.xaml @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/CalibrationDataView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/CalibrationDataView.xaml.cs new file mode 100644 index 000000000..26100f16d --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/CalibrationDataView.xaml.cs @@ -0,0 +1,28 @@ +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 Tango.MachineStudio.ColorLab.Views +{ + /// + /// Interaction logic for CalibrationDataView.xaml + /// + public partial class CalibrationDataView : UserControl + { + public CalibrationDataView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/MainView.xaml index 78eaf04e8..4e8703a6e 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/MainView.xaml @@ -360,44 +360,8 @@ CALIBRATION DATA - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Contracts/IMainView.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Contracts/IMainView.cs new file mode 100644 index 000000000..7431f1ef1 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Contracts/IMainView.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.SharedUI; + +namespace Tango.MachineStudio.RML.Contracts +{ + public enum RmlNavigationView + { + RmlsView, + RmlView, + } + + public interface IMainView : IView + { + void NavigateTo(RmlNavigationView view); + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Images/thread_128px.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Images/thread_128px.png new file mode 100644 index 000000000..36533fbeb Binary files /dev/null and b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Images/thread_128px.png differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Images/threads.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Images/threads.png new file mode 100644 index 000000000..86eb0b335 Binary files /dev/null and b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Images/threads.png differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Tango.MachineStudio.RML.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Tango.MachineStudio.RML.csproj index fcd933f4b..99b0a3c19 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Tango.MachineStudio.RML.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Tango.MachineStudio.RML.csproj @@ -37,12 +37,18 @@ ..\..\..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.SqlServer.dll + + ..\..\..\packages\Google.Protobuf.3.4.1\lib\net45\Google.Protobuf.dll + ..\..\..\packages\MahApps.Metro.1.5.0\lib\net45\MahApps.Metro.dll ..\..\..\packages\MaterialDesignColors.1.1.2\lib\net45\MaterialDesignColors.dll + + ..\..\..\packages\MaterialDesignThemes.2.3.1.953\lib\net45\MaterialDesignThemes.Wpf.dll + @@ -66,6 +72,7 @@ GlobalVersionInfo.cs + Code @@ -119,10 +126,18 @@ {ca87a608-7b17-4c98-88f2-42abee10f4c1} Tango.Documents + + {b112d89a-a106-41ae-a0c1-4abc84c477f5} + Tango.DragAndDrop + {bc932dbd-7cdb-488c-99e4-f02cf441f55e} Tango.Logging + + {e4927038-348d-4295-aaf4-861c58cb3943} + Tango.PMR + {d8f1ad85-526a-4f50-b6dc-d437af63d8d8} Tango.Settings @@ -135,6 +150,10 @@ {cb0b0aa2-bb24-4bca-a720-45e397684e12} Tango.MachineStudio.Common + + {4d183aca-552b-4135-ae81-7c5a8e5fc3b1} + Tango.MachineStudio.ColorLab + @@ -153,5 +172,11 @@ MSBuild:Compile + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs index 9e108d0a8..b7e7859ac 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs @@ -1,18 +1,23 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; +using System.ComponentModel; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Windows.Data; using Tango.BL; using Tango.BL.Builders; using Tango.BL.Entities; +using Tango.Core.Commands; +using Tango.MachineStudio.ColorLab.ViewModels; using Tango.MachineStudio.Common; using Tango.MachineStudio.Common.Notifications; +using Tango.MachineStudio.RML.Contracts; namespace Tango.MachineStudio.RML.ViewModels { - public class MainViewVM : StudioViewModel + public class MainViewVM : StudioViewModel { private INotificationProvider _notification; @@ -26,11 +31,60 @@ namespace Tango.MachineStudio.RML.ViewModels set { _rmls = value; RaisePropertyChangedAuto(); } } + private ObservableCollection _materials; + public ObservableCollection Materials + { + get { return _materials; } + set { _materials = value; RaisePropertyChangedAuto(); } + } + + private ObservableCollection _colors; + public ObservableCollection Colors + { + get { return _colors; } + set { _colors = value; RaisePropertyChangedAuto(); } + } + + private ObservableCollection _purposes; + public ObservableCollection Purposes + { + get { return _purposes; } + set { _purposes = value; RaisePropertyChangedAuto(); } + } + + private ObservableCollection _conditions; + public ObservableCollection Conditions + { + get { return _conditions; } + set { _conditions = value; RaisePropertyChangedAuto(); } + } + + private ObservableCollection _linearMassDensityUnits; + public ObservableCollection LinearMassDensityUnits + { + get { return _linearMassDensityUnits; } + set { _linearMassDensityUnits = value; RaisePropertyChangedAuto(); } + } + + private ObservableCollection _fiberShapes; + public ObservableCollection FiberShapes + { + get { return _fiberShapes; } + set { _fiberShapes = value; RaisePropertyChangedAuto(); } + } + + private ObservableCollection _fiberSynths; + public ObservableCollection FiberSynths + { + get { return _fiberSynths; } + set { _fiberSynths = value; RaisePropertyChangedAuto(); } + } + private Rml _selectedRML; public Rml SelectedRML { get { return _selectedRML; } - set { _selectedRML = value; RaisePropertyChangedAuto(); OnSelectedRmlChanged(); } + set { _selectedRML = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } } private Rml _activeRML; @@ -40,9 +94,65 @@ namespace Tango.MachineStudio.RML.ViewModels set { _activeRML = value; RaisePropertyChangedAuto(); } } + private CalibrationDataViewVM _calibrationDataViewVM; + public CalibrationDataViewVM CalibrationDataViewVM + { + get { return _calibrationDataViewVM; } + set { _calibrationDataViewVM = value; RaisePropertyChangedAuto(); } + } + + private ObservableCollection _liquidTypesRmls; + public ObservableCollection LiquidTypesRmls + { + get { return _liquidTypesRmls; } + set { _liquidTypesRmls = value; RaisePropertyChangedAuto(); } + } + + private ProcessParametersTablesGroup _activeProcessParametersGroup; + public ProcessParametersTablesGroup ActiveProcessParametersGroup + { + get { return _activeProcessParametersGroup; } + set { _activeProcessParametersGroup = value; RaisePropertyChangedAuto(); } + } + + private ICollectionView _activeProcessParametersTableView; + public ICollectionView ActiveProcessParametersTableView + { + get { return _activeProcessParametersTableView; } + set { _activeProcessParametersTableView = value; RaisePropertyChangedAuto(); } + } + + + /// + /// Gets or sets the manage RML command. + /// + public RelayCommand ManageRmlCommand { get; set; } + + /// + /// Gets or sets the add RML command. + /// + public RelayCommand AddRmlCommand { get; set; } + + /// + /// Gets or sets the remove RML command. + /// + public RelayCommand RemoveRmlCommand { get; set; } + + public RelayCommand AddProcessParametersTableCommand { get; set; } + + /// + /// Gets or sets the back to RMLS command. + /// + public RelayCommand BackToRmlsCommand { get; set; } + public MainViewVM(INotificationProvider notificationProvider) { _notification = notificationProvider; + ManageRmlCommand = new RelayCommand(() => LoadActiveRML(SelectedRML.Guid), () => SelectedRML != null); + RemoveRmlCommand = new RelayCommand(RemoveSelectedRml); + AddRmlCommand = new RelayCommand(AddNewRml); + BackToRmlsCommand = new RelayCommand(BackToRmls); + AddProcessParametersTableCommand = new RelayCommand(AddProcessParametersTable); } public override void OnApplicationReady() @@ -52,36 +162,21 @@ namespace Tango.MachineStudio.RML.ViewModels private async void LoadRmls() { - //using (_rmls_context = ObservablesContext.CreateDefault()) - //{ - // await Task.Factory.StartNew(() => - // { - // Rmls = _rmls.ToList().ToObservableCollection(); - // }); - //} - } - - private void OnSelectedRmlChanged() - { - if (SelectedRML != null) - { - LoadActiveRML(SelectedRML.Guid); - } - else + using (_rmls_context = ObservablesContext.CreateDefault()) { - UnloadActiveRML(); + await Task.Factory.StartNew(() => + { + Rmls = _rmls_context.Rmls.ToList().ToObservableCollection(); + }); } } - private void UnloadActiveRML() - { - ActiveRML = null; - } - private async void LoadActiveRML(String guid) { using (_notification.PushTaskItem("Loading RML...")) { + IsFree = false; + if (_active_context != null) { _active_context.Dispose(); @@ -89,12 +184,142 @@ namespace Tango.MachineStudio.RML.ViewModels _active_context = ObservablesContext.CreateDefault(); + LoadRmlProperties(); + ActiveRML = await new RmlBuilder(_active_context) .Set(guid) - .WithAllParametersGroup() + .WithActiveParametersGroup() .WithLiquidFactors() + .WithMediaProperties() .BuildAsync(); + + ActiveProcessParametersGroup = ActiveRML.ProcessParametersTablesGroups.ToList().FirstOrDefault(); + ActiveProcessParametersTableView = CollectionViewSource.GetDefaultView(ActiveProcessParametersGroup.ProcessParametersTables); + ActiveProcessParametersTableView.SortDescriptions.Add(new SortDescription(nameof(ProcessParametersTable.TableIndex), ListSortDirection.Ascending)); + + CalibrationDataViewVM = new CalibrationDataViewVM(); + LiquidTypesRmls = ActiveRML.LiquidTypesRmls; + + foreach (var liquidTypeRml in LiquidTypesRmls) + { + CalibrationDataVM catVM = new CalibrationDataVM(); + catVM.Name = liquidTypeRml.LiquidType.Name; + catVM.Color = liquidTypeRml.LiquidType.Color; + + if (liquidTypeRml.DefaultCatData != null) + { + catVM.CalibrationPoints = liquidTypeRml.GetCalibrationData().CalibrationPoints.Select(x => new CalibrationDataPointVM(x.X, x.Y)).ToObservableCollection(); + } + + CalibrationDataViewVM.LiquidsCalibrationData.Add(catVM); + } + + + View.NavigateTo(RmlNavigationView.RmlView); + + IsFree = true; } } + + private void LoadRmlProperties() + { + Materials = _active_context.MediaMaterials.ToObservableCollection(); + Colors = _active_context.MediaColors.ToObservableCollection(); + Purposes = _active_context.MediaPurposes.ToObservableCollection(); + Conditions = _active_context.MediaConditions.ToObservableCollection(); + LinearMassDensityUnits = _active_context.LinearMassDensityUnits.ToObservableCollection(); + FiberShapes = _active_context.FiberShapes.ToObservableCollection(); + FiberSynths = _active_context.FiberSynths.ToObservableCollection(); + } + + private async void AddNewRml() + { + var name = _notification.ShowTextInput("Please enter RML name", "Name"); + + if (!String.IsNullOrWhiteSpace(name)) + { + if (Rmls.ToList().Exists(x => x.Name == name)) + { + _notification.ShowError("The specified RML name already exists. Please select a different name."); + return; + } + + using (_notification.PushTaskItem("Creating new RML...")) + { + IsFree = false; + + if (_active_context != null) + { + _active_context.Dispose(); + } + + LoadRmlProperties(); + + Rml rml = new Rml(); + rml.Name = name; + rml.Manufacturer = "Twine"; + rml.Code = Rmls.Max(x => x.Code) + 1; + rml.MediaMaterial = Materials.FirstOrDefault(); + rml.MediaColor = Colors.FirstOrDefault(); + rml.MediaPurpose = Purposes.FirstOrDefault(); + rml.MediaCondition = Conditions.FirstOrDefault(); + rml.LinearMassDensityUnit = LinearMassDensityUnits.FirstOrDefault(); + rml.FiberShape = FiberShapes.FirstOrDefault(); + rml.FiberSynth = FiberSynths.FirstOrDefault(); + _active_context.Rmls.Add(rml); + await _active_context.SaveChangesAsync(); + LoadActiveRML(rml.Guid); + + IsFree = true; + } + } + } + + private void RemoveSelectedRml() + { + + } + + private void AddProcessParametersTable() + { + var name = _notification.ShowTextInput("Enter table name", "Name"); + + if (!String.IsNullOrWhiteSpace(name)) + { + _active_context.ProcessParametersTables.Add(new ProcessParametersTable() + { + ProcessParametersTablesGroup = ActiveProcessParametersGroup, + Name = name, + TableIndex = ActiveProcessParametersGroup.ProcessParametersTables.Max(x => x.TableIndex) + 1, + }); + } + } + + public void OnProcessParametersTableDropped(ProcessParametersTable dragged, ProcessParametersTable dropped) + { + if (dragged.TableIndex > dropped.TableIndex) + { + dragged.TableIndex = dropped.TableIndex - 1; + } + else + { + dragged.TableIndex = dropped.TableIndex + 1; + } + + int index = 0; + + foreach (var table in ActiveProcessParametersGroup.ProcessParametersTables.OrderBy(x => x.TableIndex)) + { + table.TableIndex = index++; + } + + ActiveProcessParametersTableView.Refresh(); + } + + private void BackToRmls() + { + View.NavigateTo(RmlNavigationView.RmlsView); + LoadRmls(); + } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/MainView.xaml index bdd36af7a..ab5207722 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/MainView.xaml @@ -5,10 +5,14 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:global="clr-namespace:Tango.MachineStudio.RML" xmlns:vm="clr-namespace:Tango.MachineStudio.RML.ViewModels" + xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" xmlns:local="clr-namespace:Tango.MachineStudio.RML.Views" mc:Ignorable="d" d:DesignHeight="1080" d:DesignWidth="1920" Background="Transparent" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> - + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/MainView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/MainView.xaml.cs index 0fdcd11b8..20ff4c076 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/MainView.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/MainView.xaml.cs @@ -12,17 +12,26 @@ using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; +using Tango.Core.DI; +using Tango.MachineStudio.RML.Contracts; +using Tango.SharedUI; namespace Tango.MachineStudio.RML.Views { /// /// Interaction logic for MainView.xaml /// - public partial class MainView : UserControl + public partial class MainView : UserControl, IMainView { public MainView() { InitializeComponent(); + TangoIOC.Default.Register(this); + } + + public void NavigateTo(RmlNavigationView view) + { + navigationControl.NavigateTo(view.ToString()); } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlView.xaml index 92b8506f5..e77663de4 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlView.xaml @@ -4,11 +4,283 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:global="clr-namespace:Tango.MachineStudio.RML" + xmlns:observables="clr-namespace:Tango.BL.Entities;assembly=Tango.BL" + xmlns:shapes="clr-namespace:Tango.SharedUI.Shapes;assembly=Tango.SharedUI" + xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" + xmlns:editors="clr-namespace:Tango.SharedUI.Editors;assembly=Tango.SharedUI" + xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:colorLabViews="clr-namespace:Tango.MachineStudio.ColorLab.Views;assembly=Tango.MachineStudio.ColorLab" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:dragAndDrop="clr-namespace:Tango.DragAndDrop;assembly=Tango.DragAndDrop" xmlns:vm="clr-namespace:Tango.MachineStudio.RML.ViewModels" xmlns:local="clr-namespace:Tango.MachineStudio.RML.Views" mc:Ignorable="d" d:DesignHeight="1080" d:DesignWidth="1920" Background="Transparent" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + PROPERTIES + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ACTIVE PROCESS GROUP + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LIQUID FACTORS + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CALIBRATION DATA + + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlView.xaml.cs index e01654243..c1bc9ad4a 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlView.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlView.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.BL.Entities; +using Tango.DragAndDrop; +using Tango.MachineStudio.RML.ViewModels; namespace Tango.MachineStudio.RML.Views { @@ -20,9 +23,29 @@ namespace Tango.MachineStudio.RML.Views /// public partial class RmlView : 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(RmlView), new PropertyMetadata(null)); + + public RmlView() { InitializeComponent(); + DraggingSurface = draggingSurface; + Loaded += (_, __) => { _vm = DataContext as MainViewVM; }; + } + + private void OnProcessTableDropped(object sender, DropEventArgs e) + { + ProcessParametersTable dragged = e.Draggable.DataContext as ProcessParametersTable; + ProcessParametersTable dropped = e.Droppable.DataContext as ProcessParametersTable; + _vm.OnProcessParametersTableDropped(dragged, dropped); } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlsView.xaml index 2ba5e44c9..b597c1dd2 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlsView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlsView.xaml @@ -5,10 +5,61 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:global="clr-namespace:Tango.MachineStudio.RML" xmlns:vm="clr-namespace:Tango.MachineStudio.RML.ViewModels" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" xmlns:local="clr-namespace:Tango.MachineStudio.RML.Views" mc:Ignorable="d" d:DesignHeight="1080" d:DesignWidth="1920" Background="Transparent" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/packages.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/packages.config index efdb0fb1c..d8e0c7e97 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/packages.config +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/packages.config @@ -1,6 +1,8 @@  + + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioViewModel.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioViewModel.cs index 63ff2119a..9ce79703f 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioViewModel.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioViewModel.cs @@ -109,7 +109,10 @@ namespace Tango.MachineStudio.Common /// Called when the view has been attached /// /// The view. - protected abstract void OnViewAttached(TView view); + protected virtual void OnViewAttached(TView view) + { + //Do Nothing. + } } } -- cgit v1.3.1