diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-10-24 16:18:39 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-10-24 16:18:39 +0300 |
| commit | 1e24679bf65e42e5df96113bd1eef371036f0940 (patch) | |
| tree | bb954219f7f5ec0f6e37631cae2c6aa0ac9d184b /Software/Visual_Studio | |
| parent | a4f4b3be2917b13667217cf826c21e8bd644a8c4 (diff) | |
| download | Tango-1e24679bf65e42e5df96113bd1eef371036f0940.tar.gz Tango-1e24679bf65e42e5df96113bd1eef371036f0940.zip | |
Implemented job resume!!
Diffstat (limited to 'Software/Visual_Studio')
25 files changed, 1142 insertions, 92 deletions
diff --git a/Software/Visual_Studio/Build/Shortcuts/Machine Emulator.lnk b/Software/Visual_Studio/Build/Shortcuts/Machine Emulator.lnk Binary files differindex 809dc39a4..0b55f9468 100644 --- a/Software/Visual_Studio/Build/Shortcuts/Machine Emulator.lnk +++ b/Software/Visual_Studio/Build/Shortcuts/Machine Emulator.lnk diff --git a/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk b/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk Binary files differindex aaa476b0b..96378d6e7 100644 --- a/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk +++ b/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk diff --git a/Software/Visual_Studio/Build/Shortcuts/Proto Compiler GUI.lnk b/Software/Visual_Studio/Build/Shortcuts/Proto Compiler GUI.lnk Binary files differindex 349e9582e..8996e8019 100644 --- a/Software/Visual_Studio/Build/Shortcuts/Proto Compiler GUI.lnk +++ b/Software/Visual_Studio/Build/Shortcuts/Proto Compiler GUI.lnk 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 07686165b..efdb8982d 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,6 +45,7 @@ using Tango.AutoComplete.Editors; using System.Data.Entity; using System.Runtime.ExceptionServices; using Tango.BL.Builders; +using Tango.MachineStudio.Common.Navigation; namespace Tango.MachineStudio.Developer.ViewModels { @@ -63,6 +64,7 @@ namespace Tango.MachineStudio.Developer.ViewModels private TimeSpan _runningJobEstimatedDuration; private JobHandler _jobHandler; private DeveloperNavigationManager _navigation; + private INavigationManager _msNavigation; private bool _blockInvalidateCommands; private IAuthenticationProvider _authentication; private ObservablesContext _machineDbContext; @@ -685,7 +687,7 @@ namespace Tango.MachineStudio.Developer.ViewModels /// </summary> /// <param name="applicationManager">The application manager.</param> /// <param name="notificationProvider">The notification provider.</param> - public MainViewVM(IStudioApplicationManager applicationManager, INotificationProvider notificationProvider, IDiagnosticsFrameProvider diagnosticsFrameProvider, IVideoCaptureProvider videoCaptureProvider, DeveloperNavigationManager navigation, IAuthenticationProvider authentication, IEventLogger eventLogger, ISpeechProvider speech) + public MainViewVM(IStudioApplicationManager applicationManager, INotificationProvider notificationProvider, IDiagnosticsFrameProvider diagnosticsFrameProvider, IVideoCaptureProvider videoCaptureProvider, DeveloperNavigationManager navigation, INavigationManager navigationManager, IAuthenticationProvider authentication, IEventLogger eventLogger, ISpeechProvider speech) { CanWork = true; EnableColorConversion = true; @@ -695,6 +697,7 @@ namespace Tango.MachineStudio.Developer.ViewModels _notification = notificationProvider; _speech = speech; _navigation = navigation; + _msNavigation = navigationManager; ApplicationManager = applicationManager; VideoCaptureProvider = videoCaptureProvider; _eventLogger = eventLogger; @@ -720,11 +723,11 @@ namespace Tango.MachineStudio.Developer.ViewModels RemoveBrushStopCommand = new RelayCommand(RemoveSelectedBrushStops, () => SelectedBrushStop != null && CanWork); SaveJobCommand = new RelayCommand(SaveActiveJob, () => SelectedMachine != null && CanWork); DiscardJobCommand = new RelayCommand(BackToJobs, () => SelectedMachine != null && CanWork); - StartJobCommand = new RelayCommand(StartJob, () => ActiveJob != null && CanWork && !IsJobRunning && MachineOperator != null && !MachineOperator.MachineEventsStateProvider.Events.ToList().Exists(x => x.ActionTypes.Contains(BL.Enumerations.ActionTypes.PreventJobExecution))); + StartJobCommand = new RelayCommand(() => StartJob(), () => ActiveJob != null && CanWork && !IsJobRunning && MachineOperator != null && !MachineOperator.MachineEventsStateProvider.Events.ToList().Exists(x => x.ActionTypes.Contains(BL.Enumerations.ActionTypes.PreventJobExecution))); StartJobAndRecordCommand = new RelayCommand(StartJobAndRecord, () => _dataCaptureVM != null && !_dataCaptureVM.Recorder.IsRecording && !_dataCaptureVM.Player.IsPlaying && ActiveJob != null && !IsJobRunning && MachineOperator != null && !MachineOperator.MachineEventsStateProvider.Events.ToList().Exists(x => x.ActionTypes.Contains(BL.Enumerations.ActionTypes.PreventJobExecution))); StopJobCommand = new RelayCommand(StopJob, () => IsJobRunning && CanWork); CloseJobCompletionStatusCommand = new RelayCommand(CloseJobCompletionStatusBar); - LoadJobCommand = new RelayCommand(LoadSelectedJob, () => SelectedMachineJob != null && CanWork); + LoadJobCommand = new RelayCommand(() => LoadSelectedJob(), () => SelectedMachineJob != null && CanWork); DuplicateJobCommand = new RelayCommand(DuplicateSelectedJobs, () => SelectedMachineJob != null && CanWork); DuplicateSegmentCommand = new RelayCommand(DuplicateSelectedSegments, () => SelectedSegment != null && CanWork); DuplicateBrushStopCommand = new RelayCommand(DuplicateSelectedBrushStops, () => SelectedBrushStop != null && CanWork); @@ -912,6 +915,33 @@ namespace Tango.MachineStudio.Developer.ViewModels MachineOperator.MachineEventsStateProvider.NewEvents -= MachineEventsStateProvider_NewEvents; MachineOperator.MachineEventsStateProvider.NewEvents += MachineEventsStateProvider_NewEvents; + + MachineOperator.ResumingJob -= MachineOperator_ResumingJob; + MachineOperator.ResumingJob += MachineOperator_ResumingJob; + } + } + + private void MachineOperator_ResumingJob(object sender, ResumingJobEventArgs e) + { + if (_notification.ShowQuestion("Machine studio has detected a job in progress. Would you like to try and continue from there you were?")) + { + var job = _machineDbContext.Jobs.SingleOrDefault(x => x.Guid == e.JobGuid); + + if (job != null) + { + _msNavigation.NavigateToModule<DeveloperModule>(); + SelectedMachine = _machineDbContext.Machines.SingleOrDefault(x => x.Guid == job.MachineGuid); + SelectedMachineJob = SelectedMachine.Jobs.SingleOrDefault(x => x.Guid == job.Guid); + LoadSelectedJob(() => + { + StartJob(e.Approve); + }); + } + else + { + LogManager.Log($"Could not resume job. The running job with guid '{e.JobGuid}' was not found."); + _notification.ShowError("Could not resume job. The running job was not found."); + } } } @@ -1205,7 +1235,7 @@ namespace Tango.MachineStudio.Developer.ViewModels /// <summary> /// Starts the job. /// </summary> - private void StartJob() + private void StartJob(Func<Job, JobHandler> resumeFunc = null) { LogManager.Log(String.Format("Starting job {0}...", ActiveJob.Name)); if (MachineOperator == null || MachineOperator.State != TransportComponentState.Connected) @@ -1242,7 +1272,14 @@ namespace Tango.MachineStudio.Developer.ViewModels { LogManager.Log("Sending job to machine operator..."); - _jobHandler = MachineOperator.Print(ActiveJob, SelectedProcessParametersTable); + if (resumeFunc == null) + { + _jobHandler = MachineOperator.Print(ActiveJob, SelectedProcessParametersTable); + } + else + { + _jobHandler = resumeFunc(ActiveJob); + } _eventLogger.Log(String.Format("Job '{0}' started...", ActiveJob.Name)); @@ -1573,7 +1610,7 @@ namespace Tango.MachineStudio.Developer.ViewModels /// <summary> /// Loads the selected job. /// </summary> - private async void LoadSelectedJob() + private async void LoadSelectedJob(Action onCompleted = null) { if (SelectedMachineJob != null) { @@ -1662,6 +1699,8 @@ namespace Tango.MachineStudio.Developer.ViewModels } CanWork = true; + + onCompleted?.Invoke(); } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Navigation/INavigationManager.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Navigation/INavigationManager.cs index e20940c8d..6bd4d8829 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Navigation/INavigationManager.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Navigation/INavigationManager.cs @@ -101,6 +101,8 @@ namespace Tango.MachineStudio.Common.Navigation Task<bool> NavigateWithObject<TModule, TView, TPass>(TPass obj, bool pushToHistory = true) where TModule : IStudioModule; + void NavigateToModule<T>() where T : IStudioModule; + /// <summary> /// Clears the navigation back history. /// </summary> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Modules/DefaultStudioModuleLoader.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Modules/DefaultStudioModuleLoader.cs index 0def3c943..28f56e521 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Modules/DefaultStudioModuleLoader.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Modules/DefaultStudioModuleLoader.cs @@ -44,7 +44,10 @@ namespace Tango.MachineStudio.UI.Modules /// <param name="e">The e.</param> private void _authenticationProvider_CurrentUserChanged(object sender, User e) { - LoadModules(); + if (e != null) + { + LoadModules(); + } } private SynchronizedObservableCollection<IStudioModule> _allModules; diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Navigation/DefaultNavigationManager.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Navigation/DefaultNavigationManager.cs index 899ba846e..13ec6161d 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Navigation/DefaultNavigationManager.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Navigation/DefaultNavigationManager.cs @@ -5,6 +5,7 @@ using System.Text; using System.Threading.Tasks; using Tango.Core; using Tango.Core.Commands; +using Tango.Core.DI; using Tango.MachineStudio.Common; using Tango.MachineStudio.Common.Modules; using Tango.MachineStudio.Common.Navigation; @@ -384,5 +385,16 @@ namespace Tango.MachineStudio.UI.Navigation RaisePropertyChanged(nameof(CanNavigateBack)); } + + public void NavigateToModule<T>() where T : IStudioModule + { + var loader = TangoIOC.Default.GetInstance<IStudioModuleLoader>(); + var module = loader.UserModules.SingleOrDefault(x => x.GetType() == typeof(T)); + + if (module != null) + { + TangoIOC.Default.GetInstance<ViewModels.MainViewVM>().StartModule(module); + } + } } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DefaultNotificationProvider.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DefaultNotificationProvider.cs index 6cff1ba17..80509e6c0 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DefaultNotificationProvider.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/DefaultNotificationProvider.cs @@ -11,6 +11,7 @@ using System.Windows.Media; using Tango.Core; using System.Collections.ObjectModel; using Tango.SharedUI; +using System.Collections.Concurrent; namespace Tango.MachineStudio.UI.Notifications { @@ -21,6 +22,8 @@ namespace Tango.MachineStudio.UI.Notifications /// <seealso cref="Tango.MachineStudio.Common.Notifications.INotificationProvider" /> public class DefaultNotificationProvider : ExtendedObject, INotificationProvider { + private int _message_count = 0; + /// <summary> /// The view types /// </summary> @@ -79,6 +82,8 @@ namespace Tango.MachineStudio.UI.Notifications { MainWindow.Instance.shadowGrid.Visibility = Visibility.Visible; + _message_count++; + var result = new MessageBoxWindow() { Owner = Application.Current.MainWindow, @@ -89,7 +94,13 @@ namespace Tango.MachineStudio.UI.Notifications }.ShowDialog(); - MainWindow.Instance.shadowGrid.Visibility = Visibility.Hidden; + _message_count--; + + if (_message_count == 0) + { + MainWindow.Instance.shadowGrid.Visibility = Visibility.Hidden; + } + return result; } @@ -377,8 +388,11 @@ namespace Tango.MachineStudio.UI.Notifications /// <param name="taskItem">The task item.</param> public void PushTaskItem(TaskItem taskItem) { - TaskItems.Add(taskItem); - CurrentTaskItem = taskItem; + InvokeUI(() => + { + TaskItems.Add(taskItem); + CurrentTaskItem = taskItem; + }); } /// <summary> @@ -400,14 +414,20 @@ namespace Tango.MachineStudio.UI.Notifications /// <param name="taskItem">The task item.</param> public void PopTaskItem(TaskItem taskItem) { - TaskItems.Remove(taskItem); - - if (TaskItems.Count > 0) + Task.Delay(1000).ContinueWith((x) => { - CurrentTaskItem = TaskItems.Last(); - } + InvokeUI(() => + { + TaskItems.Remove(taskItem); - RaisePropertyChanged(nameof(HasTaskItems)); + if (TaskItems.Count > 0) + { + CurrentTaskItem = TaskItems.Last(); + } + + RaisePropertyChanged(nameof(HasTaskItems)); + }); + }); } /// <summary> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs index 8be7f486a..3864708fc 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs @@ -25,6 +25,7 @@ using Tango.MachineStudio.UI.ViewModels; using Tango.MachineStudio.Common.Notifications; using Tango.MachineStudio.UI.Views; using Tango.Integration.Operation; +using Tango.MachineStudio.UI.Windows; namespace Tango.MachineStudio.UI.StudioApplication { @@ -39,6 +40,7 @@ namespace Tango.MachineStudio.UI.StudioApplication private IStudioModuleLoader _moduleLoader; private INotificationProvider _notification; private List<Window> _openedWindows; + private List<IStudioViewModel> _notified_view_models; /// <summary> /// Initializes a new instance of the <see cref="DefaultStudioApplicationManager" /> class. @@ -50,6 +52,7 @@ namespace Tango.MachineStudio.UI.StudioApplication _navigationManager = navigationManager; _notification = notification; _openedWindows = new List<Window>(); + _notified_view_models = new List<IStudioViewModel>(); Application.Current.MainWindow.ContentRendered += (_, __) => { @@ -286,6 +289,11 @@ namespace Tango.MachineStudio.UI.StudioApplication window.Closed += (x, y) => { _openedWindows.Remove(window); }; } + public bool IsModuleInNewWindow(IStudioModule module) + { + return _openedWindows.Exists(x => (x as ModuleWindow).ModuleContext.Module == module); + } + /// <summary> /// Gets the core libraries version. /// </summary> @@ -324,7 +332,14 @@ namespace Tango.MachineStudio.UI.StudioApplication /// </summary> public void NotifyApplicationReady() { - TangoIOC.Default.GetAllInstancesByBase<IStudioViewModel>().ToList().ForEach(x => x.OnApplicationReady()); + TangoIOC.Default.GetAllInstancesByBase<IStudioViewModel>().ToList().ForEach(x => + { + if (!_notified_view_models.Contains(x)) + { + x.OnApplicationReady(); + _notified_view_models.Add(x); + } + }); } /// <summary> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs index 9b625a6ee..31e297cd1 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs @@ -649,6 +649,8 @@ namespace Tango.MachineStudio.UI.ViewModels { IsMenuOpened = false; + if ((_applicationManager as DefaultStudioApplicationManager).IsModuleInNewWindow(module)) return; + if (module != null) { LogManager.Log(String.Format("Starting module '{0}'...", module.Name)); diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml index 7edfa50c6..f66e247a9 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml @@ -467,7 +467,7 @@ </Grid> </Grid> - <Border HorizontalAlignment="Right" Margin="0 -1 10 0" VerticalAlignment="Top" Width="300" Height="40" Padding="5" CornerRadius="0 0 30 30" BorderThickness="1 0 1 1" BorderBrush="DimGray"> + <Border HorizontalAlignment="Right" Margin="0 -1 10 0" VerticalAlignment="Top" Width="300" Height="Auto" CornerRadius="0 0 30 30" BorderThickness="1 0 1 1" BorderBrush="DimGray"> <Border.Style> <Style TargetType="Border"> <Setter Property="RenderTransform"> @@ -487,7 +487,7 @@ <DataTrigger.ExitActions> <BeginStoryboard HandoffBehavior="Compose"> <Storyboard> - <DoubleAnimation BeginTime="00:00:02" FillBehavior="HoldEnd" Storyboard.TargetProperty="RenderTransform.ScaleY" To="0" From="1" Duration="00:00:0.5"></DoubleAnimation> + <DoubleAnimation FillBehavior="HoldEnd" Storyboard.TargetProperty="RenderTransform.ScaleY" To="0" From="1" Duration="00:00:0.5"></DoubleAnimation> </Storyboard> </BeginStoryboard> </DataTrigger.ExitActions> @@ -502,10 +502,18 @@ </LinearGradientBrush> </Border.Background> - <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="20 0 0 0"> - <mahapps:ProgressRing Width="24" Height="24" Foreground="White"></mahapps:ProgressRing> - <TextBlock Text="{Binding NotificationProvider.CurrentTaskItem.Message,Converter={StaticResource StringEllipsisConverter},ConverterParameter=35}" Foreground="White" VerticalAlignment="Center" Margin="10 0 0 0" TextWrapping="Wrap"></TextBlock> - </StackPanel> + <ItemsControl ItemsSource="{Binding NotificationProvider.TaskItems}"> + <ItemsControl.ItemTemplate> + <DataTemplate> + <Border Margin="5"> + <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="20 0 0 0"> + <mahapps:ProgressRing Width="24" Height="24" Foreground="White"></mahapps:ProgressRing> + <TextBlock Text="{Binding Message,Converter={StaticResource StringEllipsisConverter},ConverterParameter=35}" Foreground="White" VerticalAlignment="Center" Margin="10 0 0 0" TextWrapping="Wrap"></TextBlock> + </StackPanel> + </Border> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> </Border> <Grid HorizontalAlignment="Right" VerticalAlignment="Top" Margin="10" Visibility="{Binding IsMachineErrorsOpened,Converter={StaticResource BooleanToVisibilityConverter}}"> diff --git a/Software/Visual_Studio/SideChains/Tango.AutoComplete/Editors/AutoCompleteTextBox.cs b/Software/Visual_Studio/SideChains/Tango.AutoComplete/Editors/AutoCompleteTextBox.cs index f350c0b9b..253843a57 100644 --- a/Software/Visual_Studio/SideChains/Tango.AutoComplete/Editors/AutoCompleteTextBox.cs +++ b/Software/Visual_Studio/SideChains/Tango.AutoComplete/Editors/AutoCompleteTextBox.cs @@ -162,7 +162,10 @@ namespace Tango.AutoComplete.Editors { get { return (bool)GetValue(IsDropDownOpenProperty); } - set { SetValue(IsDropDownOpenProperty, value); } + set + { + SetValue(IsDropDownOpenProperty, value); + } } public bool IsLoading @@ -279,6 +282,8 @@ namespace Tango.AutoComplete.Editors public override void OnApplyTemplate() { + _isUpdatingText = true; + base.OnApplyTemplate(); Editor = Template.FindName(PartEditor, this) as TextBox; @@ -315,6 +320,8 @@ namespace Tango.AutoComplete.Editors SelectionAdapter.SelectionChanged += OnSelectionAdapterSelectionChanged; ItemsSelector.PreviewMouseDown += ItemsSelector_PreviewMouseDown; } + + _isUpdatingText = false; } private void ItemsSelector_PreviewMouseDown(object sender, MouseButtonEventArgs e) { diff --git a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs index 7954b2324..9dabb6508 100644 --- a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs +++ b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs @@ -61,6 +61,8 @@ namespace Tango.Emulations.Emulators private bool _events_enabled; private List<SetBlowerStateRequest> _blower_states; private List<ValveState> _valveStates; + private JobTicket _current_job_ticket; + private String _current_job_resume_token; #region Properties @@ -301,6 +303,12 @@ namespace Tango.Emulations.Emulators case MessageType.SetValveStateRequest: HandleSetValveStateRequest(MessageFactory.ParseTangoMessageFromContainer<SetValveStateRequest>(container)); break; + case MessageType.CurrentJobRequest: + HandleCurrentJobRequest(MessageFactory.ParseTangoMessageFromContainer<CurrentJobRequest>(container)); + break; + case MessageType.ResumeCurrentJobRequest: + HandleResumeCurrentJobRequest(MessageFactory.ParseTangoMessageFromContainer<ResumeCurrentJobRequest>(container)); + break; } } @@ -481,6 +489,8 @@ namespace Tango.Emulations.Emulators private void HandleJobRequest(TangoMessage<JobRequest> request) { JobTicket job = request.Message.JobTicket; + _current_job_ticket = job; + _current_job_resume_token = null; double centimeter_per_second = request.Message.JobTicket.ProcessParameters.DyeingSpeed; @@ -501,34 +511,71 @@ namespace Tango.Emulations.Emulators status.Message = "Demo Message From Emulator..."; } - Transporter.SendResponse<JobResponse>(new JobResponse() + if (_current_job_resume_token == null) { - Status = status, + Transporter.SendResponse<JobResponse>(new JobResponse() + { + Status = status, - }, request.Container.Token); + }, request.Container.Token); + } + else + { + Transporter.SendResponse<ResumeCurrentJobResponse>(new ResumeCurrentJobResponse() + { + Status = status, + + }, _current_job_resume_token); + } progress += Math.Min((centimeter_per_second / 1000d), (job.Length + job.ProcessParameters.DryerBufferLength) - progress); Thread.Sleep(100); } + _current_job_ticket = null; + if (_cancelJob) { - Transporter.SendResponse<JobResponse>(new JobResponse() + if (_current_job_resume_token == null) { + Transporter.SendResponse<JobResponse>(new JobResponse() + { - }, request.Container.Token, false, ErrorCode.ContinuousResponseAborted); + }, request.Container.Token, false, ErrorCode.ContinuousResponseAborted); + } + else + { + Transporter.SendResponse<ResumeCurrentJobResponse>(new ResumeCurrentJobResponse() + { + + }, request.Container.Token, false, ErrorCode.ContinuousResponseAborted); + } } else { - Transporter.SendResponse<JobResponse>(new JobResponse() + if (_current_job_resume_token == null) { - Status = new PMR.Printing.JobStatus() + Transporter.SendResponse<JobResponse>(new JobResponse() { - Progress = job.Length + job.ProcessParameters.DryerBufferLength, - } + Status = new PMR.Printing.JobStatus() + { + Progress = job.Length + job.ProcessParameters.DryerBufferLength, + } - }, request.Container.Token, !_cancelJob); + }, request.Container.Token, !_cancelJob); + } + else + { + Transporter.SendResponse<ResumeCurrentJobResponse>(new ResumeCurrentJobResponse() + { + Status = new PMR.Printing.JobStatus() + { + Progress = job.Length + job.ProcessParameters.DryerBufferLength, + } + + }, request.Container.Token, !_cancelJob); + } } }); } @@ -879,6 +926,27 @@ namespace Tango.Emulations.Emulators Transporter.SendResponse<SetValveStateResponse>(new SetValveStateResponse(), request.Container.Token); } + private void HandleCurrentJobRequest(TangoMessage<CurrentJobRequest> request) + { + Transporter.SendResponse<CurrentJobResponse>(new CurrentJobResponse() + { + IsJobInProgress = _current_job_ticket != null, + JobTicket = _current_job_ticket, + }, request.Container.Token); + } + + private void HandleResumeCurrentJobRequest(TangoMessage<ResumeCurrentJobRequest> request) + { + if (_current_job_ticket != null) + { + _current_job_resume_token = request.Container.Token; + } + else + { + Transporter.SendResponse<ResumeCurrentJobResponse>(new ResumeCurrentJobResponse(), request.Container.Token, true, ErrorCode.NoJobInProgress); + } + } + #endregion #region Public Methods diff --git a/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs index e76057d2f..58c2f32f0 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs @@ -80,6 +80,11 @@ namespace Tango.Integration.Operation event EventHandler<PrintingEventArgs> PrintingCompleted; /// <summary> + /// Occurs when the machine operator has detected that a job is in progress after connecting to the machine. + /// </summary> + event EventHandler<ResumingJobEventArgs> ResumingJob; + + /// <summary> /// Occurs when a request has been sent. /// </summary> event EventHandler<IMessage> RequestSent; @@ -130,6 +135,11 @@ namespace Tango.Integration.Operation bool EnableEmbeddedDebugging { get; set; } /// <summary> + /// Gets or sets a value indicating whether to check whether a job is in progress after connection was successful. + /// </summary> + bool EnableJobResume { get; set; } + + /// <summary> /// Gets the last process parameters table sent to the embedded device. /// </summary> ProcessParametersTable CurrentProcessParameters { get; } diff --git a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs index 8098f755d..d098d9bb9 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs @@ -70,6 +70,7 @@ namespace Tango.Integration.Operation DeviceInformation = new DeviceInformation(); MachineEventsStateProvider = new DefaultMachineEventsStateProvider(); EnableEventsNotification = true; + EnableJobResume = true; LogEmbeddedDebuggingToFile = true; } @@ -146,6 +147,11 @@ namespace Tango.Integration.Operation /// </summary> public event EventHandler<PrintingEventArgs> PrintingAborted; + /// <summary> + /// Occurs when the machine operator has detected that a job is in progress after connecting to the machine. + /// </summary> + public event EventHandler<ResumingJobEventArgs> ResumingJob; + #endregion #region Properties @@ -279,6 +285,22 @@ namespace Tango.Integration.Operation } } + private bool _enableJobResume; + /// <summary> + /// Gets or sets a value indicating whether to check whether a job is in progress after connection was successful. + /// </summary> + public bool EnableJobResume + { + get + { + return _enableJobResume; + } + set + { + _enableJobResume = value; RaisePropertyChangedAuto(); + } + } + private bool _logEmbeddedDebuggingToFile; /// <summary> /// Gets or sets a value indicating whether to automatically save incoming log data from the embedded device. @@ -673,6 +695,11 @@ namespace Tango.Integration.Operation OnEnableDiagnosticsChanged(EnableDiagnostics); OnEnableEmbeddedDebuggingChanged(EnableEmbeddedDebugging); OnEnableEventsNotification(EnableEventsNotification); + + if (EnableJobResume) + { + ResumeJob(); + } } catch (Exception ex) { @@ -796,6 +823,7 @@ namespace Tango.Integration.Operation } JobTicket ticket = new JobTicket(); + ticket.Guid = originalJob.Guid; ticket.EnableInterSegment = job.EnableInterSegment; ticket.InterSegmentLength = job.InterSegmentLength; ticket.Length = job.Length; @@ -1345,6 +1373,119 @@ namespace Tango.Integration.Operation #region Private Methods + private async void ResumeJob() + { + LogManager.Log("Checking is a job is in progress..."); + var res = await SendRequest<CurrentJobRequest, CurrentJobResponse>(new CurrentJobRequest()); + if (res.Message.IsJobInProgress) + { + JobTicket jobTicket = res.Message.JobTicket; + + ProcessParametersTable processParameters = new ProcessParametersTable(); + jobTicket.ProcessParameters.MapPrimitivesTo(processParameters); + + ResumingJobEventArgs args = new ResumingJobEventArgs((job) => + { + if (Status != MachineStatuses.ReadyToDye) + { + throw new InvalidOperationException("Could not print while status = " + Status); + } + + RunningJob = null; + RunningJobStatus = null; + + var originalJob = job; + + CurrentProcessParameters = processParameters; + + if (job.NumberOfUnits < 1) + { + job.NumberOfUnits = 1; + } + + job = job.Clone(); + + var segments = job.Segments.ToList(); + + for (int i = 0; i < job.NumberOfUnits - 1; i++) + { + foreach (var s in segments) + { + job.Segments.Add(s); + } + } + + var request = new ResumeCurrentJobRequest(); + + JobHandler handler = null; + + handler = new JobHandler(async () => + { + try + { + var result = await SendRequest<AbortJobRequest, AbortJobResponse>(new AbortJobRequest()); + PrintingAborted?.Invoke(this, new PrintingEventArgs(handler, originalJob)); + handler.RaiseCanceled(); + } + catch (Exception ex) + { + LogManager.Log(ex, "Failed to cancel job."); + } + }, originalJob, processParameters, JobHandlingMode); + + handler.StatusChanged += (x, s) => + { + RunningJobStatus = s; + }; + + LogRequestSent(request); + + bool responseLogged = false; + + SendContinuousRequest<ResumeCurrentJobRequest, ResumeCurrentJobResponse>(request, null, TimeSpan.FromSeconds(2)).Subscribe((response) => + { + handler.RaiseStatusReceived(response.Message.Status); + + if (!responseLogged) + { + responseLogged = true; + Status = MachineStatuses.Printing; + RunningJob = originalJob; + PrintingStarted?.Invoke(this, new PrintingEventArgs(handler, originalJob)); + LogResponseReceived(response.Message); + } + }, (ex) => + { + if (!(ex is ContinuousResponseAbortedException)) + { + Status = MachineStatuses.ReadyToDye; + + if (!handler.IsCanceled) + { + PrintingFailed?.Invoke(this, new PrintingFailedEventArgs(handler, originalJob, ex)); + handler.RaiseFailed(ex); + LogRequestFailed(request, ex); + } + } + else + { + Status = MachineStatuses.ReadyToDye; + } + }, () => + { + Status = MachineStatuses.ReadyToDye; + PrintingCompleted?.Invoke(this, new PrintingEventArgs(handler, originalJob)); + handler.RaiseCompleted(); + }); + + return handler; + }); + + args.JobGuid = jobTicket.Guid; + ResumingJob?.Invoke(this, args); + } + } + /// <summary> /// Logs the request sent. /// </summary> diff --git a/Software/Visual_Studio/Tango.Integration/Operation/ResumingJobEventArgs.cs b/Software/Visual_Studio/Tango.Integration/Operation/ResumingJobEventArgs.cs new file mode 100644 index 000000000..6a8546350 --- /dev/null +++ b/Software/Visual_Studio/Tango.Integration/Operation/ResumingJobEventArgs.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Entities; + +namespace Tango.Integration.Operation +{ + public class ResumingJobEventArgs : EventArgs + { + private Func<Job,JobHandler> _approveAction; + + public String JobGuid { get; set; } + + public ResumingJobEventArgs(Func<Job, JobHandler> approveAction) + { + _approveAction = approveAction; + } + + public JobHandler Approve(Job job) + { + return _approveAction(job); + } + } +} diff --git a/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj b/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj index b6b1999cd..a5620aa3a 100644 --- a/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj +++ b/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj @@ -95,6 +95,7 @@ <Compile Include="Operation\MachineStatuses.cs" /> <Compile Include="Operation\PrintingEventArgs.cs" /> <Compile Include="Operation\RequestFailedEventArgs.cs" /> + <Compile Include="Operation\ResumingJobEventArgs.cs" /> <Compile Include="Operation\RunningJobStatus.cs" /> <Compile Include="ExternalBridge\ExternalBridgeScanner.cs" /> <Compile Include="ExternalBridge\ExternalBridgeService.cs" /> @@ -152,7 +153,7 @@ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> + <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> </VisualStudio> </ProjectExtensions> </Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/Tango.PMR/Common/ErrorCode.cs b/Software/Visual_Studio/Tango.PMR/Common/ErrorCode.cs index a1a225ab2..eb58a8672 100644 --- a/Software/Visual_Studio/Tango.PMR/Common/ErrorCode.cs +++ b/Software/Visual_Studio/Tango.PMR/Common/ErrorCode.cs @@ -22,7 +22,7 @@ namespace Tango.PMR.Common { static ErrorCodeReflection() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( - "Cg9FcnJvckNvZGUucHJvdG8SEFRhbmdvLlBNUi5Db21tb24q1AMKCUVycm9y", + "Cg9FcnJvckNvZGUucHJvdG8SEFRhbmdvLlBNUi5Db21tb24q7QMKCUVycm9y", "Q29kZRIICgROT05FEAASEQoNR0VORVJBTF9FUlJPUhABEgsKB0JBRF9DUkMQ", "AhIeChpJTlZBTElEX0RJR0lUQUxfUElOX05VTUJFUhADEhsKF1VOQVVUSE9S", "SVpFRF9DT05ORUNUSU9OEAQSHwobQ09OVElOVU9VU19SRVNQT05TRV9BQk9S", @@ -33,8 +33,8 @@ namespace Tango.PMR.Common { "X1RIUkVBRF9CUkVBSxDRDxIbChZKT0JfV0lOREVSX0RBTkNFUl9GQUlMENIP", "EhsKFkpPQl9QT09MRVJfREFOQ0VSX0ZBSUwQ0w8SGwoWSk9CX0ZFRURFUl9E", "QU5DRVJfRkFJTBDUDxITCg5KT0JfT1VUX09GX0RZRRDVDxIUCg9KT0JfT1RI", - "RVJfQUxBUk0Q1g9CHAoaY29tLnR3aW5lLnRhbmdvLnBtci5jb21tb25iBnBy", - "b3RvMw==")); + "RVJfQUxBUk0Q1g8SFwoSTk9fSk9CX0lOX1BST0dSRVNTENcPQhwKGmNvbS50", + "d2luZS50YW5nby5wbXIuY29tbW9uYgZwcm90bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Tango.PMR.Common.ErrorCode), }, null)); @@ -90,6 +90,10 @@ namespace Tango.PMR.Common { [pbr::OriginalName("JOB_FEEDER_DANCER_FAIL")] JobFeederDancerFail = 2004, [pbr::OriginalName("JOB_OUT_OF_DYE")] JobOutOfDye = 2005, [pbr::OriginalName("JOB_OTHER_ALARM")] JobOtherAlarm = 2006, + /// <summary> + ///Occurs when ResumeCurrentJobRequest was called but no job is in progress. + /// </summary> + [pbr::OriginalName("NO_JOB_IN_PROGRESS")] NoJobInProgress = 2007, } #endregion diff --git a/Software/Visual_Studio/Tango.PMR/Common/MessageType.cs b/Software/Visual_Studio/Tango.PMR/Common/MessageType.cs index fa916a3a3..f6089ba04 100644 --- a/Software/Visual_Studio/Tango.PMR/Common/MessageType.cs +++ b/Software/Visual_Studio/Tango.PMR/Common/MessageType.cs @@ -22,7 +22,7 @@ namespace Tango.PMR.Common { static MessageTypeReflection() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( - "ChFNZXNzYWdlVHlwZS5wcm90bxIQVGFuZ28uUE1SLkNvbW1vbiqVKQoLTWVz", + "ChFNZXNzYWdlVHlwZS5wcm90bxIQVGFuZ28uUE1SLkNvbW1vbiqDKgoLTWVz", "c2FnZVR5cGUSCAoETm9uZRAAEhEKDUVycm9yUmVzcG9uc2UQARIUChBDYWxj", "dWxhdGVSZXF1ZXN0EAMSFQoRQ2FsY3VsYXRlUmVzcG9uc2UQBBITCg9Qcm9n", "cmVzc1JlcXVlc3QQBRIUChBQcm9ncmVzc1Jlc3BvbnNlEAYSHAoYU3R1YkNh", @@ -122,25 +122,28 @@ namespace Tango.PMR.Common { "cG9uc2UQ9w8SDwoKSm9iUmVxdWVzdBC4FxIQCgtKb2JSZXNwb25zZRC5FxIU", "Cg9BYm9ydEpvYlJlcXVlc3QQuhcSFQoQQWJvcnRKb2JSZXNwb25zZRC7FxIj", "Ch5VcGxvYWRQcm9jZXNzUGFyYW1ldGVyc1JlcXVlc3QQvBcSJAofVXBsb2Fk", - "UHJvY2Vzc1BhcmFtZXRlcnNSZXNwb25zZRC9FxIZChRTdGFydERlYnVnTG9n", - "UmVxdWVzdBCgHxIaChVTdGFydERlYnVnTG9nUmVzcG9uc2UQoR8SGAoTU3Rv", - "cERlYnVnTG9nUmVxdWVzdBCiHxIZChRTdG9wRGVidWdMb2dSZXNwb25zZRCj", - "HxInCiJVcGxvYWRIYXJkd2FyZUNvbmZpZ3VyYXRpb25SZXF1ZXN0EIgnEigK", - "I1VwbG9hZEhhcmR3YXJlQ29uZmlndXJhdGlvblJlc3BvbnNlEIknEhcKElN5", - "c3RlbVJlc2V0UmVxdWVzdBCKJxIYChNTeXN0ZW1SZXNldFJlc3BvbnNlEIsn", - "EhUKEEtlZXBBbGl2ZVJlcXVlc3QQ8C4SFgoRS2VlcEFsaXZlUmVzcG9uc2UQ", - "8S4SEwoOQ29ubmVjdFJlcXVlc3QQ8i4SFAoPQ29ubmVjdFJlc3BvbnNlEPMu", - "EhYKEURpc2Nvbm5lY3RSZXF1ZXN0EPQuEhcKEkRpc2Nvbm5lY3RSZXNwb25z", - "ZRD1LhIWChFGaWxlVXBsb2FkUmVxdWVzdBDYNhIXChJGaWxlVXBsb2FkUmVz", - "cG9uc2UQ2TYSGwoWRmlsZUNodW5rVXBsb2FkUmVxdWVzdBDaNhIcChdGaWxl", - "Q2h1bmtVcGxvYWRSZXNwb25zZRDbNhIaChVFeGVjdXRlUHJvY2Vzc1JlcXVl", - "c3QQ3DYSGwoWRXhlY3V0ZVByb2Nlc3NSZXNwb25zZRDdNhIXChJLaWxsUHJv", - "Y2Vzc1JlcXVlc3QQ3jYSGAoTS2lsbFByb2Nlc3NSZXNwb25zZRDfNhISCg1D", - "cmVhdGVSZXF1ZXN0EOA2EhMKDkNyZWF0ZVJlc3BvbnNlEOE2EhIKDURlbGV0", - "ZVJlcXVlc3QQ4jYSEwoORGVsZXRlUmVzcG9uc2UQ4zYSGgoVR2V0U3RvcmFn", - "ZUluZm9SZXF1ZXN0EOQ2EhsKFkdldFN0b3JhZ2VJbmZvUmVzcG9uc2UQ5TYS", - "FAoPR2V0RmlsZXNSZXF1ZXN0EOY2EhUKEEdldEZpbGVzUmVzcG9uc2UQ5zZC", - "HAoaY29tLnR3aW5lLnRhbmdvLnBtci5jb21tb25iBnByb3RvMw==")); + "UHJvY2Vzc1BhcmFtZXRlcnNSZXNwb25zZRC9FxIWChFDdXJyZW50Sm9iUmVx", + "dWVzdBC+FxIXChJDdXJyZW50Sm9iUmVzcG9uc2UQvxcSHAoXUmVzdW1lQ3Vy", + "cmVudEpvYlJlcXVlc3QQwBcSHQoYUmVzdW1lQ3VycmVudEpvYlJlc3BvbnNl", + "EMEXEhkKFFN0YXJ0RGVidWdMb2dSZXF1ZXN0EKAfEhoKFVN0YXJ0RGVidWdM", + "b2dSZXNwb25zZRChHxIYChNTdG9wRGVidWdMb2dSZXF1ZXN0EKIfEhkKFFN0", + "b3BEZWJ1Z0xvZ1Jlc3BvbnNlEKMfEicKIlVwbG9hZEhhcmR3YXJlQ29uZmln", + "dXJhdGlvblJlcXVlc3QQiCcSKAojVXBsb2FkSGFyZHdhcmVDb25maWd1cmF0", + "aW9uUmVzcG9uc2UQiScSFwoSU3lzdGVtUmVzZXRSZXF1ZXN0EIonEhgKE1N5", + "c3RlbVJlc2V0UmVzcG9uc2UQiycSFQoQS2VlcEFsaXZlUmVxdWVzdBDwLhIW", + "ChFLZWVwQWxpdmVSZXNwb25zZRDxLhITCg5Db25uZWN0UmVxdWVzdBDyLhIU", + "Cg9Db25uZWN0UmVzcG9uc2UQ8y4SFgoRRGlzY29ubmVjdFJlcXVlc3QQ9C4S", + "FwoSRGlzY29ubmVjdFJlc3BvbnNlEPUuEhYKEUZpbGVVcGxvYWRSZXF1ZXN0", + "ENg2EhcKEkZpbGVVcGxvYWRSZXNwb25zZRDZNhIbChZGaWxlQ2h1bmtVcGxv", + "YWRSZXF1ZXN0ENo2EhwKF0ZpbGVDaHVua1VwbG9hZFJlc3BvbnNlENs2EhoK", + "FUV4ZWN1dGVQcm9jZXNzUmVxdWVzdBDcNhIbChZFeGVjdXRlUHJvY2Vzc1Jl", + "c3BvbnNlEN02EhcKEktpbGxQcm9jZXNzUmVxdWVzdBDeNhIYChNLaWxsUHJv", + "Y2Vzc1Jlc3BvbnNlEN82EhIKDUNyZWF0ZVJlcXVlc3QQ4DYSEwoOQ3JlYXRl", + "UmVzcG9uc2UQ4TYSEgoNRGVsZXRlUmVxdWVzdBDiNhITCg5EZWxldGVSZXNw", + "b25zZRDjNhIaChVHZXRTdG9yYWdlSW5mb1JlcXVlc3QQ5DYSGwoWR2V0U3Rv", + "cmFnZUluZm9SZXNwb25zZRDlNhIUCg9HZXRGaWxlc1JlcXVlc3QQ5jYSFQoQ", + "R2V0RmlsZXNSZXNwb25zZRDnNkIcChpjb20udHdpbmUudGFuZ28ucG1yLmNv", + "bW1vbmIGcHJvdG8z")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Tango.PMR.Common.MessageType), }, null)); @@ -321,6 +324,10 @@ namespace Tango.PMR.Common { [pbr::OriginalName("AbortJobResponse")] AbortJobResponse = 3003, [pbr::OriginalName("UploadProcessParametersRequest")] UploadProcessParametersRequest = 3004, [pbr::OriginalName("UploadProcessParametersResponse")] UploadProcessParametersResponse = 3005, + [pbr::OriginalName("CurrentJobRequest")] CurrentJobRequest = 3006, + [pbr::OriginalName("CurrentJobResponse")] CurrentJobResponse = 3007, + [pbr::OriginalName("ResumeCurrentJobRequest")] ResumeCurrentJobRequest = 3008, + [pbr::OriginalName("ResumeCurrentJobResponse")] ResumeCurrentJobResponse = 3009, /// <summary> ///Debugging /// </summary> diff --git a/Software/Visual_Studio/Tango.PMR/Printing/CurrentJobRequest.cs b/Software/Visual_Studio/Tango.PMR/Printing/CurrentJobRequest.cs new file mode 100644 index 000000000..2c5331fe5 --- /dev/null +++ b/Software/Visual_Studio/Tango.PMR/Printing/CurrentJobRequest.cs @@ -0,0 +1,131 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: CurrentJobRequest.proto +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Tango.PMR.Printing { + + /// <summary>Holder for reflection information generated from CurrentJobRequest.proto</summary> + public static partial class CurrentJobRequestReflection { + + #region Descriptor + /// <summary>File descriptor for CurrentJobRequest.proto</summary> + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static CurrentJobRequestReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "ChdDdXJyZW50Sm9iUmVxdWVzdC5wcm90bxISVGFuZ28uUE1SLlByaW50aW5n", + "IhMKEUN1cnJlbnRKb2JSZXF1ZXN0Qh4KHGNvbS50d2luZS50YW5nby5wbXIu", + "cHJpbnRpbmdiBnByb3RvMw==")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Printing.CurrentJobRequest), global::Tango.PMR.Printing.CurrentJobRequest.Parser, null, null, null, null) + })); + } + #endregion + + } + #region Messages + public sealed partial class CurrentJobRequest : pb::IMessage<CurrentJobRequest> { + private static readonly pb::MessageParser<CurrentJobRequest> _parser = new pb::MessageParser<CurrentJobRequest>(() => new CurrentJobRequest()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser<CurrentJobRequest> Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tango.PMR.Printing.CurrentJobRequestReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CurrentJobRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CurrentJobRequest(CurrentJobRequest other) : this() { + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CurrentJobRequest Clone() { + return new CurrentJobRequest(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as CurrentJobRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(CurrentJobRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(CurrentJobRequest other) { + if (other == null) { + return; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + } + } + } + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/Software/Visual_Studio/Tango.PMR/Printing/CurrentJobResponse.cs b/Software/Visual_Studio/Tango.PMR/Printing/CurrentJobResponse.cs new file mode 100644 index 000000000..70cc3798a --- /dev/null +++ b/Software/Visual_Studio/Tango.PMR/Printing/CurrentJobResponse.cs @@ -0,0 +1,195 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: CurrentJobResponse.proto +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Tango.PMR.Printing { + + /// <summary>Holder for reflection information generated from CurrentJobResponse.proto</summary> + public static partial class CurrentJobResponseReflection { + + #region Descriptor + /// <summary>File descriptor for CurrentJobResponse.proto</summary> + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static CurrentJobResponseReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "ChhDdXJyZW50Sm9iUmVzcG9uc2UucHJvdG8SElRhbmdvLlBNUi5QcmludGlu", + "ZxoPSm9iVGlja2V0LnByb3RvIl8KEkN1cnJlbnRKb2JSZXNwb25zZRIXCg9J", + "c0pvYkluUHJvZ3Jlc3MYASABKAgSMAoJSm9iVGlja2V0GAIgASgLMh0uVGFu", + "Z28uUE1SLlByaW50aW5nLkpvYlRpY2tldEIeChxjb20udHdpbmUudGFuZ28u", + "cG1yLnByaW50aW5nYgZwcm90bzM=")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { global::Tango.PMR.Printing.JobTicketReflection.Descriptor, }, + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Printing.CurrentJobResponse), global::Tango.PMR.Printing.CurrentJobResponse.Parser, new[]{ "IsJobInProgress", "JobTicket" }, null, null, null) + })); + } + #endregion + + } + #region Messages + public sealed partial class CurrentJobResponse : pb::IMessage<CurrentJobResponse> { + private static readonly pb::MessageParser<CurrentJobResponse> _parser = new pb::MessageParser<CurrentJobResponse>(() => new CurrentJobResponse()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser<CurrentJobResponse> Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tango.PMR.Printing.CurrentJobResponseReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CurrentJobResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CurrentJobResponse(CurrentJobResponse other) : this() { + isJobInProgress_ = other.isJobInProgress_; + JobTicket = other.jobTicket_ != null ? other.JobTicket.Clone() : null; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public CurrentJobResponse Clone() { + return new CurrentJobResponse(this); + } + + /// <summary>Field number for the "IsJobInProgress" field.</summary> + public const int IsJobInProgressFieldNumber = 1; + private bool isJobInProgress_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool IsJobInProgress { + get { return isJobInProgress_; } + set { + isJobInProgress_ = value; + } + } + + /// <summary>Field number for the "JobTicket" field.</summary> + public const int JobTicketFieldNumber = 2; + private global::Tango.PMR.Printing.JobTicket jobTicket_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Tango.PMR.Printing.JobTicket JobTicket { + get { return jobTicket_; } + set { + jobTicket_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as CurrentJobResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(CurrentJobResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (IsJobInProgress != other.IsJobInProgress) return false; + if (!object.Equals(JobTicket, other.JobTicket)) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (IsJobInProgress != false) hash ^= IsJobInProgress.GetHashCode(); + if (jobTicket_ != null) hash ^= JobTicket.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (IsJobInProgress != false) { + output.WriteRawTag(8); + output.WriteBool(IsJobInProgress); + } + if (jobTicket_ != null) { + output.WriteRawTag(18); + output.WriteMessage(JobTicket); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (IsJobInProgress != false) { + size += 1 + 1; + } + if (jobTicket_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(JobTicket); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(CurrentJobResponse other) { + if (other == null) { + return; + } + if (other.IsJobInProgress != false) { + IsJobInProgress = other.IsJobInProgress; + } + if (other.jobTicket_ != null) { + if (jobTicket_ == null) { + jobTicket_ = new global::Tango.PMR.Printing.JobTicket(); + } + JobTicket.MergeFrom(other.JobTicket); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 8: { + IsJobInProgress = input.ReadBool(); + break; + } + case 18: { + if (jobTicket_ == null) { + jobTicket_ = new global::Tango.PMR.Printing.JobTicket(); + } + input.ReadMessage(jobTicket_); + break; + } + } + } + } + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/Software/Visual_Studio/Tango.PMR/Printing/JobTicket.cs b/Software/Visual_Studio/Tango.PMR/Printing/JobTicket.cs index 80a21bd6a..73aac06dc 100644 --- a/Software/Visual_Studio/Tango.PMR/Printing/JobTicket.cs +++ b/Software/Visual_Studio/Tango.PMR/Printing/JobTicket.cs @@ -24,19 +24,20 @@ namespace Tango.PMR.Printing { string.Concat( "Cg9Kb2JUaWNrZXQucHJvdG8SElRhbmdvLlBNUi5QcmludGluZxoQSm9iU2Vn", "bWVudC5wcm90bxoXUHJvY2Vzc1BhcmFtZXRlcnMucHJvdG8aFkpvYldpbmRp", - "bmdNZXRob2QucHJvdG8aDkpvYlNwb29sLnByb3RvIr8CCglKb2JUaWNrZXQS", - "DAoETmFtZRgBIAEoCRIaChJFbmFibGVJbnRlclNlZ21lbnQYAiABKAgSGgoS", - "SW50ZXJTZWdtZW50TGVuZ3RoGAMgASgBEg4KBkxlbmd0aBgEIAEoARJAChFQ", - "cm9jZXNzUGFyYW1ldGVycxgFIAEoCzIlLlRhbmdvLlBNUi5QcmludGluZy5Q", - "cm9jZXNzUGFyYW1ldGVycxI7Cg1XaW5kaW5nTWV0aG9kGAYgASgOMiQuVGFu", - "Z28uUE1SLlByaW50aW5nLkpvYldpbmRpbmdNZXRob2QSKwoFU3Bvb2wYByAB", - "KAsyHC5UYW5nby5QTVIuUHJpbnRpbmcuSm9iU3Bvb2wSMAoIU2VnbWVudHMY", - "CCADKAsyHi5UYW5nby5QTVIuUHJpbnRpbmcuSm9iU2VnbWVudEIeChxjb20u", - "dHdpbmUudGFuZ28ucG1yLnByaW50aW5nYgZwcm90bzM=")); + "bmdNZXRob2QucHJvdG8aDkpvYlNwb29sLnByb3RvIs0CCglKb2JUaWNrZXQS", + "DAoEZ3VpZBgBIAEoCRIMCgROYW1lGAIgASgJEhoKEkVuYWJsZUludGVyU2Vn", + "bWVudBgDIAEoCBIaChJJbnRlclNlZ21lbnRMZW5ndGgYBCABKAESDgoGTGVu", + "Z3RoGAUgASgBEkAKEVByb2Nlc3NQYXJhbWV0ZXJzGAYgASgLMiUuVGFuZ28u", + "UE1SLlByaW50aW5nLlByb2Nlc3NQYXJhbWV0ZXJzEjsKDVdpbmRpbmdNZXRo", + "b2QYByABKA4yJC5UYW5nby5QTVIuUHJpbnRpbmcuSm9iV2luZGluZ01ldGhv", + "ZBIrCgVTcG9vbBgIIAEoCzIcLlRhbmdvLlBNUi5QcmludGluZy5Kb2JTcG9v", + "bBIwCghTZWdtZW50cxgJIAMoCzIeLlRhbmdvLlBNUi5QcmludGluZy5Kb2JT", + "ZWdtZW50Qh4KHGNvbS50d2luZS50YW5nby5wbXIucHJpbnRpbmdiBnByb3Rv", + "Mw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::Tango.PMR.Printing.JobSegmentReflection.Descriptor, global::Tango.PMR.Printing.ProcessParametersReflection.Descriptor, global::Tango.PMR.Printing.JobWindingMethodReflection.Descriptor, global::Tango.PMR.Printing.JobSpoolReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Printing.JobTicket), global::Tango.PMR.Printing.JobTicket.Parser, new[]{ "Name", "EnableInterSegment", "InterSegmentLength", "Length", "ProcessParameters", "WindingMethod", "Spool", "Segments" }, null, null, null) + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Printing.JobTicket), global::Tango.PMR.Printing.JobTicket.Parser, new[]{ "Guid", "Name", "EnableInterSegment", "InterSegmentLength", "Length", "ProcessParameters", "WindingMethod", "Spool", "Segments" }, null, null, null) })); } #endregion @@ -67,6 +68,7 @@ namespace Tango.PMR.Printing { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public JobTicket(JobTicket other) : this() { + guid_ = other.guid_; name_ = other.name_; enableInterSegment_ = other.enableInterSegment_; interSegmentLength_ = other.interSegmentLength_; @@ -82,8 +84,19 @@ namespace Tango.PMR.Printing { return new JobTicket(this); } + /// <summary>Field number for the "guid" field.</summary> + public const int GuidFieldNumber = 1; + private string guid_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Guid { + get { return guid_; } + set { + guid_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + /// <summary>Field number for the "Name" field.</summary> - public const int NameFieldNumber = 1; + public const int NameFieldNumber = 2; private string name_ = ""; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Name { @@ -94,7 +107,7 @@ namespace Tango.PMR.Printing { } /// <summary>Field number for the "EnableInterSegment" field.</summary> - public const int EnableInterSegmentFieldNumber = 2; + public const int EnableInterSegmentFieldNumber = 3; private bool enableInterSegment_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool EnableInterSegment { @@ -105,7 +118,7 @@ namespace Tango.PMR.Printing { } /// <summary>Field number for the "InterSegmentLength" field.</summary> - public const int InterSegmentLengthFieldNumber = 3; + public const int InterSegmentLengthFieldNumber = 4; private double interSegmentLength_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public double InterSegmentLength { @@ -116,7 +129,7 @@ namespace Tango.PMR.Printing { } /// <summary>Field number for the "Length" field.</summary> - public const int LengthFieldNumber = 4; + public const int LengthFieldNumber = 5; private double length_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public double Length { @@ -127,7 +140,7 @@ namespace Tango.PMR.Printing { } /// <summary>Field number for the "ProcessParameters" field.</summary> - public const int ProcessParametersFieldNumber = 5; + public const int ProcessParametersFieldNumber = 6; private global::Tango.PMR.Printing.ProcessParameters processParameters_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Tango.PMR.Printing.ProcessParameters ProcessParameters { @@ -138,7 +151,7 @@ namespace Tango.PMR.Printing { } /// <summary>Field number for the "WindingMethod" field.</summary> - public const int WindingMethodFieldNumber = 6; + public const int WindingMethodFieldNumber = 7; private global::Tango.PMR.Printing.JobWindingMethod windingMethod_ = 0; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Tango.PMR.Printing.JobWindingMethod WindingMethod { @@ -149,7 +162,7 @@ namespace Tango.PMR.Printing { } /// <summary>Field number for the "Spool" field.</summary> - public const int SpoolFieldNumber = 7; + public const int SpoolFieldNumber = 8; private global::Tango.PMR.Printing.JobSpool spool_; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Tango.PMR.Printing.JobSpool Spool { @@ -160,9 +173,9 @@ namespace Tango.PMR.Printing { } /// <summary>Field number for the "Segments" field.</summary> - public const int SegmentsFieldNumber = 8; + public const int SegmentsFieldNumber = 9; private static readonly pb::FieldCodec<global::Tango.PMR.Printing.JobSegment> _repeated_segments_codec - = pb::FieldCodec.ForMessage(66, global::Tango.PMR.Printing.JobSegment.Parser); + = pb::FieldCodec.ForMessage(74, global::Tango.PMR.Printing.JobSegment.Parser); private readonly pbc::RepeatedField<global::Tango.PMR.Printing.JobSegment> segments_ = new pbc::RepeatedField<global::Tango.PMR.Printing.JobSegment>(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField<global::Tango.PMR.Printing.JobSegment> Segments { @@ -182,6 +195,7 @@ namespace Tango.PMR.Printing { if (ReferenceEquals(other, this)) { return true; } + if (Guid != other.Guid) return false; if (Name != other.Name) return false; if (EnableInterSegment != other.EnableInterSegment) return false; if (InterSegmentLength != other.InterSegmentLength) return false; @@ -196,6 +210,7 @@ namespace Tango.PMR.Printing { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; + if (Guid.Length != 0) hash ^= Guid.GetHashCode(); if (Name.Length != 0) hash ^= Name.GetHashCode(); if (EnableInterSegment != false) hash ^= EnableInterSegment.GetHashCode(); if (InterSegmentLength != 0D) hash ^= InterSegmentLength.GetHashCode(); @@ -214,32 +229,36 @@ namespace Tango.PMR.Printing { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { - if (Name.Length != 0) { + if (Guid.Length != 0) { output.WriteRawTag(10); + output.WriteString(Guid); + } + if (Name.Length != 0) { + output.WriteRawTag(18); output.WriteString(Name); } if (EnableInterSegment != false) { - output.WriteRawTag(16); + output.WriteRawTag(24); output.WriteBool(EnableInterSegment); } if (InterSegmentLength != 0D) { - output.WriteRawTag(25); + output.WriteRawTag(33); output.WriteDouble(InterSegmentLength); } if (Length != 0D) { - output.WriteRawTag(33); + output.WriteRawTag(41); output.WriteDouble(Length); } if (processParameters_ != null) { - output.WriteRawTag(42); + output.WriteRawTag(50); output.WriteMessage(ProcessParameters); } if (WindingMethod != 0) { - output.WriteRawTag(48); + output.WriteRawTag(56); output.WriteEnum((int) WindingMethod); } if (spool_ != null) { - output.WriteRawTag(58); + output.WriteRawTag(66); output.WriteMessage(Spool); } segments_.WriteTo(output, _repeated_segments_codec); @@ -248,6 +267,9 @@ namespace Tango.PMR.Printing { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; + if (Guid.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Guid); + } if (Name.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); } @@ -278,6 +300,9 @@ namespace Tango.PMR.Printing { if (other == null) { return; } + if (other.Guid.Length != 0) { + Guid = other.Guid; + } if (other.Name.Length != 0) { Name = other.Name; } @@ -317,40 +342,44 @@ namespace Tango.PMR.Printing { input.SkipLastField(); break; case 10: { + Guid = input.ReadString(); + break; + } + case 18: { Name = input.ReadString(); break; } - case 16: { + case 24: { EnableInterSegment = input.ReadBool(); break; } - case 25: { + case 33: { InterSegmentLength = input.ReadDouble(); break; } - case 33: { + case 41: { Length = input.ReadDouble(); break; } - case 42: { + case 50: { if (processParameters_ == null) { processParameters_ = new global::Tango.PMR.Printing.ProcessParameters(); } input.ReadMessage(processParameters_); break; } - case 48: { + case 56: { windingMethod_ = (global::Tango.PMR.Printing.JobWindingMethod) input.ReadEnum(); break; } - case 58: { + case 66: { if (spool_ == null) { spool_ = new global::Tango.PMR.Printing.JobSpool(); } input.ReadMessage(spool_); break; } - case 66: { + case 74: { segments_.AddEntriesFrom(input, _repeated_segments_codec); break; } diff --git a/Software/Visual_Studio/Tango.PMR/Printing/ResumeCurrentJobRequest.cs b/Software/Visual_Studio/Tango.PMR/Printing/ResumeCurrentJobRequest.cs new file mode 100644 index 000000000..587f7cb42 --- /dev/null +++ b/Software/Visual_Studio/Tango.PMR/Printing/ResumeCurrentJobRequest.cs @@ -0,0 +1,131 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: ResumeCurrentJobRequest.proto +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Tango.PMR.Printing { + + /// <summary>Holder for reflection information generated from ResumeCurrentJobRequest.proto</summary> + public static partial class ResumeCurrentJobRequestReflection { + + #region Descriptor + /// <summary>File descriptor for ResumeCurrentJobRequest.proto</summary> + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static ResumeCurrentJobRequestReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "Ch1SZXN1bWVDdXJyZW50Sm9iUmVxdWVzdC5wcm90bxISVGFuZ28uUE1SLlBy", + "aW50aW5nIhkKF1Jlc3VtZUN1cnJlbnRKb2JSZXF1ZXN0Qh4KHGNvbS50d2lu", + "ZS50YW5nby5wbXIucHJpbnRpbmdiBnByb3RvMw==")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Printing.ResumeCurrentJobRequest), global::Tango.PMR.Printing.ResumeCurrentJobRequest.Parser, null, null, null, null) + })); + } + #endregion + + } + #region Messages + public sealed partial class ResumeCurrentJobRequest : pb::IMessage<ResumeCurrentJobRequest> { + private static readonly pb::MessageParser<ResumeCurrentJobRequest> _parser = new pb::MessageParser<ResumeCurrentJobRequest>(() => new ResumeCurrentJobRequest()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser<ResumeCurrentJobRequest> Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tango.PMR.Printing.ResumeCurrentJobRequestReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ResumeCurrentJobRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ResumeCurrentJobRequest(ResumeCurrentJobRequest other) : this() { + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ResumeCurrentJobRequest Clone() { + return new ResumeCurrentJobRequest(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as ResumeCurrentJobRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(ResumeCurrentJobRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(ResumeCurrentJobRequest other) { + if (other == null) { + return; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + } + } + } + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/Software/Visual_Studio/Tango.PMR/Printing/ResumeCurrentJobResponse.cs b/Software/Visual_Studio/Tango.PMR/Printing/ResumeCurrentJobResponse.cs new file mode 100644 index 000000000..c6a15c82e --- /dev/null +++ b/Software/Visual_Studio/Tango.PMR/Printing/ResumeCurrentJobResponse.cs @@ -0,0 +1,195 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: ResumeCurrentJobResponse.proto +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Tango.PMR.Printing { + + /// <summary>Holder for reflection information generated from ResumeCurrentJobResponse.proto</summary> + public static partial class ResumeCurrentJobResponseReflection { + + #region Descriptor + /// <summary>File descriptor for ResumeCurrentJobResponse.proto</summary> + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static ResumeCurrentJobResponseReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "Ch5SZXN1bWVDdXJyZW50Sm9iUmVzcG9uc2UucHJvdG8SElRhbmdvLlBNUi5Q", + "cmludGluZxoPSm9iU3RhdHVzLnByb3RvIlsKGFJlc3VtZUN1cnJlbnRKb2JS", + "ZXNwb25zZRItCgZTdGF0dXMYASABKAsyHS5UYW5nby5QTVIuUHJpbnRpbmcu", + "Sm9iU3RhdHVzEhAKCENhbmNlbGVkGAIgASgIQh4KHGNvbS50d2luZS50YW5n", + "by5wbXIucHJpbnRpbmdiBnByb3RvMw==")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { global::Tango.PMR.Printing.JobStatusReflection.Descriptor, }, + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Printing.ResumeCurrentJobResponse), global::Tango.PMR.Printing.ResumeCurrentJobResponse.Parser, new[]{ "Status", "Canceled" }, null, null, null) + })); + } + #endregion + + } + #region Messages + public sealed partial class ResumeCurrentJobResponse : pb::IMessage<ResumeCurrentJobResponse> { + private static readonly pb::MessageParser<ResumeCurrentJobResponse> _parser = new pb::MessageParser<ResumeCurrentJobResponse>(() => new ResumeCurrentJobResponse()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser<ResumeCurrentJobResponse> Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tango.PMR.Printing.ResumeCurrentJobResponseReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ResumeCurrentJobResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ResumeCurrentJobResponse(ResumeCurrentJobResponse other) : this() { + Status = other.status_ != null ? other.Status.Clone() : null; + canceled_ = other.canceled_; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ResumeCurrentJobResponse Clone() { + return new ResumeCurrentJobResponse(this); + } + + /// <summary>Field number for the "Status" field.</summary> + public const int StatusFieldNumber = 1; + private global::Tango.PMR.Printing.JobStatus status_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public global::Tango.PMR.Printing.JobStatus Status { + get { return status_; } + set { + status_ = value; + } + } + + /// <summary>Field number for the "Canceled" field.</summary> + public const int CanceledFieldNumber = 2; + private bool canceled_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Canceled { + get { return canceled_; } + set { + canceled_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as ResumeCurrentJobResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(ResumeCurrentJobResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(Status, other.Status)) return false; + if (Canceled != other.Canceled) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (status_ != null) hash ^= Status.GetHashCode(); + if (Canceled != false) hash ^= Canceled.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (status_ != null) { + output.WriteRawTag(10); + output.WriteMessage(Status); + } + if (Canceled != false) { + output.WriteRawTag(16); + output.WriteBool(Canceled); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (status_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(Status); + } + if (Canceled != false) { + size += 1 + 1; + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(ResumeCurrentJobResponse other) { + if (other == null) { + return; + } + if (other.status_ != null) { + if (status_ == null) { + status_ = new global::Tango.PMR.Printing.JobStatus(); + } + Status.MergeFrom(other.Status); + } + if (other.Canceled != false) { + Canceled = other.Canceled; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 10: { + if (status_ == null) { + status_ = new global::Tango.PMR.Printing.JobStatus(); + } + input.ReadMessage(status_); + break; + } + case 16: { + Canceled = input.ReadBool(); + break; + } + } + } + } + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj b/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj index 87a071833..cdea3a5e8 100644 --- a/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj +++ b/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj @@ -191,6 +191,8 @@ <Compile Include="NativePMR.cs" /> <Compile Include="Printing\AbortJobRequest.cs" /> <Compile Include="Printing\AbortJobResponse.cs" /> + <Compile Include="Printing\CurrentJobRequest.cs" /> + <Compile Include="Printing\CurrentJobResponse.cs" /> <Compile Include="Printing\DispenserLiquidType.cs" /> <Compile Include="Printing\DispenserStepDivision.cs" /> <Compile Include="Printing\JobBrushStop.cs" /> @@ -204,6 +206,8 @@ <Compile Include="Printing\JobTicket.cs" /> <Compile Include="Printing\JobWindingMethod.cs" /> <Compile Include="Printing\ProcessParameters.cs" /> + <Compile Include="Printing\ResumeCurrentJobRequest.cs" /> + <Compile Include="Printing\ResumeCurrentJobResponse.cs" /> <Compile Include="Printing\UploadProcessParametersRequest.cs" /> <Compile Include="Printing\UploadProcessParametersResponse.cs" /> <Compile Include="Printing\WindingMethod.cs" /> @@ -240,7 +244,7 @@ </PropertyGroup> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> + <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> </VisualStudio> </ProjectExtensions> </Project>
\ No newline at end of file |
