From bfc6aeabda4b320f9365f5eef4c8f1bcab9b24af Mon Sep 17 00:00:00 2001 From: Roy Date: Sat, 27 Jan 2018 22:57:48 +0200 Subject: Added IDS_PACK_FORMULA. Added necessary login to machine designer & db module. Started working on job segments. --- .../Tango.MachineStudio.Developer/Images/ruler.png | Bin 0 -> 1110 bytes .../Images/segment-single.png | Bin 0 -> 535 bytes .../Images/segment.png | Bin 0 -> 1610 bytes .../Tango.MachineStudio.Developer.csproj | 9 ++ .../ViewModels/MainViewVM.cs | 104 ++++++++++++++++++++- .../Views/MainView.xaml | 86 +++++++++++++++++ 6 files changed, 198 insertions(+), 1 deletion(-) create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/ruler.png create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/segment-single.png create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/segment.png (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/ruler.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/ruler.png new file mode 100644 index 000000000..173e4c204 Binary files /dev/null and b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/ruler.png differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/segment-single.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/segment-single.png new file mode 100644 index 000000000..016666122 Binary files /dev/null and b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/segment-single.png differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/segment.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/segment.png new file mode 100644 index 000000000..d0f85b83f Binary files /dev/null and b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/segment.png differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj index 970556986..71527d1dc 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj @@ -188,5 +188,14 @@ + + + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs index 8f3d2a7e3..e77093eee 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs @@ -106,7 +106,22 @@ namespace Tango.MachineStudio.Developer.ViewModels public Job SelectedJob { get { return _selectedJob; } - set { _selectedJob = value; RaisePropertyChangedAuto(); } + set + { + _selectedJob = value; + RaisePropertyChangedAuto(); + OnSelectedJobChanged(); + } + } + + private Segment _selectedSegment; + /// + /// Gets or sets the job selected segment. + /// + public Segment SelectedSegment + { + get { return _selectedSegment; } + set { _selectedSegment = value; RaisePropertyChangedAuto(); } } private Rml _selectedRML; @@ -184,6 +199,26 @@ namespace Tango.MachineStudio.Developer.ViewModels /// public RelayCommand SaveLiquidFactorsCommand { get; set; } + /// + /// Gets or sets the add segment command. + /// + public RelayCommand AddSegmentCommand { get; set; } + + /// + /// Gets or sets the remove segment command. + /// + public RelayCommand RemoveSegmentCommand { get; set; } + + /// + /// Gets or sets the add job command. + /// + public RelayCommand AddJobCommand { get; set; } + + /// + /// Gets or sets the remove job command. + /// + public RelayCommand RemoveJobCommand { get; set; } + #endregion #region Constructors @@ -219,6 +254,10 @@ namespace Tango.MachineStudio.Developer.ViewModels ToggleSideBarCommand = new RelayCommand(() => IsSideBarOpened = !IsSideBarOpened); SaveProcessParametersCommand = new RelayCommand(SaveProcessParameters); SaveLiquidFactorsCommand = new RelayCommand(SaveLiquidFactors); + AddSegmentCommand = new RelayCommand(AddSegment); + RemoveSegmentCommand = new RelayCommand(RemoveSegment); + AddJobCommand = new RelayCommand(AddJob); + RemoveJobCommand = new RelayCommand(RemoveJob); } #endregion @@ -239,6 +278,17 @@ namespace Tango.MachineStudio.Developer.ViewModels #region Virtual Methods + /// + /// Called when the selected job has been changed. + /// + private void OnSelectedJobChanged() + { + if (SelectedJob != null) + { + SelectedSegment = SelectedJob.Segments.FirstOrDefault(); + } + } + /// /// Called when the selected group history has been changed /// @@ -358,6 +408,58 @@ namespace Tango.MachineStudio.Developer.ViewModels } } + /// + /// Removes the selected segment. + /// + private void RemoveSegment() + { + if (SelectedJob != null && SelectedSegment != null) + { + SelectedSegment.DefferedDelete(); + SelectedJob.Segments.Remove(SelectedSegment); + } + } + + /// + /// Adds a new segment. + /// + private void AddSegment() + { + if (SelectedJob != null) + { + Segment seg = new Segment(); + seg.Name = "New Seg"; + SelectedJob.Segments.Add(seg); + } + } + + /// + /// Removes the selected job. + /// + private void RemoveJob() + { + if (SelectedMachine != null && SelectedJob != null) + { + SelectedJob.Delete(); + SelectedMachine.Jobs.Remove(SelectedJob); + } + } + + /// + /// Adds a new job to the selected machine. + /// + private void AddJob() + { + if (SelectedMachine != null) + { + SelectedMachine.Jobs.Add(new Job() + { + Name = "New Job", + CreationDate = DateTime.UtcNow, + }); + } + } + #endregion #region Public Events diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml index 243165cd5..b971d9124 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml @@ -398,6 +398,14 @@ + + + + @@ -425,6 +433,10 @@ + + + + @@ -494,7 +506,81 @@ + + + + + + + + + + + + + SEGMENTS + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name + + + + + + + + + Length + + + + + + + + + + + + + + -- cgit v1.3.1