diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-12-17 16:43:40 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-12-17 16:43:40 +0200 |
| commit | ae1cfd30f1efbd385eac04b3d02fa1ed161058a3 (patch) | |
| tree | 5b77d7484e80491b06f1b726a57a61c782b5569e /Software/Visual_Studio/PPC/Modules | |
| parent | 8270aa37dee33cda98603a995de823df393f7294 (diff) | |
| download | Tango-ae1cfd30f1efbd385eac04b3d02fa1ed161058a3.tar.gz Tango-ae1cfd30f1efbd385eac04b3d02fa1ed161058a3.zip | |
Add AppButtons to PPC.
Implemented Stop & Start job app buttons!
Diffstat (limited to 'Software/Visual_Studio/PPC/Modules')
6 files changed, 87 insertions, 5 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/AppButtons/StartPrintingButton.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/AppButtons/StartPrintingButton.cs new file mode 100644 index 000000000..8efd46e18 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/AppButtons/StartPrintingButton.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core.Commands; +using Tango.Integration.Operation; +using Tango.PPC.Common.Notifications; + +namespace Tango.PPC.Jobs.AppButtons +{ + public class StartPrintingButton : AppButton + { + public StartPrintingButton(RelayCommand command, IMachineOperator op) : base("START DYEING", command) + { + op.StatusChanged += Op_StatusChanged; + + Op_StatusChanged(this, op.Status); + } + + private void Op_StatusChanged(object sender, MachineStatuses status) + { + IsEnabled = status == MachineStatuses.ReadyToDye; + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/AppButtons/StopPrintingButton.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/AppButtons/StopPrintingButton.cs new file mode 100644 index 000000000..8c3b444b3 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/AppButtons/StopPrintingButton.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.PPC.Common.Notifications; + +namespace Tango.PPC.Jobs.AppButtons +{ + public class StopPrintingButton : AppButton + { + public StopPrintingButton() : base("STOP DYEING", true) + { + + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj index ddd8d1c07..8021e146f 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj @@ -145,6 +145,8 @@ <Compile Include="AppBarItems\JobProgressAppBarItemView.xaml.cs"> <DependentUpon>JobProgressAppBarItemView.xaml</DependentUpon> </Compile> + <Compile Include="AppButtons\StartPrintingButton.cs" /> + <Compile Include="AppButtons\StopPrintingButton.cs" /> <Compile Include="Controls\RunningJobViewer.xaml.cs"> <DependentUpon>RunningJobViewer.xaml</DependentUpon> </Compile> @@ -384,7 +386,7 @@ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> + <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> </VisualStudio> </ProjectExtensions> </Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs index 16ffdd906..264f41131 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs @@ -8,6 +8,7 @@ using Tango.Integration.Operation; using Tango.PPC.Common; using Tango.PPC.Common.Navigation; using Tango.PPC.Jobs.AppBarItems; +using Tango.PPC.Jobs.AppButtons; using Tango.PPC.Jobs.Dialogs; using Tango.PPC.Jobs.Views; @@ -19,6 +20,9 @@ namespace Tango.PPC.Jobs.ViewModels /// <seealso cref="Tango.PPC.Common.PPCViewModel" /> public class JobProgressViewVM : PPCViewModel { + private StopPrintingButton _stop_job_btn; + private JobHandler _handler; + #region Properties private Job _job; @@ -43,6 +47,20 @@ namespace Tango.PPC.Jobs.ViewModels #endregion + public JobProgressViewVM() + { + _stop_job_btn = new StopPrintingButton(); + _stop_job_btn.Pressed += _stop_job_btn_Pressed; + } + + private void _stop_job_btn_Pressed() + { + if (_handler != null) + { + _handler.Cancel(); + } + } + #region Override Methods /// <summary> @@ -81,6 +99,8 @@ namespace Tango.PPC.Jobs.ViewModels { NotificationProvider.CurrentAppBarItem.Close(); } + + _stop_job_btn.Push(); } #endregion @@ -94,6 +114,7 @@ namespace Tango.PPC.Jobs.ViewModels /// <param name="e">The <see cref="PrintingEventArgs"/> instance containing the event data.</param> private void MachineOperator_PrintingStarted(object sender, PrintingEventArgs e) { + _handler = e.JobHandler; Job = e.Job; e.JobHandler.StatusChanged += JobHandler_StatusChanged; e.JobHandler.SpoolChangeRequired += JobHandler_SpoolChangeRequired; @@ -131,6 +152,8 @@ namespace Tango.PPC.Jobs.ViewModels { NotificationProvider.CurrentAppBarItem.Close(); } + + _stop_job_btn.Pop(); } /// <summary> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs index 98f429889..6a05eee12 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs @@ -30,6 +30,7 @@ using Tango.PPC.Common.Models; using Tango.Logging; using Tango.PPC.Common.Messages; using Tango.BL.Builders; +using Tango.PPC.Jobs.AppButtons; namespace Tango.PPC.Jobs.ViewModels { @@ -45,6 +46,7 @@ namespace Tango.PPC.Jobs.ViewModels private Job _job_to_load; private JobNavigationIntent _job_to_load_intent; private static Dictionary<String, List<FineTuneItem>> _jobs_fine_tune_items; + private StartPrintingButton _start_printing_btn; #region Properties @@ -458,6 +460,8 @@ namespace Tango.PPC.Jobs.ViewModels LogManager.Log("Directing view to display fine tuning region."); View.DisplayFineTuning(); } + + DyeCommand.RaiseCanExecuteChanged(); } catch (Exception ex) { @@ -1017,6 +1021,8 @@ namespace Tango.PPC.Jobs.ViewModels /// </summary> public override void OnNavigatedTo() { + _start_printing_btn.Push(); + base.OnNavigatedTo(); LoadJob(); } @@ -1026,6 +1032,8 @@ namespace Tango.PPC.Jobs.ViewModels /// </summary> public override void OnNavigatedFrom() { + _start_printing_btn.Pop(); + base.OnNavigatedFrom(); _job_to_load_intent = JobNavigationIntent.Default; } @@ -1055,6 +1063,12 @@ namespace Tango.PPC.Jobs.ViewModels return result; } + public override void OnApplicationReady() + { + base.OnApplicationReady(); + + _start_printing_btn = new StartPrintingButton(DyeCommand, MachineProvider.MachineOperator); + } #endregion #region INavigationObjectReceiver diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml index ada22ce5a..9fb7ff5c0 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml @@ -1029,18 +1029,18 @@ </Grid.Background> <Rectangle Stroke="{StaticResource TangoDividerBrush}" StrokeThickness="1" VerticalAlignment="Top" /> </Grid> - <Border Padding="20 20"> + <!--<Border Padding="20 20"> <Grid> <DockPanel> <touch:TouchButton IsEnabled="{Binding MachineProvider.MachineOperator.CanPrint}" DockPanel.Dock="Right" Height="54" Padding="0" Width="184" CornerRadius="30" BlurRadius="20" HorizontalAlignment="Right" DelayCommand="{Binding DyeCommand}" DelayCommandDuration="00:00:0.3"> DYE </touch:TouchButton> - <!--Add this in case you want to display job summery on bottom panel--> - <!--<localControls:JobSummeryViewer DataContext="{Binding Job}" Height="35" Margin="0 -20 30 0" />--> + --><!--Add this in case you want to display job summery on bottom panel--> + <!--<localControls:JobSummeryViewer DataContext="{Binding Job}" Height="35" Margin="0 -20 30 0" />--><!-- </DockPanel> </Grid> - </Border> + </Border>--> </Grid> <dragAndDrop:DraggingSurface x:Name="DraggingSurface" /> |
