From 3234e33cc4ba354f0395bb514b8b2fa102cf38ec Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Sun, 21 Jan 2018 15:56:57 +0200 Subject: Started working on Developer module. --- .../ViewModelLocator.cs | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModelLocator.cs (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModelLocator.cs') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModelLocator.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModelLocator.cs new file mode 100644 index 000000000..f11cee8d0 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModelLocator.cs @@ -0,0 +1,31 @@ +using GalaSoft.MvvmLight; +using GalaSoft.MvvmLight.Ioc; +using Microsoft.Practices.ServiceLocation; +using Tango.MachineStudio.Developer.ViewModels; + +namespace Tango.MachineStudio.Developer +{ + /// + /// This class contains static references to all the view models in the + /// application and provides an entry point for the bindings. + /// + public static class ViewModelLocator + { + /// + /// Initializes a new instance of the ViewModelLocator class. + /// + static ViewModelLocator() + { + ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default); + SimpleIoc.Default.Register(); + } + + public static MainViewVM MainViewVM + { + get + { + return ServiceLocator.Current.GetInstance(); + } + } + } +} \ No newline at end of file -- cgit v1.3.1 From a89c18abf7175f76f8673c12dac35d1658209d4e Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Thu, 1 Feb 2018 15:20:37 +0200 Subject: Added Developer Module Settings & More... --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 8388608 -> 8388608 bytes .../Tango.MachineStudio.Developer.csproj | 5 + .../ViewModelLocator.cs | 3 + .../ViewModels/MainViewVM.cs | 138 +++++- .../Views/IMainView.cs | 13 + .../Views/MainView.xaml | 463 +++++++++++++++------ .../Views/MainView.xaml.cs | 10 +- .../Observables/ObservableEntity.cs | 16 +- .../Tango.Integration/Printing/LiquidVolume.cs | 10 +- .../MachineStudioSettings/DeveloperModule.cs | 17 + .../MachineStudioSettings/MachineStudio.cs | 6 + .../Tango.Settings/Tango.Settings.csproj | 1 + Software/Visual_Studio/Tango.SharedUI/ViewModel.cs | 1 + 14 files changed, 544 insertions(+), 139 deletions(-) create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/IMainView.cs create mode 100644 Software/Visual_Studio/Tango.Settings/MachineStudioSettings/DeveloperModule.cs (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModelLocator.cs') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index 1f93351b8..126a778e9 100644 Binary files a/Software/DB/Tango.mdf and b/Software/DB/Tango.mdf differ diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf index 04a1123e6..88f63972a 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf 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 3b72c4971..9696f47ca 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 @@ -89,6 +89,7 @@ + MainView.xaml @@ -158,6 +159,10 @@ {4206ac58-3b57-4699-8835-90bf6db01a61} Tango.Integration + + {D8F1AD85-526A-4F50-B6DC-D437AF63D8D8} + Tango.Settings + {8491d07b-c1f6-4b62-a412-41b9fd2d6538} Tango.SharedUI diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModelLocator.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModelLocator.cs index f11cee8d0..46c7ecf00 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModelLocator.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModelLocator.cs @@ -2,6 +2,7 @@ using GalaSoft.MvvmLight; using GalaSoft.MvvmLight.Ioc; using Microsoft.Practices.ServiceLocation; using Tango.MachineStudio.Developer.ViewModels; +using Tango.MachineStudio.Developer.Views; namespace Tango.MachineStudio.Developer { @@ -17,6 +18,8 @@ namespace Tango.MachineStudio.Developer static ViewModelLocator() { ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default); + + SimpleIoc.Default.Register(() => MainView.Self); SimpleIoc.Default.Register(); } 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 4f7447253..a9e71de5a 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 @@ -16,6 +16,8 @@ using Tango.MachineStudio.Common.StudioApplication; using Tango.SharedUI; using System.Runtime.CompilerServices; using System.Windows.Threading; +using Tango.Settings; +using Tango.MachineStudio.Developer.Views; namespace Tango.MachineStudio.Developer.ViewModels { @@ -23,9 +25,10 @@ namespace Tango.MachineStudio.Developer.ViewModels /// Represents the developer module main view, view model. /// /// - public class MainViewVM : ViewModel, IShutdownRequestBlocker + public class MainViewVM : ViewModel, IShutdownRequestBlocker { private INotificationProvider _notification; + private TimeSpan _runningJobEstimatedDuration; #region Properties @@ -233,6 +236,56 @@ namespace Tango.MachineStudio.Developer.ViewModels set { _runningJobProgress = value; RaisePropertyChangedAuto(); } } + private TimeSpan _runningJobRemainingTime; + /// + /// Gets or sets the job remaining time. + /// + public TimeSpan RunningJobRemainingTime + { + get { return _runningJobRemainingTime; } + set { _runningJobRemainingTime = value; RaisePropertyChangedAuto(); } + } + + private bool _isJobCompleted; + /// + /// Gets or sets a value indicating whether the running job has completed successfully. + /// + public bool IsJobCompleted + { + get { return _isJobCompleted; } + set { _isJobCompleted = value; RaisePropertyChangedAuto(); } + } + + private bool _isJobFailed; + /// + /// Gets or sets a value indicating whether the running job has failed. + /// + public bool IsJobFailed + { + get { return _isJobFailed; } + set { _isJobFailed = value; RaisePropertyChangedAuto(); } + } + + private bool _showJobStatus; + /// + /// Gets or sets a value indicating whether to show all the relevant job status areas. + /// + public bool ShowJobStatus + { + get { return _showJobStatus; } + set { _showJobStatus = value; RaisePropertyChangedAuto(); } + } + + private bool _isJobCanceled; + /// + /// Gets or sets a value indicating whether the last running job was canceled. + /// + public bool IsJobCanceled + { + get { return _isJobCanceled; } + set { _isJobCanceled = value; RaisePropertyChangedAuto(); } + } + #endregion #region Commands @@ -307,6 +360,11 @@ namespace Tango.MachineStudio.Developer.ViewModels /// public RelayCommand StopJobCommand { get; set; } + /// + /// Gets or sets the close job completion status command. + /// + public RelayCommand CloseJobCompletionStatusCommand { get; set; } + #endregion #region Constructors @@ -314,7 +372,7 @@ namespace Tango.MachineStudio.Developer.ViewModels /// /// Initializes a new instance of the class. /// - public MainViewVM() + public MainViewVM(IMainView view) : base(view, true) { IsSideBarOpened = true; @@ -333,7 +391,7 @@ namespace Tango.MachineStudio.Developer.ViewModels /// The application manager. /// The notification provider. [PreferredConstructor] - public MainViewVM(IStudioApplicationManager applicationManager, INotificationProvider notificationProvider) : this() + public MainViewVM(IStudioApplicationManager applicationManager, INotificationProvider notificationProvider, IMainView view) : this(view) { _notification = notificationProvider; ApplicationManager = applicationManager; @@ -353,6 +411,7 @@ namespace Tango.MachineStudio.Developer.ViewModels SaveJobsCommand = new RelayCommand(SaveJobs, () => SelectedMachine != null); StartJobCommand = new RelayCommand(StartJob, () => SelectedJob != null && !IsJobRunning); StopJobCommand = new RelayCommand(StopJob, () => IsJobRunning); + CloseJobCompletionStatusCommand = new RelayCommand(CloseJobCompletionStatusBar); } #endregion @@ -467,29 +526,57 @@ namespace Tango.MachineStudio.Developer.ViewModels #region Private Methods + private void CloseJobCompletionStatusBar() + { + IsJobCompleted = false; + IsJobFailed = false; + IsJobCanceled = false; + ShowJobStatus = false; + RunningJob = null; + } + private void StopJob() { - RunningJobProgress = 0; IsJobRunning = false; - RunningJob = null; + IsJobCanceled = true; + } + + private void CompleteJob() + { + IsJobRunning = false; + IsJobCompleted = true; } private void StartJob() { + RunningJobRemainingTime = TimeSpan.Zero; + RunningJobProgress = 0; + IsJobFailed = false; + IsJobCanceled = false; + IsJobCompleted = false; IsJobRunning = true; + ShowJobStatus = true; RunningJob = SelectedJob; + _runningJobEstimatedDuration = EstimatedDuration; DispatcherTimer timer = new DispatcherTimer(); - timer.Interval = TimeSpan.FromSeconds(0.1); + timer.Interval = TimeSpan.FromSeconds(0.03); timer.Tick += (x, y) => { - if (RunningJob == null || RunningJobProgress >= RunningJob.Length) + RunningJobRemainingTime = _runningJobEstimatedDuration - TimeSpan.FromSeconds(RunningJobProgress / (SelectedProcessParametersTable.DyeingSpeed / 100d)); + RunningJobProgress += 0.03; + + if (!IsJobRunning) + { + timer.Stop(); + return; + } + else if (RunningJobProgress >= RunningJob.Length) { timer.Stop(); - StopJob(); + CompleteJob(); return; } - RunningJobProgress += 0.1; }; timer.Start(); @@ -497,11 +584,11 @@ namespace Tango.MachineStudio.Developer.ViewModels private async void SaveJobs() { - if (SelectedMachine != null) + if (SelectedJob != null) { using (_notification.PushTaskItem("Saving machine jobs...")) { - await SelectedMachine.SaveAsync(); + await SelectedJob.SaveAsync(); } } } @@ -806,9 +893,38 @@ namespace Tango.MachineStudio.Developer.ViewModels return Task.FromResult(false); } + SettingsManager.Default.MachineStudio.DeveloperModule.LastSelectedMachineGuid = SelectedMachine != null ? SelectedMachine.Guid : null; + SettingsManager.Default.MachineStudio.DeveloperModule.LastSelectedRMLGuid = SelectedRML != null ? SelectedRML.Guid : null; + SettingsManager.Default.MachineStudio.DeveloperModule.LastSelectedJobGuid = SelectedJob != null ? SelectedJob.Guid : null; + SettingsManager.SaveDefaultSettings(); + return Task.FromResult(true); } #endregion + + #region IMainView + + protected override void OnViewAttached() + { + base.OnViewAttached(); + + if (SettingsManager.Default.MachineStudio.DeveloperModule.LastSelectedMachineGuid != null) + { + SelectedMachine = Adapter.Machines.SingleOrDefault(x => x.Guid == SettingsManager.Default.MachineStudio.DeveloperModule.LastSelectedMachineGuid); + } + + if (SettingsManager.Default.MachineStudio.DeveloperModule.LastSelectedRMLGuid != null) + { + SelectedRML = Adapter.Rmls.SingleOrDefault(x => x.Guid == SettingsManager.Default.MachineStudio.DeveloperModule.LastSelectedRMLGuid); + } + + if (SettingsManager.Default.MachineStudio.DeveloperModule.LastSelectedJobGuid != null && SelectedMachine != null) + { + SelectedJob = SelectedMachine.Jobs.SingleOrDefault(x => x.Guid == SettingsManager.Default.MachineStudio.DeveloperModule.LastSelectedJobGuid); + } + } + + #endregion } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/IMainView.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/IMainView.cs new file mode 100644 index 000000000..17a59a761 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/IMainView.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.SharedUI; + +namespace Tango.MachineStudio.Developer.Views +{ + public interface IMainView : IView + { + } +} 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 5dbb8604b..b2d553ff2 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 @@ -27,6 +27,7 @@ + @@ -166,145 +167,313 @@ - - - - - - - - - + + + + + + + + + + + - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - + + - - + + - - + + - - + + - - + + - - + + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - - - + + - - + + + + + + + + + + + + + Job Completed Successfully + + + + + + + + + + + + + + + + + + + + + + + Job Failed To Complete + + + + + + + + + + + + + + + + + + + + + + + + + Job Aborted By User + + + + + + + + + + + + + @@ -1243,6 +1412,64 @@ + + + + + + + + + + + + + Job Status + + + + + + + + + + + + + + + + + + + + + @@ -1441,7 +1668,7 @@ - + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Controls/IOMonitorControl.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Controls/IOMonitorControl.xaml.cs new file mode 100644 index 000000000..bc408958d --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Controls/IOMonitorControl.xaml.cs @@ -0,0 +1,109 @@ +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; +using Tango.Core.Commands; + +namespace Tango.MachineStudio.Developer.Controls +{ + /// + /// Interaction logic for IOMonitorControl.xaml + /// + public partial class IOMonitorControl : UserControl + { + public ICommand ForwardPressedCommand + { + get { return (ICommand)GetValue(ForwardPressedCommandProperty); } + set { SetValue(ForwardPressedCommandProperty, value); } + } + public static readonly DependencyProperty ForwardPressedCommandProperty = + DependencyProperty.Register("ForwardPressedCommand", typeof(ICommand), typeof(IOMonitorControl), new PropertyMetadata(null)); + + public ICommand ForwardReleasedCommand + { + get { return (ICommand)GetValue(ForwardReleasedCommandProperty); } + set { SetValue(ForwardReleasedCommandProperty, value); } + } + public static readonly DependencyProperty ForwardReleasedCommandProperty = + DependencyProperty.Register("ForwardReleasedCommand", typeof(ICommand), typeof(IOMonitorControl), new PropertyMetadata(null)); + + public ICommand BackwardPressedCommand + { + get { return (ICommand)GetValue(BackwardPressedCommandProperty); } + set { SetValue(BackwardPressedCommandProperty, value); } + } + public static readonly DependencyProperty BackwardPressedCommandProperty = + DependencyProperty.Register("BackwardPressedCommand", typeof(ICommand), typeof(IOMonitorControl), new PropertyMetadata(null)); + + public ICommand BackwardReleasedCommand + { + get { return (ICommand)GetValue(BackwardReleasedCommandProperty); } + set { SetValue(BackwardReleasedCommandProperty, value); } + } + public static readonly DependencyProperty BackwardReleasedCommandProperty = + DependencyProperty.Register("BackwardReleasedCommand", typeof(ICommand), typeof(IOMonitorControl), new PropertyMetadata(null)); + + public object CommandParameter + { + get { return (object)GetValue(CommandParameterProperty); } + set { SetValue(CommandParameterProperty, value); } + } + public static readonly DependencyProperty CommandParameterProperty = + DependencyProperty.Register("CommandParameter", typeof(object), typeof(IOMonitorControl), new PropertyMetadata(null)); + + public String Value + { + get { return (String)GetValue(ValueProperty); } + set { SetValue(ValueProperty, value); } + } + public static readonly DependencyProperty ValueProperty = + DependencyProperty.Register("Value", typeof(String), typeof(IOMonitorControl), new PropertyMetadata("0000")); + + public IOMonitorControl() + { + InitializeComponent(); + } + + private void OnForwardPressed(object sender, MouseButtonEventArgs e) + { + if (ForwardPressedCommand != null) + { + ForwardPressedCommand.Execute(CommandParameter); + } + } + + private void OnForwardReleased(object sender, MouseButtonEventArgs e) + { + if (ForwardReleasedCommand != null) + { + ForwardReleasedCommand.Execute(CommandParameter); + } + } + + private void OnBackwardPressed(object sender, MouseButtonEventArgs e) + { + if (BackwardPressedCommand != null) + { + BackwardPressedCommand.Execute(CommandParameter); + } + } + + private void OnBackwardReleased(object sender, MouseButtonEventArgs e) + { + if (BackwardReleasedCommand != null) + { + BackwardReleasedCommand.Execute(CommandParameter); + } + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/black-screen.jpg b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/black-screen.jpg new file mode 100644 index 000000000..7ed5c3eb2 Binary files /dev/null and b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/black-screen.jpg 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 4ef73a918..722d8efe6 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 @@ -90,6 +90,9 @@ + + IOMonitorControl.xaml + @@ -108,7 +111,9 @@ + + MainView.xaml @@ -116,6 +121,13 @@ GlobalVersionInfo.cs + + MonitoringView.xaml + + + Designer + MSBuild:Compile + MSBuild:Compile Designer @@ -124,6 +136,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + @@ -267,5 +283,8 @@ + + + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModelLocator.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModelLocator.cs index 46c7ecf00..200c89e19 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModelLocator.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModelLocator.cs @@ -21,6 +21,7 @@ namespace Tango.MachineStudio.Developer SimpleIoc.Default.Register(() => MainView.Self); SimpleIoc.Default.Register(); + SimpleIoc.Default.Register(); } public static MainViewVM MainViewVM @@ -30,5 +31,13 @@ namespace Tango.MachineStudio.Developer return ServiceLocator.Current.GetInstance(); } } + + public static MonitoringViewVM MonitoringViewVM + { + get + { + return ServiceLocator.Current.GetInstance(); + } + } } } \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/IOVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/IOVM.cs new file mode 100644 index 000000000..83eee1333 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/IOVM.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core; +using Tango.Integration.Observables; + +namespace Tango.MachineStudio.Developer.ViewModels +{ + public class IOVM : ExtendedObject + { + private Io _io; + public Io IO + { + get { return _io; } + set { _io = value; RaisePropertyChangedAuto(); } + } + + private String _name; + public String Name + { + get { return _name; } + set { _name = value; } + } + + private bool _index; + public bool Index + { + get { return _index; } + set { _index = value; } + } + + private double _value; + public double Value + { + get { return _value; } + set { _value = value; RaisePropertyChanged(nameof(Value)); } + } + + public IOVM(Io io, String name) + { + IO = io; + Name = name; + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MonitoringViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MonitoringViewVM.cs new file mode 100644 index 000000000..8edbd7b83 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MonitoringViewVM.cs @@ -0,0 +1,93 @@ +using Google.Protobuf.Collections; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +using Tango.Integration.Observables; +using Tango.Integration.Services; +using Tango.MachineStudio.Common.StudioApplication; +using Tango.PMR.Diagnostics; +using Tango.SharedUI; + +namespace Tango.MachineStudio.Developer.ViewModels +{ + public class MonitoringViewVM : ViewModel + { + private ObservableCollection _availableControllers; + public ObservableCollection AvailableControllers + { + get { return _availableControllers; } + set { _availableControllers = value; } + } + + private ObservableCollection _controllers; + public ObservableCollection Controllers + { + get { return _controllers; } + set { _controllers = value; } + } + + private ObservablesEntitiesAdapter _adapter; + public ObservablesEntitiesAdapter Adapter + { + get { return _adapter; } + set { _adapter = value; } + } + + public IStudioApplicationManager ApplicationManager { get; set; } + + public MonitoringViewVM(IStudioApplicationManager applicationManager) + { + ApplicationManager = applicationManager; + ApplicationManager.ConnectedMachineChanged += ApplicationManager_ConnectedMachineChanged; + + if (!this.DesignMode) + { + Adapter = ObservablesEntitiesAdapter.Instance; + AvailableControllers = Adapter.Ios.Select(x => new IOVM(x, x.Name)).ToObservableCollection(); + } + + Controllers = new ObservableCollection(); + } + + private void ApplicationManager_ConnectedMachineChanged(object sender, IExternalBridgeClient machine) + { + if (machine != null) + { + machine.DiagnosticsDataAvailable -= Machine_DiagnosticsDataAvailable; + machine.DiagnosticsDataAvailable += Machine_DiagnosticsDataAvailable; + } + } + + private void Machine_DiagnosticsDataAvailable(object sender, PushDiagnosticsResponse data) + { + foreach (var prop in data.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance)) + { + IOVM controller = _controllers.SingleOrDefault(x => x.IO.Name == prop.Name); + + if (controller != null) + { + if (!controller.IO.MultiChannel) + { + RepeatedField arr = prop.GetValue(data) as RepeatedField; + controller.Value = arr.Last(); + } + else + { + //DoubleArray[] arrayOfDoubles = Enumerable.ToArray(prop.GetValue(data) as IEnumerable); + //(controller as GraphMultiController).PushData(arrayOfDoubles.Select(x => x.Data.ToList()).ToList()); + } + } + } + } + + public void OnDropAvailableIO(IOVM ioVM) + { + Controllers.Add(ioVM); + AvailableControllers.Remove(ioVM); + } + } +} 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 cdfef3b0d..1ef6928f5 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 @@ -1987,7 +1987,8 @@ - MONITORING + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MonitoringView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MonitoringView.xaml new file mode 100644 index 000000000..bd78ef13e --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MonitoringView.xaml @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AVAILABLE IO'S + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MonitoringView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MonitoringView.xaml.cs new file mode 100644 index 000000000..0d649237e --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MonitoringView.xaml.cs @@ -0,0 +1,50 @@ +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; +using Tango.DragAndDrop; +using Tango.MachineStudio.Developer.ViewModels; + +namespace Tango.MachineStudio.Developer.Views +{ + /// + /// Interaction logic for MonitoringView.xaml + /// + public partial class MonitoringView : UserControl + { + private MonitoringViewVM _vm; + + public DraggingSurface DraggingSurface + { + get { return (DraggingSurface)GetValue(DraggingSurfaceProperty); } + set { SetValue(DraggingSurfaceProperty, value); } + } + public static readonly DependencyProperty DraggingSurfaceProperty = + DependencyProperty.Register("DraggingSurface", typeof(DraggingSurface), typeof(MonitoringView), new PropertyMetadata(null)); + + public MonitoringView() + { + InitializeComponent(); + DraggingSurface = draggingSurface; + this.Loaded += (x, y) => + { + _vm = this.DataContext as MonitoringViewVM; + }; + } + + private void OnDropAvailableIO(object sender, DropEventArgs e) + { + _vm.OnDropAvailableIO(e.Draggable.DataContext as IOVM); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Resources/MaterialDesign.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Resources/MaterialDesign.xaml index 704505b2f..5c218f429 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Resources/MaterialDesign.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Resources/MaterialDesign.xaml @@ -376,6 +376,19 @@ + + diff --git a/Software/Visual_Studio/Tango.Integration/Observables/Enumerations/IOType.cs b/Software/Visual_Studio/Tango.Integration/Observables/Enumerations/IOType.cs index 472da1ced..5a6166295 100644 --- a/Software/Visual_Studio/Tango.Integration/Observables/Enumerations/IOType.cs +++ b/Software/Visual_Studio/Tango.Integration/Observables/Enumerations/IOType.cs @@ -12,5 +12,6 @@ namespace Tango.Integration.Observables.Enumerations Input = 1, Output = 2, InputOutput = 3, + Switch = 4, } } diff --git a/Software/Visual_Studio/Tango.Settings/MachineStudioSettings/MachineStudio.cs b/Software/Visual_Studio/Tango.Settings/MachineStudioSettings/MachineStudio.cs index 70199d0ef..0cb35199f 100644 --- a/Software/Visual_Studio/Tango.Settings/MachineStudioSettings/MachineStudio.cs +++ b/Software/Visual_Studio/Tango.Settings/MachineStudioSettings/MachineStudio.cs @@ -60,10 +60,10 @@ namespace Tango.Settings.MachineStudioSettings { LoggingCategories = new List(); - LoggingCategories.Add(LogCategory.Critical); - LoggingCategories.Add(LogCategory.Error); - LoggingCategories.Add(LogCategory.General); - LoggingCategories.Add(LogCategory.Warning); + //LoggingCategories.Add(LogCategory.Critical); + //LoggingCategories.Add(LogCategory.Error); + //LoggingCategories.Add(LogCategory.General); + //LoggingCategories.Add(LogCategory.Warning); SynchronizationModule = new SynchronizationModule(); StubsModule = new StubsModule(); diff --git a/Software/Visual_Studio/Utilities/Tango.UITests/MainWindow.xaml b/Software/Visual_Studio/Utilities/Tango.UITests/MainWindow.xaml index 5a396f643..aae846742 100644 --- a/Software/Visual_Studio/Utilities/Tango.UITests/MainWindow.xaml +++ b/Software/Visual_Studio/Utilities/Tango.UITests/MainWindow.xaml @@ -6,9 +6,17 @@ xmlns:local="clr-namespace:Tango.UITests" xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" xmlns:common="clr-namespace:Tango.MachineStudio.Common.Controls;assembly=Tango.MachineStudio.Common" + xmlns:developer="clr-namespace:Tango.MachineStudio.Developer.Controls;assembly=Tango.MachineStudio.Developer" mc:Ignorable="d" Title="MainWindow" Height="324.369" Width="584.217"> + + + + + - + + + diff --git a/Software/Visual_Studio/Utilities/Tango.UITests/MainWindow.xaml.cs b/Software/Visual_Studio/Utilities/Tango.UITests/MainWindow.xaml.cs index be8299d76..7ee31f982 100644 --- a/Software/Visual_Studio/Utilities/Tango.UITests/MainWindow.xaml.cs +++ b/Software/Visual_Studio/Utilities/Tango.UITests/MainWindow.xaml.cs @@ -22,6 +22,7 @@ namespace Tango.UITests { public MainWindow() { + Tango.MachineStudio.Common.IStudioModule s; InitializeComponent(); } } diff --git a/Software/Visual_Studio/Utilities/Tango.UITests/Tango.UITests.csproj b/Software/Visual_Studio/Utilities/Tango.UITests/Tango.UITests.csproj index 24d005822..3938ff915 100644 --- a/Software/Visual_Studio/Utilities/Tango.UITests/Tango.UITests.csproj +++ b/Software/Visual_Studio/Utilities/Tango.UITests/Tango.UITests.csproj @@ -94,6 +94,14 @@ + + {94f7acf8-55e1-4a02-b9bc-a818413fdbbf} + Tango.MachineStudio.DB + + + {ce4a0d11-08a2-4cd6-9908-d6c62e80d805} + Tango.MachineStudio.Developer + {cb0b0aa2-bb24-4bca-a720-45e397684e12} Tango.MachineStudio.Common -- cgit v1.3.1 From a84ca3e4bee123600c08f8897eca5be83b3ffcf8 Mon Sep 17 00:00:00 2001 From: Roy Date: Sun, 11 Feb 2018 21:46:22 +0200 Subject: Added TechView for Developer.. --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 8388608 -> 8388608 bytes .../Tango.MachineStudio.Developer.csproj | 12 +-- .../ViewModelLocator.cs | 9 -- .../ViewModels/MainViewVM.cs | 13 +++ .../ViewModels/MonitoringViewVM.cs | 93 --------------------- .../Views/MainView.xaml | 5 +- .../Views/MonitoringView.xaml | 76 ----------------- .../Views/MonitoringView.xaml.cs | 50 ----------- .../ViewModels/MachineTechViewVM.cs | 25 +++++- .../Views/MachineTechView.xaml | 4 +- 11 files changed, 43 insertions(+), 244 deletions(-) delete mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MonitoringViewVM.cs delete mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MonitoringView.xaml delete mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MonitoringView.xaml.cs (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModelLocator.cs') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index f5fa222f5..c9638a21b 100644 Binary files a/Software/DB/Tango.mdf and b/Software/DB/Tango.mdf differ diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf index 24d2a1669..73277102d 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf 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 722d8efe6..43ebc515d 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 @@ -113,7 +113,6 @@ - MainView.xaml @@ -121,9 +120,6 @@ GlobalVersionInfo.cs - - MonitoringView.xaml - Designer MSBuild:Compile @@ -136,10 +132,6 @@ Designer MSBuild:Compile - - Designer - MSBuild:Compile - @@ -227,6 +219,10 @@ {d0ce8122-077d-42a2-9490-028ae4769b52} Tango.MachineStudio.MachineDesigner + + {5d39c1e1-3ecd-4634-bd1b-2bcf71c54a15} + Tango.MachineStudio.Technician + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModelLocator.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModelLocator.cs index 200c89e19..46c7ecf00 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModelLocator.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModelLocator.cs @@ -21,7 +21,6 @@ namespace Tango.MachineStudio.Developer SimpleIoc.Default.Register(() => MainView.Self); SimpleIoc.Default.Register(); - SimpleIoc.Default.Register(); } public static MainViewVM MainViewVM @@ -31,13 +30,5 @@ namespace Tango.MachineStudio.Developer return ServiceLocator.Current.GetInstance(); } } - - public static MonitoringViewVM MonitoringViewVM - { - get - { - return ServiceLocator.Current.GetInstance(); - } - } } } \ 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 d6c127b1f..f9ec5b063 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 @@ -28,6 +28,7 @@ using Tango.Transport; using Tango.Integration.Printing; using Tango.Integration.Diagnostics; using Microsoft.Win32; +using Tango.MachineStudio.Technician.ViewModels; namespace Tango.MachineStudio.Developer.ViewModels { @@ -344,6 +345,16 @@ namespace Tango.MachineStudio.Developer.ViewModels set { _fullScreenGraph = value; RaisePropertyChangedAuto(); } } + private MachineTechViewVM _machineTechViewVM; + /// + /// Gets or sets the machine tech view models. + /// + public MachineTechViewVM MachineTechViewVM + { + get { return _machineTechViewVM; } + set { _machineTechViewVM = value; RaisePropertyChangedAuto(); } + } + #endregion #region Commands @@ -535,6 +546,8 @@ namespace Tango.MachineStudio.Developer.ViewModels ToggleCameraCommand = new RelayCommand(ToggleCamera); ApplicationManager.ConnectedMachineChanged += ApplicationManager_ConnectedMachineChanged; + + MachineTechViewVM = new MachineTechViewVM(applicationManager, notificationProvider, false); } #endregion diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MonitoringViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MonitoringViewVM.cs deleted file mode 100644 index 99fbc5114..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MonitoringViewVM.cs +++ /dev/null @@ -1,93 +0,0 @@ -using Google.Protobuf.Collections; -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Threading.Tasks; -using Tango.Integration.Observables; -using Tango.Integration.Services; -using Tango.MachineStudio.Common.StudioApplication; -using Tango.PMR.Diagnostics; -using Tango.SharedUI; - -namespace Tango.MachineStudio.Developer.ViewModels -{ - public class MonitoringViewVM : ViewModel - { - private ObservableCollection _availableControllers; - public ObservableCollection AvailableControllers - { - get { return _availableControllers; } - set { _availableControllers = value; } - } - - private ObservableCollection _controllers; - public ObservableCollection Controllers - { - get { return _controllers; } - set { _controllers = value; } - } - - private ObservablesEntitiesAdapter _adapter; - public ObservablesEntitiesAdapter Adapter - { - get { return _adapter; } - set { _adapter = value; } - } - - public IStudioApplicationManager ApplicationManager { get; set; } - - public MonitoringViewVM(IStudioApplicationManager applicationManager) - { - ApplicationManager = applicationManager; - ApplicationManager.ConnectedMachineChanged += ApplicationManager_ConnectedMachineChanged; - - if (!this.DesignMode) - { - Adapter = ObservablesEntitiesAdapter.Instance; - AvailableControllers = Adapter.TechMonitors.Select(x => new IOVM(x, x.Name)).ToObservableCollection(); - } - - Controllers = new ObservableCollection(); - } - - private void ApplicationManager_ConnectedMachineChanged(object sender, IExternalBridgeClient machine) - { - if (machine != null) - { - machine.DiagnosticsDataAvailable -= Machine_DiagnosticsDataAvailable; - machine.DiagnosticsDataAvailable += Machine_DiagnosticsDataAvailable; - } - } - - private void Machine_DiagnosticsDataAvailable(object sender, PushDiagnosticsResponse data) - { - foreach (var prop in data.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance)) - { - IOVM controller = _controllers.SingleOrDefault(x => x.IO.Name == prop.Name); - - if (controller != null) - { - if (!controller.IO.MultiChannel) - { - RepeatedField arr = prop.GetValue(data) as RepeatedField; - controller.Value = arr.Last(); - } - else - { - //DoubleArray[] arrayOfDoubles = Enumerable.ToArray(prop.GetValue(data) as IEnumerable); - //(controller as GraphMultiController).PushData(arrayOfDoubles.Select(x => x.Data.ToList()).ToList()); - } - } - } - } - - public void OnDropAvailableIO(IOVM ioVM) - { - Controllers.Add(ioVM); - AvailableControllers.Remove(ioVM); - } - } -} 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 4cbae2941..cd5cdb8a2 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 @@ -7,6 +7,7 @@ xmlns:global="clr-namespace:Tango.MachineStudio.Developer" xmlns:dragAndDrop="clr-namespace:Tango.DragAndDrop;assembly=Tango.DragAndDrop" xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:techViews="clr-namespace:Tango.MachineStudio.Technician.Views;assembly=Tango.MachineStudio.Technician" xmlns:colorPicker="clr-namespace:Tango;assembly=Tango.ColorPicker" xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:db="clr-namespace:Tango.MachineStudio.DB.Views.DBViews;assembly=Tango.MachineStudio.DB" @@ -1988,7 +1989,7 @@ - + @@ -2147,7 +2148,7 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Job Completed Successfully + + + + + + + + + + + + + + + + + + + + + + + Job Failed To Complete + + + + + + + + + + + + + + + + + + + + + + + + + Job Aborted By User + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + # + SEGMENT + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name + + + + + + + + + + Winding Method + + + + + + + + + + Inter Segment + + + + + + + + + + + + + Lubrication + + + + + + + + + + + + Description + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Length + + + + + + + + MEDIA + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LIQUID FACTORS ( Max Nanolitter/CM ) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SEGMENT BRUSH + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Color Space + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ESTIMATED DURATION: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SELECT MACHINE & MEDIA + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml.cs new file mode 100644 index 000000000..a030cf885 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml.cs @@ -0,0 +1,140 @@ +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; +using System.Windows.Threading; +using Tango.DragAndDrop; +using Tango.Integration.Observables; +using Tango.MachineStudio.Developer.Converters; +using Tango.MachineStudio.Developer.ViewModels; + +namespace Tango.MachineStudio.Developer.Views +{ + /// + /// Interaction logic for JobView.xaml + /// + public partial class JobView : UserControl + { + private MainViewVM _vm; + private DispatcherTimer _jobBrushTimer; + + public DraggingSurface DraggingSurface + { + get { return (DraggingSurface)GetValue(DraggingSurfaceProperty); } + set { SetValue(DraggingSurfaceProperty, value); } + } + public static readonly DependencyProperty DraggingSurfaceProperty = + DependencyProperty.Register("DraggingSurface", typeof(DraggingSurface), typeof(JobView), new PropertyMetadata(null)); + + public JobView() + { + InitializeComponent(); + + DraggingSurface = draggingSurface; + + this.Loaded += (x, y) => + { + _vm = DataContext as MainViewVM; + }; + + _jobBrushTimer = new DispatcherTimer(); + _jobBrushTimer.Interval = TimeSpan.FromSeconds(1); + _jobBrushTimer.Tick += _jobBrushTimer_Tick; + _jobBrushTimer.Start(); + } + + private void _jobBrushTimer_Tick(object sender, EventArgs e) + { + if (_vm != null && _vm.SelectedJob != null) + { + List segments = new List(); + foreach (var s in _vm.SelectedJob.Segments) + { + segments.Add(s); + + if (_vm.SelectedJob.EnableInterSegment && _vm.SelectedJob.Segments.IndexOf(s) != _vm.SelectedJob.Segments.Count - 1) + { + segments.Add(new Segment() + { + Length = _vm.SelectedJob.InterSegmentLength, + BrushStops = new System.Collections.ObjectModel.ObservableCollection() + { + new BrushStop() + { + Color = Colors.White, + } + }, + }); + } + } + + jobBrushList.ItemsSource = segments; + } + } + + private void OnDropAvailableGraph(object sender, DropEventArgs e) + { + if (e.Draggable.DataContext is TechMonitor) + { + _vm.OnDropAvailableGraph(e.Draggable.DataContext as TechMonitor); + } + } + + private void Offset_Slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs e) + { + UpdateGradientBrushDisplay(); + } + + private void UpdateGradientBrushDisplay() + { + if (_vm.SelectedSegment != null) + { + SegmentToGradientStopsConverter converter = new SegmentToGradientStopsConverter(); + GradientStopCollection stops = converter.Convert(_vm.SelectedSegment, null, null, null) as GradientStopCollection; + gradientBrush.GradientStops = stops; + } + else + { + gradientBrush.GradientStops = new GradientStopCollection(); + } + } + + private void OnBrushStopBorderDrop(object sender, DropEventArgs e) + { + if (e.Draggable.DataContext is BrushStop) + { + _vm.OnDropBrushStop(e.Draggable.DataContext as BrushStop, e.Droppable.DataContext as BrushStop); + } + } + + private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + UpdateGradientBrushDisplay(); + } + + private void OnJobStartClick(object sender, RoutedEventArgs e) + { + + } + + private void HiveColorPickerControl_SelectedColorChanged(object sender, Color e) + { + UpdateGradientBrushDisplay(); + } + + private void Popup_MouseDown(object sender, MouseButtonEventArgs e) + { + e.Handled = true; + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MachineJobSelectionView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MachineJobSelectionView.xaml new file mode 100644 index 000000000..998ba474d --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MachineJobSelectionView.xaml @@ -0,0 +1,202 @@ + + + + + + + + + + + + + + + + + TARGET MACHINE + + + + + + + + + + + + + + + + + + + + + + + MACHINE JOBS + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MachineJobSelectionView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MachineJobSelectionView.xaml.cs new file mode 100644 index 000000000..52786a59f --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MachineJobSelectionView.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.Developer.Views +{ + /// + /// Interaction logic for MachineJobSelectionView.xaml + /// + public partial class MachineJobSelectionView : UserControl + { + public MachineJobSelectionView() + { + InitializeComponent(); + } + } +} 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 240e3127c..442385731 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 @@ -583,7 +583,7 @@ - + @@ -2026,7 +2026,7 @@ - + diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Resources/MaterialDesign.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Resources/MaterialDesign.xaml index 5c218f429..9250d5aef 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Resources/MaterialDesign.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Resources/MaterialDesign.xaml @@ -354,7 +354,7 @@ - + diff --git a/Software/Visual_Studio/Tango.Core/Commands/RelayCommand.cs b/Software/Visual_Studio/Tango.Core/Commands/RelayCommand.cs index fecf8a5de..518b28669 100644 --- a/Software/Visual_Studio/Tango.Core/Commands/RelayCommand.cs +++ b/Software/Visual_Studio/Tango.Core/Commands/RelayCommand.cs @@ -17,6 +17,7 @@ namespace Tango.Core.Commands #region fields readonly Predicate canExecute; readonly Action execute; + private Func p; #endregion fields #region constructors diff --git a/Software/Visual_Studio/Tango.Core/ExtensionMethods/IServiceLocatorExtensions.cs b/Software/Visual_Studio/Tango.Core/ExtensionMethods/IServiceLocatorExtensions.cs index 3b5496578..23ca0a4db 100644 --- a/Software/Visual_Studio/Tango.Core/ExtensionMethods/IServiceLocatorExtensions.cs +++ b/Software/Visual_Studio/Tango.Core/ExtensionMethods/IServiceLocatorExtensions.cs @@ -31,6 +31,6 @@ public static class IServiceLocatorExtensions /// public static List GetAllInstancesByBase(this IServiceLocator locator) { - return locator.GetAllInstances().Where(x => typeof(T).IsAssignableFrom(x.GetType())).Select(x => (T)x).ToList(); + return locator.GetAllInstances().Where(x => x != null && typeof(T).IsAssignableFrom(x.GetType())).Select(x => (T)x).ToList(); } } diff --git a/Software/Visual_Studio/Tango.SharedUI/Converters/DateTimeUTCToShortDateTimeConverter.cs b/Software/Visual_Studio/Tango.SharedUI/Converters/DateTimeUTCToShortDateTimeConverter.cs new file mode 100644 index 000000000..7c51139e0 --- /dev/null +++ b/Software/Visual_Studio/Tango.SharedUI/Converters/DateTimeUTCToShortDateTimeConverter.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; + +namespace Tango.SharedUI.Converters +{ + public class DateTimeUTCToShortDateTimeConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + DateTime date = (DateTime)value; + + return date.ToLocalTime().ToString("MM/dd/yy HH:mm"); + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj b/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj index 57bd768db..0993f61fd 100644 --- a/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj +++ b/Software/Visual_Studio/Tango.SharedUI/Tango.SharedUI.csproj @@ -91,6 +91,7 @@ + -- cgit v1.3.1 From a794a5d088b425d7b41f87d7c3a43b904249e11e Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Mon, 19 Feb 2018 17:52:10 +0200 Subject: Working on developer module... --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 8388608 -> 8388608 bytes .../Tango.MachineStudio.Developer.csproj | 7 - .../ViewModelLocator.cs | 2 +- .../ViewModels/MainViewVM.cs | 251 +-- .../Views/JobView.xaml | 2 +- .../Views/JobView.xaml.cs | 8 - .../Views/MachineJobSelectionView.xaml | 4 +- .../Views/MainView.xaml | 2246 -------------------- .../Views/MainView.xaml.cs | 162 -- .../Observables/IObservableEntity.cs | 18 +- .../Observables/ObservableEntity.cs | 30 +- .../Observables/Partials/Machine.cs | 4 +- .../Observables/Partials/Segment.cs | 4 +- .../Tango.Integration/Printing/Job.cs | 4 +- 15 files changed, 68 insertions(+), 2674 deletions(-) delete mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml delete mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml.cs (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModelLocator.cs') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index 89b9bb6e2..24b24abfc 100644 Binary files a/Software/DB/Tango.mdf and b/Software/DB/Tango.mdf differ diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf index 064ee4ca7..54bf7ba0d 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf 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 eae234a8b..f986219e2 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 @@ -136,9 +136,6 @@ MachineJobSelectionView.xaml - - MainView.xaml - GlobalVersionInfo.cs @@ -165,10 +162,6 @@ Designer MSBuild:Compile - - Designer - MSBuild:Compile - Designer MSBuild:Compile diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModelLocator.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModelLocator.cs index 415643e3f..b397f1912 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModelLocator.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModelLocator.cs @@ -20,7 +20,7 @@ namespace Tango.MachineStudio.Developer { ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default); - SimpleIoc.Default.Register(() => MainView.Self); + //SimpleIoc.Default.Register(() => MainView.Self); SimpleIoc.Default.Register(); SimpleIoc.Default.Register(); } 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 c8a6aa89f..199183c12 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 @@ -45,14 +45,12 @@ namespace Tango.MachineStudio.Developer.ViewModels /// Represents the developer module main view, view model. /// /// - public class MainViewVM : ViewModel, IShutdownRequestBlocker + public class MainViewVM : ViewModel, IShutdownRequestBlocker { private static object _syncLock = new object(); private INotificationProvider _notification; private TimeSpan _runningJobEstimatedDuration; - private Dictionary _controllers; - private int _fullScreenGraphIndex; private JobHandler _jobHandler; private DeveloperNavigationManager _navigation; private ObservablesContext _dbJobContext; @@ -62,6 +60,16 @@ namespace Tango.MachineStudio.Developer.ViewModels #region Properties + private ObservableCollection _machines; + /// + /// Gets or sets the machines. + /// + public ObservableCollection Machines + { + get { return _machines; } + set { _machines = value; RaisePropertyChangedAuto(); } + } + private ObservableCollection _colorSpaces; /// /// Gets or sets the color spaces. @@ -82,6 +90,15 @@ namespace Tango.MachineStudio.Developer.ViewModels set { _rmls = value; RaisePropertyChangedAuto(); } } + private ObservableCollection _windingMethods; + + public ObservableCollection WindingMethods + { + get { return _windingMethods; } + set { _windingMethods = value; RaisePropertyChangedAuto(); } + } + + /// /// Gets or sets the application manager. /// @@ -92,11 +109,6 @@ namespace Tango.MachineStudio.Developer.ViewModels /// public IVideoCaptureProvider VideoCaptureProvider { get; set; } - /// - /// Gets or sets observable entites database the adapter. - /// - public ObservablesEntitiesAdapter Adapter { get; set; } - protected Machine _selectedMachine; /// /// Gets or sets the selected machine. @@ -286,26 +298,6 @@ namespace Tango.MachineStudio.Developer.ViewModels set { _isSideBarOpened = value; RaisePropertyChangedAuto(); } } - private ObservableCollection _availableGraphs; - /// - /// Gets or sets the available sensors. - /// - public ObservableCollection AvailableGraphs - { - get { return _availableGraphs; } - set { _availableGraphs = value; RaisePropertyChangedAuto(); } - } - - private ObservableCollection _graphs; - /// - /// Gets or sets the collection of displayed graph controls. - /// - public ObservableCollection Graphs - { - get { return _graphs; } - set { _graphs = value; RaisePropertyChangedAuto(); } - } - private TimeSpan _estimatedDuration; /// /// Gets or sets the estimated duration for the selected job. @@ -556,16 +548,6 @@ namespace Tango.MachineStudio.Developer.ViewModels /// public RelayCommand CloseJobCompletionStatusCommand { get; set; } - /// - /// Gets or sets the toggle camera command. - /// - public RelayCommand ToggleCameraCommand { get; set; } - - /// - /// Gets or sets the exit full screen command. - /// - public RelayCommand ExitFullScreenCommand { get; set; } - /// /// Gets or sets the load job command. /// @@ -593,16 +575,9 @@ namespace Tango.MachineStudio.Developer.ViewModels /// /// Initializes a new instance of the class. /// - public MainViewVM(IMainView view) : base(view, true) + public MainViewVM() : base() { - if (!this.DesignMode) - { - Adapter = ObservablesEntitiesAdapter.Instance; - AvailableGraphs = Adapter.TechMonitors.ToObservableCollection(); - } - Graphs = new ObservableCollection(); - _controllers = new Dictionary(); } /// @@ -611,8 +586,13 @@ namespace Tango.MachineStudio.Developer.ViewModels /// The application manager. /// The notification provider. [PreferredConstructor] - public MainViewVM(IStudioApplicationManager applicationManager, INotificationProvider notificationProvider, IMainView view, IDiagnosticsFrameProvider diagnosticsFrameProvider, IVideoCaptureProvider videoCaptureProvider, DeveloperNavigationManager navigation, IAuthenticationProvider authentication) : this(view) + public MainViewVM(IStudioApplicationManager applicationManager, INotificationProvider notificationProvider, IDiagnosticsFrameProvider diagnosticsFrameProvider, IVideoCaptureProvider videoCaptureProvider, DeveloperNavigationManager navigation, IAuthenticationProvider authentication) : this() { + using (var db = ObservablesContext.CreateDefault()) + { + Machines = db.Machines.ToObservableCollection(); + } + _machineDBContext = ObservablesContext.CreateDefault(); SelectedJobs = new ObservableCollection(); @@ -623,7 +603,6 @@ namespace Tango.MachineStudio.Developer.ViewModels _navigation = navigation; ApplicationManager = applicationManager; VideoCaptureProvider = videoCaptureProvider; - diagnosticsFrameProvider.FrameReceived += DiagnosticsFrameProvider_FrameReceived; //Initialize Commands... EditMachineCommand = new RelayCommand(EditMachine, () => SelectedMachine != null); @@ -642,14 +621,11 @@ namespace Tango.MachineStudio.Developer.ViewModels StartJobCommand = new RelayCommand(StartJob, () => ActiveJob != null && !IsJobRunning); StopJobCommand = new RelayCommand(StopJob, () => IsJobRunning); CloseJobCompletionStatusCommand = new RelayCommand(CloseJobCompletionStatusBar); - ExitFullScreenCommand = new RelayCommand(ExitFullScreen); LoadJobCommand = new RelayCommand(LoadJob, () => SelectedMachineJob != null); DuplicateJobCommand = new RelayCommand(DuplicateSelectedJobs, () => SelectedMachineJob != null); DuplicateSegmentCommand = new RelayCommand(DuplicateSelectedSegments, () => SelectedSegment != null); DuplicateBrushStopCommand = new RelayCommand(DuplicateSelectedBrushStops, () => SelectedBrushStop != null); - ToggleCameraCommand = new RelayCommand(ToggleCamera); - ApplicationManager.ConnectedMachineChanged += ApplicationManager_ConnectedMachineChanged; } @@ -657,16 +633,6 @@ namespace Tango.MachineStudio.Developer.ViewModels #region Event Handlers - /// - /// Handles the diagnostics provider frame received event. - /// - /// The sender. - /// The response. - private void DiagnosticsFrameProvider_FrameReceived(object sender, PushDiagnosticsResponse response) - { - PopulateDiagnosticsData(response); - } - /// /// Handles the application manager connected machine changes event. /// @@ -835,6 +801,7 @@ namespace Tango.MachineStudio.Developer.ViewModels ColorSpaces = _dbJobContext.ColorSpaces.ToObservableCollection(); Rmls = _dbJobContext.Rmls.ToObservableCollection(); + WindingMethods = _dbJobContext.WindingMethods.ToObservableCollection(); _activeJob = _dbJobContext.Jobs.SingleOrDefault(x => x.Guid == SelectedMachineJob.Guid); @@ -896,59 +863,6 @@ namespace Tango.MachineStudio.Developer.ViewModels } } - private void ClearGraphs() - { - _controllers.ToList().ForEach(x => x.Value.Clear()); - } - - private void PopulateDiagnosticsData(PushDiagnosticsResponse data) - { - foreach (var prop in data.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance)) - { - GraphControllerBase controller = null; - - if (_controllers.TryGetValue(prop.Name, out controller)) - { - if (controller is GraphController) - { - double[] arr = Enumerable.ToArray(prop.GetValue(data) as IEnumerable); - (controller as GraphController).PushData(arr); - } - else - { - DoubleArray[] arrayOfDoubles = Enumerable.ToArray(prop.GetValue(data) as IEnumerable); - (controller as GraphMultiController).PushData(arrayOfDoubles.Select(x => x.Data.ToList()).ToList()); - } - } - } - } - - private void ExitFullScreen() - { - if (FullScreenGraph != null) - { - FullScreenGraph.EnableToolBar = true; - Graphs.Insert(_fullScreenGraphIndex, FullScreenGraph); - FullScreenGraph = null; - } - } - - private void StartFullScreenGraph(IRealTimeGraph graph) - { - graph.EnableToolBar = false; - _fullScreenGraphIndex = Graphs.IndexOf(graph); - Graphs.Remove(graph); - FullScreenGraph = graph; - } - - private void ToggleCamera(CaptureDevice captureDevice) - { - if (captureDevice.Device != null) - { - captureDevice.IsStarted = !captureDevice.IsStarted; - } - } - private void CloseJobCompletionStatusBar() { _navigation.NavigateTo(DeveloperNavigationView.JobView); @@ -1138,15 +1052,9 @@ namespace Tango.MachineStudio.Developer.ViewModels g.Active = false; } - //String machineGuid = SelectedMachine.Guid; - //String rmlGuid = SelectedRML.Guid; - SelectedRML.ProcessParametersTablesGroups.Add(group); await SelectedRML.SaveAsync(); - //SelectedMachine = Adapter.Machines.SingleOrDefault(x => x.Guid == machineGuid); - //SelectedRML = Adapter.Rmls.SingleOrDefault(x => x.Guid == rmlGuid); - InvalidateLiquidFactorsAndProcessTables(); } } @@ -1329,8 +1237,8 @@ namespace Tango.MachineStudio.Developer.ViewModels newJob.Name = jobName; newJob.CreationDate = DateTime.UtcNow; newJob.User = _authentication.CurrentUser; - newJob.Rml = Adapter.Rmls.FirstOrDefault(); - newJob.WindingMethod = Adapter.WindingMethods.FirstOrDefault(); + newJob.Rml = _machineDBContext.Rmls.FirstOrDefault(); + newJob.WindingMethod = _machineDBContext.WindingMethods.FirstOrDefault(); newJob.Machine = SelectedMachine; SelectedMachine.Jobs.Add(newJob); @@ -1462,68 +1370,6 @@ namespace Tango.MachineStudio.Developer.ViewModels #region Public Methods - /// - /// Add sensor graph from available sensors to displayed graphs. - /// - /// The sensor. - public void OnDropAvailableGraph(TechMonitor sensor) - { - if (Graphs.Count < 8) - { - IRealTimeGraph graphControl = null; - GraphControllerBase controller = null; - - if (!sensor.MultiChannel) - { - graphControl = new RealTimeGraphControl(); - controller = new GraphController(); - graphControl.Controller = controller; - } - else - { - graphControl = new RealTimeGraphMultiControl(); - controller = new GraphMultiController(); - - for (int i = 0; i < sensor.ChannelCount; i++) - { - var randomColor = new SolidColorBrush(Core.Helpers.ColorHelper.GetRandomColor()); - - (controller as GraphMultiController).AddSeries(new DataYSeries() - { - Name = sensor.Description.First().ToString() + (i + 1), - UseFillAndStroke = true, - Stroke = randomColor - }); - } - - graphControl.Controller = controller; - } - - graphControl.Tag = sensor; - graphControl.SensorName = sensor.Description; - graphControl.SensorUnits = sensor.Units; - graphControl.InnerGraph.Minimum = sensor.Min; - graphControl.InnerGraph.Maximum = sensor.Max; - graphControl.InnerGraph.MaxPoints = Common.Helpers.GraphsHelper.GetMaxPoints(sensor.PointsPerFrame); - graphControl.GraphRemoveButtonPressed += (sender, _) => - { - RemoveGraph(sender as IRealTimeGraph); - }; - graphControl.GraphFullScreenButtonPressed += (sender, _) => - { - StartFullScreenGraph(sender as IRealTimeGraph); - }; - Graphs.Add(graphControl); - AvailableGraphs.Remove(sensor); - - _controllers.Add(sensor.Name, controller); - } - else - { - _notification.ShowInfo("The maximum number of real-time graphs is eight. Please remove a graph to add another."); - } - } - /// /// Switch the brush stop position in the segment. /// @@ -1536,19 +1382,6 @@ namespace Tango.MachineStudio.Developer.ViewModels ArrangeBrushStopsIndices(); } - /// - /// Removes the graph. - /// - /// The graph. - public void RemoveGraph(IRealTimeGraph graph) - { - var sensor = graph.Tag as TechMonitor; - _controllers.Remove(sensor.Name); - graph.InnerGraph.Dispose(); - Graphs.Remove(graph); - AvailableGraphs.Insert(0, sensor); - } - #endregion #region IShutdownRequestBlocker @@ -1575,20 +1408,20 @@ namespace Tango.MachineStudio.Developer.ViewModels #region IMainView - protected override void OnViewAttached() - { - base.OnViewAttached(); + //protected override void OnViewAttached() + //{ + // base.OnViewAttached(); - if (SettingsManager.Default.MachineStudio.DeveloperModule.LastSelectedMachineGuid != null) - { - SelectedMachine = Adapter.Machines.SingleOrDefault(x => x.Guid == SettingsManager.Default.MachineStudio.DeveloperModule.LastSelectedMachineGuid); - } + // //if (SettingsManager.Default.MachineStudio.DeveloperModule.LastSelectedMachineGuid != null) + // //{ + // // SelectedMachine = Adapter.Machines.SingleOrDefault(x => x.Guid == SettingsManager.Default.MachineStudio.DeveloperModule.LastSelectedMachineGuid); + // //} - if (SettingsManager.Default.MachineStudio.DeveloperModule.LastSelectedJobGuid != null && SelectedMachine != null) - { - ActiveJob = SelectedMachine.Jobs.SingleOrDefault(x => x.Guid == SettingsManager.Default.MachineStudio.DeveloperModule.LastSelectedJobGuid); - } - } + // //if (SettingsManager.Default.MachineStudio.DeveloperModule.LastSelectedJobGuid != null && SelectedMachine != null) + // //{ + // // ActiveJob = SelectedMachine.Jobs.SingleOrDefault(x => x.Guid == SettingsManager.Default.MachineStudio.DeveloperModule.LastSelectedJobGuid); + // //} + //} #endregion } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml index cf7af21d9..69f0fed5c 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml @@ -357,7 +357,7 @@ Winding Method - + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml.cs index 41886357b..27ea3cae8 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml.cs @@ -82,14 +82,6 @@ namespace Tango.MachineStudio.Developer.Views } } - private void OnDropAvailableGraph(object sender, DropEventArgs e) - { - if (e.Draggable.DataContext is TechMonitor) - { - _vm.OnDropAvailableGraph(e.Draggable.DataContext as TechMonitor); - } - } - private void Offset_Slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs e) { UpdateGradientBrushDisplay(); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MachineJobSelectionView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MachineJobSelectionView.xaml index 8881e4f57..c07ddb95b 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MachineJobSelectionView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MachineJobSelectionView.xaml @@ -31,7 +31,7 @@ TARGET MACHINE - + @@ -84,7 +84,7 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Job Completed Successfully - - - - - - - - - - - - - - - - - - - - - - - Job Failed To Complete - - - - - - - - - - - - - - - - - - - - - - - - - Job Aborted By User - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - HISTORY - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SELECT MACHINE & MEDIA - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - MACHINE JOBS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Name - - - - - - - - - - Winding Method - - - - - - - - - - Inter Segment - - - - - - - - - - - - - Lubrication - - - - - - - - - - - - Description - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SEGMENTS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Name - - - - - - - - - Length - - - - - - - - - - - - - - - - - - - - - - - - - - - SEGMENT BRUSH - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Color Space - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ESTIMATED DURATION: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - USB CAMERAS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - AVAILABLE GRAPHS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - DRAG & DROP GRAPHS - - - - - - - - - - - - - - - - - - - - Display Graphs - - - - - - - - - - - - - - - - - Job Status - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - LIQUID FACTORS ( Max Nanolitter/CM ) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SELECT MACHINE & MEDIA - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Press - 'Escape' - to exit full screen mode - - - - - - - - - - - diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml.cs deleted file mode 100644 index 2bd36e449..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml.cs +++ /dev/null @@ -1,162 +0,0 @@ -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; -using Tango.Integration.Observables; -using Tango.DragAndDrop; -using Tango.MachineStudio.Developer.Converters; -using Tango.MachineStudio.Developer.ViewModels; -using System.Windows.Threading; -using Tango.SharedUI; - -namespace Tango.MachineStudio.Developer.Views -{ - /// - /// Interaction logic for MainView.xaml - /// - public partial class MainView : UserControl, IMainView - { - public static MainView Self { get; set; } - - private MainViewVM _vm; - private DispatcherTimer _jobBrushTimer; - - 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 event EventHandler ViewAttached; - - public MainView() - { - Self = this; - - InitializeComponent(); - - DraggingSurface = draggingSurface; - this.Loaded += (x, y) => - { - _vm = DataContext as MainViewVM; - ViewAttached?.Invoke(this, this); - }; - - chkGraphs.Checked += (x, y) => - { - graphRowDefinition.Height = new GridLength(440, GridUnitType.Pixel); - //listCameras.Width = 240; - //dockCameras.Width = 270; - //dockCameras.Height = 600; - }; - chkGraphs.Unchecked += (x, y) => - { - graphRowDefinition.Height = new GridLength(80, GridUnitType.Pixel); - //listCameras.Width = double.NaN; - //dockCameras.Width = 330; - //dockCameras.Height = 850; - }; - - _jobBrushTimer = new DispatcherTimer(); - _jobBrushTimer.Interval = TimeSpan.FromSeconds(1); - _jobBrushTimer.Tick += _jobBrushTimer_Tick; - _jobBrushTimer.Start(); - } - - private void _jobBrushTimer_Tick(object sender, EventArgs e) - { - if (_vm != null && _vm.ActiveJob != null) - { - List segments = new List(); - foreach (var s in _vm.ActiveJob.Segments) - { - segments.Add(s); - - if (_vm.ActiveJob.EnableInterSegment && _vm.ActiveJob.Segments.IndexOf(s) != _vm.ActiveJob.Segments.Count - 1) - { - segments.Add(new Segment() - { - Length = _vm.ActiveJob.InterSegmentLength, - BrushStops = new System.Collections.ObjectModel.ObservableCollection() - { - new BrushStop() - { - Color = Colors.White, - } - }, - }); - } - } - - jobBrushList.ItemsSource = segments; - } - } - - private void OnDropAvailableGraph(object sender, DropEventArgs e) - { - if (e.Draggable.DataContext is TechMonitor) - { - _vm.OnDropAvailableGraph(e.Draggable.DataContext as TechMonitor); - } - } - - private void Offset_Slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs e) - { - UpdateGradientBrushDisplay(); - } - - private void UpdateGradientBrushDisplay() - { - if (_vm.SelectedSegment != null) - { - SegmentToGradientStopsConverter converter = new SegmentToGradientStopsConverter(); - GradientStopCollection stops = converter.Convert(_vm.SelectedSegment, null, null, null) as GradientStopCollection; - gradientBrush.GradientStops = stops; - } - else - { - gradientBrush.GradientStops = new GradientStopCollection(); - } - } - - private void OnBrushStopBorderDrop(object sender, DropEventArgs e) - { - if (e.Draggable.DataContext is BrushStop) - { - _vm.OnDropBrushStop(e.Draggable.DataContext as BrushStop, e.Droppable.DataContext as BrushStop); - } - } - - private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) - { - UpdateGradientBrushDisplay(); - } - - private void OnJobStartClick(object sender, RoutedEventArgs e) - { - - } - - private void HiveColorPickerControl_SelectedColorChanged(object sender, Color e) - { - UpdateGradientBrushDisplay(); - } - - private void Popup_MouseDown(object sender, MouseButtonEventArgs e) - { - e.Handled = true; - } - } -} diff --git a/Software/Visual_Studio/Tango.Integration/Observables/IObservableEntity.cs b/Software/Visual_Studio/Tango.Integration/Observables/IObservableEntity.cs index 15fb521ba..cd046ac2b 100644 --- a/Software/Visual_Studio/Tango.Integration/Observables/IObservableEntity.cs +++ b/Software/Visual_Studio/Tango.Integration/Observables/IObservableEntity.cs @@ -43,13 +43,7 @@ namespace Tango.Integration.Observables /// /// Saves the changes on this entity to database. /// - void Save(); - - /// - /// Saves the changes on this entity to database using the specified context. - /// - /// The context. - void Save(DbContext context); + void Save(ObservablesContext context = null); /// /// Attaches this observable to the proper DbSet. @@ -65,13 +59,7 @@ namespace Tango.Integration.Observables /// Saves the changes on this entity to database asynchronously. /// /// - Task SaveAsync(); - - /// - /// Saves the changes on this entity to database asynchronously. - /// - /// - Task SaveAsync(DbContext context); + Task SaveAsync(ObservablesContext context = null); /// /// Deletes this entity from the database. @@ -86,6 +74,6 @@ namespace Tango.Integration.Observables /// /// Deletes this entity from the database. /// - Task DeleteAsync(); + Task DeleteAsync(ObservablesContext context = null); } } diff --git a/Software/Visual_Studio/Tango.Integration/Observables/ObservableEntity.cs b/Software/Visual_Studio/Tango.Integration/Observables/ObservableEntity.cs index f92d9dfa0..e18193586 100644 --- a/Software/Visual_Studio/Tango.Integration/Observables/ObservableEntity.cs +++ b/Software/Visual_Studio/Tango.Integration/Observables/ObservableEntity.cs @@ -114,9 +114,16 @@ namespace Tango.Integration.Observables /// /// Saves the changes on this entity to database. /// - public virtual void Save() + public virtual void Save(ObservablesContext context = null) { - ObservablesEntitiesAdapter.Instance.SaveChanges(); + if (context == null) + { + ObservablesEntitiesAdapter.Instance.SaveChanges(); + } + else + { + context.SaveChanges(); + } OnSaved(); } @@ -140,11 +147,11 @@ namespace Tango.Integration.Observables /// Saves the changes on this entity to database asynchronously. /// /// - public Task SaveAsync() + public Task SaveAsync(ObservablesContext context = null) { return Task.Factory.StartNew(() => { - Save(); + Save(context); }); } @@ -187,11 +194,11 @@ namespace Tango.Integration.Observables /// /// Deletes this entity from the database /// - public Task DeleteAsync() + public Task DeleteAsync(ObservablesContext context = null) { return Task.Factory.StartNew(() => { - Delete(); + Delete(context); }); } @@ -254,17 +261,6 @@ namespace Tango.Integration.Observables return (this as T).CloneEntity() as T; } - public void Save(DbContext context) - { - context.SaveChanges(); - OnSaved(); - } - - public Task SaveAsync(DbContext context) - { - return Task.Factory.StartNew(() => Save(context)); - } - public bool CompareUsingJson(T entity) { String me = JsonConvert.SerializeObject(this); diff --git a/Software/Visual_Studio/Tango.Integration/Observables/Partials/Machine.cs b/Software/Visual_Studio/Tango.Integration/Observables/Partials/Machine.cs index bb26acc39..1669230d6 100644 --- a/Software/Visual_Studio/Tango.Integration/Observables/Partials/Machine.cs +++ b/Software/Visual_Studio/Tango.Integration/Observables/Partials/Machine.cs @@ -23,7 +23,7 @@ namespace Tango.Integration.Observables base.Delete(); } - public override void Save() + public override void Save(ObservablesContext context = null) { foreach (var job in Jobs) { @@ -48,7 +48,7 @@ namespace Tango.Integration.Observables } } - base.Save(); + base.Save(context); } } } diff --git a/Software/Visual_Studio/Tango.Integration/Observables/Partials/Segment.cs b/Software/Visual_Studio/Tango.Integration/Observables/Partials/Segment.cs index c83c34870..71a15b90c 100644 --- a/Software/Visual_Studio/Tango.Integration/Observables/Partials/Segment.cs +++ b/Software/Visual_Studio/Tango.Integration/Observables/Partials/Segment.cs @@ -10,14 +10,14 @@ namespace Tango.Integration.Observables { public partial class Segment { - public override void Save() + public override void Save(ObservablesContext context = null) { for (int i = 0; i < BrushStops.Count; i++) { BrushStops[i].StopIndex = i; } - base.Save(); + base.Save(context); } } } diff --git a/Software/Visual_Studio/Tango.Integration/Printing/Job.cs b/Software/Visual_Studio/Tango.Integration/Printing/Job.cs index 49c5fbdae..29155be53 100644 --- a/Software/Visual_Studio/Tango.Integration/Printing/Job.cs +++ b/Software/Visual_Studio/Tango.Integration/Printing/Job.cs @@ -120,7 +120,7 @@ namespace Tango.Integration.Observables /// /// Saves the changes on this entity to database. /// - public override void Save() + public override void Save(ObservablesContext context = null) { for (int i = 0; i < Segments.Count; i++) { @@ -132,7 +132,7 @@ namespace Tango.Integration.Observables } } - base.Save(); + base.Save(context); } public override Job Clone() -- cgit v1.3.1 From 160ec4042539e69a7494bcde5c893c6dffcbf1b6 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Mon, 19 Feb 2018 19:09:12 +0200 Subject: Working on developer module.. --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 8388608 -> 8388608 bytes .../ViewModels/DbTableViewModel.cs | 8 +- .../DeveloperModule.cs | 2 +- .../Navigation/DeveloperNavigationManager.cs | 2 +- .../Tango.MachineStudio.Developer.csproj | 6 +- .../ViewModelLocator.cs | 2 +- .../ViewModels/MainViewVM.cs | 76 ++-- .../Views/DeveloperView.xaml | 414 --------------------- .../Views/DeveloperView.xaml.cs | 31 -- .../Views/JobView.xaml | 2 +- .../Views/MachineJobSelectionView.xaml | 30 +- .../Views/MainView.xaml | 414 +++++++++++++++++++++ .../Views/MainView.xaml.cs | 44 +++ .../ViewModels/MainViewVM.cs | 12 +- .../Observables/IObservableEntity.cs | 14 +- .../Observables/ObservableEntity.cs | 27 +- .../Observables/Partials/Configuration.cs | 4 +- .../Observables/Partials/Machine.cs | 10 +- .../Observables/Partials/MachineVersion.cs | 6 +- .../Observables/Partials/Segment.cs | 2 +- .../Tango.Integration/Printing/Job.cs | 4 +- .../Tango.Integration/Printing/Segment.cs | 2 +- .../Tango.SharedUI/Controls/MultiSelectDataGrid.cs | 11 +- .../DateTimeUTCToShortDateTimeConverter.cs | 11 +- .../Tango.UnitTesting/ColorLib_TST.cs | 4 +- 26 files changed, 595 insertions(+), 543 deletions(-) delete mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/DeveloperView.xaml delete mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/DeveloperView.xaml.cs create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml create mode 100644 Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml.cs (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModelLocator.cs') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index 24b24abfc..ff1de2760 100644 Binary files a/Software/DB/Tango.mdf and b/Software/DB/Tango.mdf differ diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf index 54bf7ba0d..661db54aa 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/DbTableViewModel.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/DbTableViewModel.cs index a05df573c..62f768b9d 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/DbTableViewModel.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/DbTableViewModel.cs @@ -158,7 +158,7 @@ namespace Tango.MachineStudio.DB.ViewModels { try { - await SelectedEntity.DeleteAsync(); + await SelectedEntity.DeleteAsync(Adapter.Context); } catch (Exception ex) { @@ -220,18 +220,18 @@ namespace Tango.MachineStudio.DB.ViewModels { if (mode == DialogOpenMode.Adding) { - entity.Attach(); + entity.Attach(Adapter.Context); } try { - await entity.SaveAsync(); + await entity.SaveAsync(Adapter.Context); } catch (DbUpdateException ex) { if (mode == DialogOpenMode.Adding) { - entity.Detach(); + entity.Detach(Adapter.Context); } Adapter.Invalidate(); _notification.ShowError("Could not save entity." + Environment.NewLine + ex.InnerException.InnerException != null ? ex.InnerException.InnerException.Message : ex.InnerException.Message); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/DeveloperModule.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/DeveloperModule.cs index 17c08adc4..6cdda4bc8 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/DeveloperModule.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/DeveloperModule.cs @@ -36,7 +36,7 @@ namespace Tango.MachineStudio.Developer /// /// Gets the module entry point view. /// - public override FrameworkElement MainView => new DeveloperView(); + public override FrameworkElement MainView => new MainView(); /// /// Gets the permission required to see and load this module. diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Navigation/DeveloperNavigationManager.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Navigation/DeveloperNavigationManager.cs index 297caf2dc..5be50231d 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Navigation/DeveloperNavigationManager.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Navigation/DeveloperNavigationManager.cs @@ -12,7 +12,7 @@ namespace Tango.MachineStudio.Developer.Navigation { public void NavigateTo(DeveloperNavigationView view) { - DeveloperView.Instance.TransitionControl.AutoNavigate(view.ToString()); + MainView.Instance.TransitionControl.AutoNavigate(view.ToString()); } } } 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 3253fc551..91a9602be 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 @@ -124,8 +124,8 @@ - - DeveloperView.xaml + + MainView.xaml @@ -148,7 +148,7 @@ MSBuild:Compile Designer - + Designer MSBuild:Compile diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModelLocator.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModelLocator.cs index b397f1912..c5ed7d385 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModelLocator.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModelLocator.cs @@ -20,7 +20,7 @@ namespace Tango.MachineStudio.Developer { ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default); - //SimpleIoc.Default.Register(() => MainView.Self); + SimpleIoc.Default.Register(() => MainView.Instance); SimpleIoc.Default.Register(); SimpleIoc.Default.Register(); } 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 199183c12..62b742390 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 @@ -45,7 +45,7 @@ namespace Tango.MachineStudio.Developer.ViewModels /// Represents the developer module main view, view model. /// /// - public class MainViewVM : ViewModel, IShutdownRequestBlocker + public class MainViewVM : ViewModel, IShutdownRequestBlocker, IShutdownListener { private static object _syncLock = new object(); @@ -464,6 +464,14 @@ namespace Tango.MachineStudio.Developer.ViewModels } } + private String _jobFilter; + + public String JobFilter + { + get { return _jobFilter; } + set { _jobFilter = value; RaisePropertyChangedAuto(); OnJobFilterChanged(); } + } + #endregion #region Commands @@ -575,7 +583,7 @@ namespace Tango.MachineStudio.Developer.ViewModels /// /// Initializes a new instance of the class. /// - public MainViewVM() : base() + public MainViewVM(IMainView view) : base(view, true) { } @@ -586,16 +594,22 @@ namespace Tango.MachineStudio.Developer.ViewModels /// The application manager. /// The notification provider. [PreferredConstructor] - public MainViewVM(IStudioApplicationManager applicationManager, INotificationProvider notificationProvider, IDiagnosticsFrameProvider diagnosticsFrameProvider, IVideoCaptureProvider videoCaptureProvider, DeveloperNavigationManager navigation, IAuthenticationProvider authentication) : this() + public MainViewVM(IMainView view, IStudioApplicationManager applicationManager, INotificationProvider notificationProvider, IDiagnosticsFrameProvider diagnosticsFrameProvider, IVideoCaptureProvider videoCaptureProvider, DeveloperNavigationManager navigation, IAuthenticationProvider authentication) : this(view) { - using (var db = ObservablesContext.CreateDefault()) + SelectedJobs = new ObservableCollection(); + + _machineDBContext = ObservablesContext.CreateDefault(); + + if (SettingsManager.Default.MachineStudio.DeveloperModule.LastSelectedMachineGuid != null) { - Machines = db.Machines.ToObservableCollection(); + SelectedMachine = _machineDBContext.Machines.SingleOrDefault(x => x.Guid == SettingsManager.Default.MachineStudio.DeveloperModule.LastSelectedMachineGuid); } - _machineDBContext = ObservablesContext.CreateDefault(); + if (SettingsManager.Default.MachineStudio.DeveloperModule.LastSelectedJobGuid != null && SelectedMachine != null) + { + SelectedMachineJob = SelectedMachine.Jobs.SingleOrDefault(x => x.Guid == SettingsManager.Default.MachineStudio.DeveloperModule.LastSelectedJobGuid); + } - SelectedJobs = new ObservableCollection(); _authentication = authentication; @@ -748,7 +762,6 @@ namespace Tango.MachineStudio.Developer.ViewModels ReloadMachine(); JobsCollectionView = CollectionViewSource.GetDefaultView(SelectedMachine.Jobs); JobsCollectionView.SortDescriptions.Add(new SortDescription(nameof(Job.LastUpdated), ListSortDirection.Descending)); - InvalidateLiquidFactorsAndProcessTables(); } } @@ -757,7 +770,8 @@ namespace Tango.MachineStudio.Developer.ViewModels _machineDBContext.Dispose(); _machineDBContext = ObservablesContext.CreateDefault(); _machineDBContext.Configuration.LazyLoadingEnabled = true; - _selectedMachine = _machineDBContext.Machines.SingleOrDefault(x => x.Guid == _selectedMachine.Guid); + Machines = _machineDBContext.Machines.ToObservableCollection(); + _selectedMachine = Machines.SingleOrDefault(x => x.Guid == _selectedMachine.Guid); RaisePropertyChanged(nameof(SelectedMachine)); JobsCollectionView = CollectionViewSource.GetDefaultView(SelectedMachine.Jobs); @@ -768,6 +782,17 @@ namespace Tango.MachineStudio.Developer.ViewModels #region Private Methods + private void OnJobFilterChanged() + { + JobsCollectionView.Filter = (job) => + { + Job j = job as Job; + return String.IsNullOrWhiteSpace(JobFilter) + || + j.Name.ToLower().Contains(JobFilter.ToLower()); + }; + } + private void OnActiveJobChanged() { if (ActiveJob != null) @@ -998,7 +1023,7 @@ namespace Tango.MachineStudio.Developer.ViewModels { using (_notification.PushTaskItem("Saving Liquid Factors...")) { - await SelectedRML.SaveAsync(); + await SelectedRML.SaveAsync(_dbJobContext); InvalidateLiquidFactorsAndProcessTables(); } } @@ -1053,7 +1078,7 @@ namespace Tango.MachineStudio.Developer.ViewModels } SelectedRML.ProcessParametersTablesGroups.Add(group); - await SelectedRML.SaveAsync(); + await SelectedRML.SaveAsync(_dbJobContext); InvalidateLiquidFactorsAndProcessTables(); } @@ -1398,30 +1423,27 @@ namespace Tango.MachineStudio.Developer.ViewModels return Task.FromResult(false); } - SettingsManager.Default.MachineStudio.DeveloperModule.LastSelectedMachineGuid = SelectedMachine != null ? SelectedMachine.Guid : null; - SettingsManager.Default.MachineStudio.DeveloperModule.LastSelectedJobGuid = ActiveJob != null ? ActiveJob.Guid : null; - return Task.FromResult(true); } #endregion - #region IMainView + #region IShutdownListener + + public void OnShuttingDown() + { + SettingsManager.Default.MachineStudio.DeveloperModule.LastSelectedMachineGuid = SelectedMachine != null ? SelectedMachine.Guid : null; + SettingsManager.Default.MachineStudio.DeveloperModule.LastSelectedJobGuid = SelectedMachineJob != null ? SelectedMachineJob.Guid : null; + } - //protected override void OnViewAttached() - //{ - // base.OnViewAttached(); + #endregion - // //if (SettingsManager.Default.MachineStudio.DeveloperModule.LastSelectedMachineGuid != null) - // //{ - // // SelectedMachine = Adapter.Machines.SingleOrDefault(x => x.Guid == SettingsManager.Default.MachineStudio.DeveloperModule.LastSelectedMachineGuid); - // //} + #region IMainView - // //if (SettingsManager.Default.MachineStudio.DeveloperModule.LastSelectedJobGuid != null && SelectedMachine != null) - // //{ - // // ActiveJob = SelectedMachine.Jobs.SingleOrDefault(x => x.Guid == SettingsManager.Default.MachineStudio.DeveloperModule.LastSelectedJobGuid); - // //} - //} + protected override void OnViewAttached() + { + base.OnViewAttached(); + } #endregion } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/DeveloperView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/DeveloperView.xaml deleted file mode 100644 index 276f6c99a..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/DeveloperView.xaml +++ /dev/null @@ -1,414 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Transparent - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Job Completed Successfully - - - - - - - - - - - - - - - - - - - - - - - Job Failed To Complete - - - - - - - - - - - - - - - - - - - - - - - - - Job Aborted By User - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/DeveloperView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/DeveloperView.xaml.cs deleted file mode 100644 index dfa7a2441..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/DeveloperView.xaml.cs +++ /dev/null @@ -1,31 +0,0 @@ -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.Developer.Views -{ - /// - /// Interaction logic for DeveloperView.xaml - /// - public partial class DeveloperView : UserControl - { - public static DeveloperView Instance { get; set; } - - public DeveloperView() - { - InitializeComponent(); - Instance = this; - } - } -} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml index 580e2438b..4467b1f28 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml @@ -852,7 +852,7 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Job Completed Successfully + + + + + + + + + + + + + + + + + + + + + + + Job Failed To Complete + + + + + + + + + + + + + + + + + + + + + + + + + Job Aborted By User + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml.cs new file mode 100644 index 000000000..ab181e8dc --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml.cs @@ -0,0 +1,44 @@ +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; +using Tango.SharedUI; + +namespace Tango.MachineStudio.Developer.Views +{ + /// + /// Interaction logic for DeveloperView.xaml + /// + public partial class MainView : UserControl, IMainView + { + private bool _loaded; + public static MainView Instance { get; set; } + + public MainView() + { + InitializeComponent(); + Instance = this; + + Loaded += (x, y) => + { + if (!_loaded) + { + _loaded = true; + ViewAttached?.Invoke(this, this); + } + }; + } + + public event EventHandler ViewAttached; + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs index cedbcf9a6..6fbd5852d 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs @@ -529,7 +529,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels Configuration = Configuration, Machine = Machine, }); - await Machine.SaveAsync(); + await Machine.SaveAsync(Adapter.Context); Machine = Adapter.Machines.SingleOrDefault(x => x.Guid == Machine.Guid); Configuration = Machine.Configuration.CloneConfiguration(); @@ -558,12 +558,12 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels } else { - machine.Configuration.DefferedDelete(); + machine.Configuration.DefferedDelete(Adapter.Context); } machine.Configuration = Configuration; - await machine.SaveAsync(); + await machine.SaveAsync(Adapter.Context); Machine = Adapter.Machines.SingleOrDefault(x => x.Guid == machine.Guid); Configuration = Machine.Configuration.CloneConfiguration(); @@ -624,7 +624,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels { vm.SelectedVersion.DefaultConfiguration = Configuration.CloneConfiguration(); vm.SelectedVersion.DefaultConfigurationGuid = vm.SelectedVersion.DefaultConfiguration.Guid; - await vm.SelectedVersion.SaveAsync(); + await vm.SelectedVersion.SaveAsync(Adapter.Context); } else { @@ -634,7 +634,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels newVersion.DefaultConfiguration = Configuration.CloneConfiguration(); newVersion.DefaultConfigurationGuid = newVersion.DefaultConfiguration.Guid; - await newVersion.SaveAsync(); + await newVersion.SaveAsync(Adapter.Context); } } } @@ -662,7 +662,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels { if (module is MachineDesignerModule) { - SelectedMachine = args as Machine; + SelectedMachine = Adapter.Machines.SingleOrDefault(x => x.Guid == (args as Machine).Guid); } } diff --git a/Software/Visual_Studio/Tango.Integration/Observables/IObservableEntity.cs b/Software/Visual_Studio/Tango.Integration/Observables/IObservableEntity.cs index cd046ac2b..600258b84 100644 --- a/Software/Visual_Studio/Tango.Integration/Observables/IObservableEntity.cs +++ b/Software/Visual_Studio/Tango.Integration/Observables/IObservableEntity.cs @@ -43,37 +43,37 @@ namespace Tango.Integration.Observables /// /// Saves the changes on this entity to database. /// - void Save(ObservablesContext context = null); + void Save(ObservablesContext context); /// /// Attaches this observable to the proper DbSet. /// - void Attach(ObservablesContext context = null); + void Attach(ObservablesContext context); /// /// Detaches this observable from the proper DbSet. /// - void Detach(ObservablesContext context = null); + void Detach(ObservablesContext context); /// /// Saves the changes on this entity to database asynchronously. /// /// - Task SaveAsync(ObservablesContext context = null); + Task SaveAsync(ObservablesContext context); /// /// Deletes this entity from the database. /// - void Delete(ObservablesContext context = null); + void Delete(ObservablesContext context); /// /// Deletes this entity without saving changes to data base. /// - void DefferedDelete(ObservablesContext context = null); + void DefferedDelete(ObservablesContext context); /// /// Deletes this entity from the database. /// - Task DeleteAsync(ObservablesContext context = null); + Task DeleteAsync(ObservablesContext context); } } diff --git a/Software/Visual_Studio/Tango.Integration/Observables/ObservableEntity.cs b/Software/Visual_Studio/Tango.Integration/Observables/ObservableEntity.cs index d379945f3..3f05dffd3 100644 --- a/Software/Visual_Studio/Tango.Integration/Observables/ObservableEntity.cs +++ b/Software/Visual_Studio/Tango.Integration/Observables/ObservableEntity.cs @@ -114,9 +114,9 @@ namespace Tango.Integration.Observables /// /// Saves the changes on this entity to database. /// - public virtual void Save(ObservablesContext context = null) + public virtual void Save(ObservablesContext context) { - if (context == null) + if (context == ObservablesEntitiesAdapter.Instance.Context) { ObservablesEntitiesAdapter.Instance.SaveChanges(); } @@ -130,7 +130,7 @@ namespace Tango.Integration.Observables /// /// Attaches this entity to the proper DbSet. /// - public virtual void Attach(ObservablesContext context = null) + public virtual void Attach(ObservablesContext context) { GetDbSet(context).Add(this as T); } @@ -138,7 +138,7 @@ namespace Tango.Integration.Observables /// /// Detaches this observable from the proper DbSet. /// - public virtual void Detach(ObservablesContext context = null) + public virtual void Detach(ObservablesContext context) { GetDbSet(context).Remove(this as T); } @@ -147,7 +147,7 @@ namespace Tango.Integration.Observables /// Saves the changes on this entity to database asynchronously. /// /// - public Task SaveAsync(ObservablesContext context = null) + public Task SaveAsync(ObservablesContext context) { return Task.Factory.StartNew(() => { @@ -167,26 +167,26 @@ namespace Tango.Integration.Observables /// /// Deletes this entity from the database /// - public virtual void Delete(ObservablesContext context = null) + public virtual void Delete(ObservablesContext context) { var delProp = this.GetType().GetProperty("Deleted"); if (delProp != null) { delProp.SetValue(this, true); - Save(); + Save(context); } else { GetDbSet(context).Remove(this as T); - Save(); + Save(context); } } /// /// Deletes this entity without saving changes to data base. /// - public virtual void DefferedDelete(ObservablesContext context = null) + public virtual void DefferedDelete(ObservablesContext context) { GetDbSet(context).Remove(this as T); } @@ -194,7 +194,7 @@ namespace Tango.Integration.Observables /// /// Deletes this entity from the database /// - public Task DeleteAsync(ObservablesContext context = null) + public Task DeleteAsync(ObservablesContext context) { return Task.Factory.StartNew(() => { @@ -204,8 +204,6 @@ namespace Tango.Integration.Observables public DbSet GetDbSet(ObservablesContext context) { - context = GetContextOrDefault(context); - String tabelName = this.GetType().Name.PluralizeMVC(); var p = typeof(ObservablesContext).GetProperty(tabelName); if (p != null) @@ -268,11 +266,6 @@ namespace Tango.Integration.Observables return me == other; } - private ObservablesContext GetContextOrDefault(ObservablesContext context) - { - return context != null ? context : ObservablesEntitiesAdapter.Instance.Context; - } - #region Operator Overloading //public static bool operator ==(ObservableEntity observable1, ObservableEntity observable2) diff --git a/Software/Visual_Studio/Tango.Integration/Observables/Partials/Configuration.cs b/Software/Visual_Studio/Tango.Integration/Observables/Partials/Configuration.cs index fa489ded2..a5ddb0d14 100644 --- a/Software/Visual_Studio/Tango.Integration/Observables/Partials/Configuration.cs +++ b/Software/Visual_Studio/Tango.Integration/Observables/Partials/Configuration.cs @@ -8,7 +8,7 @@ namespace Tango.Integration.Observables { public partial class Configuration { - public override void DefferedDelete(ObservablesContext context = null) + public override void DefferedDelete(ObservablesContext context) { IdsPacks.ToList().ForEach(x => x.DefferedDelete(context)); var machine_configurations = context.MachinesConfigurations.Where(x => x.Configuration == this); @@ -17,7 +17,7 @@ namespace Tango.Integration.Observables IdsPacks.Clear(); } - public override void Delete(ObservablesContext context = null) + public override void Delete(ObservablesContext context) { IdsPacks.ToList().ForEach(x => x.DefferedDelete(context)); var machine_configurations = context.MachinesConfigurations.Where(x => x.Configuration == this); diff --git a/Software/Visual_Studio/Tango.Integration/Observables/Partials/Machine.cs b/Software/Visual_Studio/Tango.Integration/Observables/Partials/Machine.cs index 1669230d6..3026ff168 100644 --- a/Software/Visual_Studio/Tango.Integration/Observables/Partials/Machine.cs +++ b/Software/Visual_Studio/Tango.Integration/Observables/Partials/Machine.cs @@ -12,18 +12,18 @@ namespace Tango.Integration.Observables /// /// Deletes this entity from the database /// - public override void Delete(ObservablesContext context = null) + public override void Delete(ObservablesContext context) { foreach (var machine_config in MachinesConfigurations) { - machine_config.Delete(); - machine_config.Configuration.Delete(); + machine_config.Delete(context); + machine_config.Configuration.Delete(context); } - base.Delete(); + base.Delete(context); } - public override void Save(ObservablesContext context = null) + public override void Save(ObservablesContext context) { foreach (var job in Jobs) { diff --git a/Software/Visual_Studio/Tango.Integration/Observables/Partials/MachineVersion.cs b/Software/Visual_Studio/Tango.Integration/Observables/Partials/MachineVersion.cs index 4bd242c1b..73a6a8a4f 100644 --- a/Software/Visual_Studio/Tango.Integration/Observables/Partials/MachineVersion.cs +++ b/Software/Visual_Studio/Tango.Integration/Observables/Partials/MachineVersion.cs @@ -8,10 +8,10 @@ namespace Tango.Integration.Observables { public partial class MachineVersion { - public override void Delete(ObservablesContext context = null) + public override void Delete(ObservablesContext context) { - this.DefaultConfiguration.Delete(); - base.Delete(); + this.DefaultConfiguration.Delete(context); + base.Delete(context); } } } diff --git a/Software/Visual_Studio/Tango.Integration/Observables/Partials/Segment.cs b/Software/Visual_Studio/Tango.Integration/Observables/Partials/Segment.cs index 71a15b90c..eda1613ed 100644 --- a/Software/Visual_Studio/Tango.Integration/Observables/Partials/Segment.cs +++ b/Software/Visual_Studio/Tango.Integration/Observables/Partials/Segment.cs @@ -10,7 +10,7 @@ namespace Tango.Integration.Observables { public partial class Segment { - public override void Save(ObservablesContext context = null) + public override void Save(ObservablesContext context) { for (int i = 0; i < BrushStops.Count; i++) { diff --git a/Software/Visual_Studio/Tango.Integration/Printing/Job.cs b/Software/Visual_Studio/Tango.Integration/Printing/Job.cs index 29155be53..b80af84b8 100644 --- a/Software/Visual_Studio/Tango.Integration/Printing/Job.cs +++ b/Software/Visual_Studio/Tango.Integration/Printing/Job.cs @@ -120,7 +120,7 @@ namespace Tango.Integration.Observables /// /// Saves the changes on this entity to database. /// - public override void Save(ObservablesContext context = null) + public override void Save(ObservablesContext context) { for (int i = 0; i < Segments.Count; i++) { @@ -146,7 +146,7 @@ namespace Tango.Integration.Observables return cloned; } - public override void DefferedDelete(ObservablesContext context = null) + public override void DefferedDelete(ObservablesContext context) { Segments.ToList().ForEach(x => x.DefferedDelete(context)); Segments.Clear(); diff --git a/Software/Visual_Studio/Tango.Integration/Printing/Segment.cs b/Software/Visual_Studio/Tango.Integration/Printing/Segment.cs index d3e50ec37..999ef247b 100644 --- a/Software/Visual_Studio/Tango.Integration/Printing/Segment.cs +++ b/Software/Visual_Studio/Tango.Integration/Printing/Segment.cs @@ -68,7 +68,7 @@ namespace Tango.Integration.Observables return cloned; } - public override void DefferedDelete(ObservablesContext context = null) + public override void DefferedDelete(ObservablesContext context) { BrushStops.ToList().ForEach(x => x.DefferedDelete(context)); BrushStops.Clear(); diff --git a/Software/Visual_Studio/Tango.SharedUI/Controls/MultiSelectDataGrid.cs b/Software/Visual_Studio/Tango.SharedUI/Controls/MultiSelectDataGrid.cs index 0f3032e01..8f54a2ce4 100644 --- a/Software/Visual_Studio/Tango.SharedUI/Controls/MultiSelectDataGrid.cs +++ b/Software/Visual_Studio/Tango.SharedUI/Controls/MultiSelectDataGrid.cs @@ -26,11 +26,14 @@ namespace Tango.SharedUI.Controls { base.OnSelectionChanged(e); - SelectedItemsList.Clear(); - - foreach (var item in SelectedItems) + if (SelectedItemsList != null) { - SelectedItemsList.Add(item); + SelectedItemsList.Clear(); + + foreach (var item in SelectedItems) + { + SelectedItemsList.Add(item); + } } } } diff --git a/Software/Visual_Studio/Tango.SharedUI/Converters/DateTimeUTCToShortDateTimeConverter.cs b/Software/Visual_Studio/Tango.SharedUI/Converters/DateTimeUTCToShortDateTimeConverter.cs index 7c51139e0..5e02ec718 100644 --- a/Software/Visual_Studio/Tango.SharedUI/Converters/DateTimeUTCToShortDateTimeConverter.cs +++ b/Software/Visual_Studio/Tango.SharedUI/Converters/DateTimeUTCToShortDateTimeConverter.cs @@ -12,9 +12,16 @@ namespace Tango.SharedUI.Converters { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { - DateTime date = (DateTime)value; + if (value != null) + { + DateTime date = (DateTime)value; - return date.ToLocalTime().ToString("MM/dd/yy HH:mm"); + return date.ToLocalTime().ToString("MM/dd/yy HH:mm"); + } + else + { + return null; + } } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) diff --git a/Software/Visual_Studio/Tango.UnitTesting/ColorLib_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/ColorLib_TST.cs index f4940cdac..af875547f 100644 --- a/Software/Visual_Studio/Tango.UnitTesting/ColorLib_TST.cs +++ b/Software/Visual_Studio/Tango.UnitTesting/ColorLib_TST.cs @@ -53,7 +53,7 @@ namespace Tango.UnitTesting Assert.IsNotNull(rml); - List factors = configuration.IdsPacks.OrderBy(x => x.PackIndex).Select(x => x.LiquidType).SelectMany(x => x.LiquidTypesRmls).Where(x => x.Rml.Guid == RML.Guid).ToList(); + List factors = configuration.IdsPacks.OrderBy(x => x.PackIndex).Select(x => x.LiquidType).SelectMany(x => x.LiquidTypesRmls).Where(x => x.Rml.Guid == rml.Guid).ToList(); foreach (var idsPack in configuration.IdsPacks.OrderBy(x => x.PackIndex)) { @@ -109,7 +109,7 @@ namespace Tango.UnitTesting Assert.IsNotNull(rml); - List factors = configuration.IdsPacks.OrderBy(x => x.PackIndex).Select(x => x.LiquidType).SelectMany(x => x.LiquidTypesRmls).Where(x => x.Rml.Guid == RML.Guid).ToList(); + List factors = configuration.IdsPacks.OrderBy(x => x.PackIndex).Select(x => x.LiquidType).SelectMany(x => x.LiquidTypesRmls).Where(x => x.Rml.Guid == rml.Guid).ToList(); foreach (var idsPack in configuration.IdsPacks.OrderBy(x => x.PackIndex)) { -- cgit v1.3.1