diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-02-01 15:20:37 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-02-01 15:20:37 +0200 |
| commit | a89c18abf7175f76f8673c12dac35d1658209d4e (patch) | |
| tree | 490f56c31347836c8b1e89f76fc3723431cad48b /Software | |
| parent | 06ad24ef8a414fc89c0cf42b9f5264d584292afe (diff) | |
| download | Tango-a89c18abf7175f76f8673c12dac35d1658209d4e.tar.gz Tango-a89c18abf7175f76f8673c12dac35d1658209d4e.zip | |
Added Developer Module Settings & More...
Diffstat (limited to 'Software')
14 files changed, 541 insertions, 136 deletions
diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf Binary files differindex 1f93351b8..126a778e9 100644 --- a/Software/DB/Tango.mdf +++ b/Software/DB/Tango.mdf diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf Binary files differindex 04a1123e6..88f63972a 100644 --- a/Software/DB/Tango_log.ldf +++ b/Software/DB/Tango_log.ldf 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 @@ <Compile Include="ViewModelLocator.cs" /> <Compile Include="ViewModels\DBViewContextWrapper.cs" /> <Compile Include="ViewModels\MainViewVM.cs" /> + <Compile Include="Views\IMainView.cs" /> <Compile Include="Views\MainView.xaml.cs"> <DependentUpon>MainView.xaml</DependentUpon> </Compile> @@ -158,6 +159,10 @@ <Project>{4206ac58-3b57-4699-8835-90bf6db01a61}</Project> <Name>Tango.Integration</Name> </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Settings\Tango.Settings.csproj"> + <Project>{D8F1AD85-526A-4F50-B6DC-D437AF63D8D8}</Project> + <Name>Tango.Settings</Name> + </ProjectReference> <ProjectReference Include="..\..\..\Tango.SharedUI\Tango.SharedUI.csproj"> <Project>{8491d07b-c1f6-4b62-a412-41b9fd2d6538}</Project> <Name>Tango.SharedUI</Name> 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<IMainView>(() => MainView.Self); SimpleIoc.Default.Register<MainViewVM>(); } 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. /// </summary> /// <seealso cref="Tango.SharedUI.ViewModel" /> - public class MainViewVM : ViewModel, IShutdownRequestBlocker + public class MainViewVM : ViewModel<IMainView>, 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; + /// <summary> + /// Gets or sets the job remaining time. + /// </summary> + public TimeSpan RunningJobRemainingTime + { + get { return _runningJobRemainingTime; } + set { _runningJobRemainingTime = value; RaisePropertyChangedAuto(); } + } + + private bool _isJobCompleted; + /// <summary> + /// Gets or sets a value indicating whether the running job has completed successfully. + /// </summary> + public bool IsJobCompleted + { + get { return _isJobCompleted; } + set { _isJobCompleted = value; RaisePropertyChangedAuto(); } + } + + private bool _isJobFailed; + /// <summary> + /// Gets or sets a value indicating whether the running job has failed. + /// </summary> + public bool IsJobFailed + { + get { return _isJobFailed; } + set { _isJobFailed = value; RaisePropertyChangedAuto(); } + } + + private bool _showJobStatus; + /// <summary> + /// Gets or sets a value indicating whether to show all the relevant job status areas. + /// </summary> + public bool ShowJobStatus + { + get { return _showJobStatus; } + set { _showJobStatus = value; RaisePropertyChangedAuto(); } + } + + private bool _isJobCanceled; + /// <summary> + /// Gets or sets a value indicating whether the last running job was canceled. + /// </summary> + public bool IsJobCanceled + { + get { return _isJobCanceled; } + set { _isJobCanceled = value; RaisePropertyChangedAuto(); } + } + #endregion #region Commands @@ -307,6 +360,11 @@ namespace Tango.MachineStudio.Developer.ViewModels /// </summary> public RelayCommand StopJobCommand { get; set; } + /// <summary> + /// Gets or sets the close job completion status command. + /// </summary> + public RelayCommand CloseJobCompletionStatusCommand { get; set; } + #endregion #region Constructors @@ -314,7 +372,7 @@ namespace Tango.MachineStudio.Developer.ViewModels /// <summary> /// Initializes a new instance of the <see cref="MainViewVM"/> class. /// </summary> - public MainViewVM() + public MainViewVM(IMainView view) : base(view, true) { IsSideBarOpened = true; @@ -333,7 +391,7 @@ namespace Tango.MachineStudio.Developer.ViewModels /// <param name="applicationManager">The application manager.</param> /// <param name="notificationProvider">The notification provider.</param> [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 @@ <Setter Property="Margin" Value="2" /> </Style> + <converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" /> <converters:ColorToIntegerConverter x:Key="ColorToIntegerConverter"></converters:ColorToIntegerConverter> <localConverters:DbRmlViewToEntityConverter x:Key="DbRmlViewToEntityConverter"></localConverters:DbRmlViewToEntityConverter> <converters:NullObjectToBooleanConverter x:Key="NullObjectToBooleanConverter"></converters:NullObjectToBooleanConverter> @@ -166,145 +167,313 @@ <RowDefinition Height="1*"/> </Grid.RowDefinitions> - <Grid Background="#202020" TextElement.Foreground="Silver"> - <Grid.Style> - <Style TargetType="Grid"> - <Setter Property="LayoutTransform"> - <Setter.Value> - <ScaleTransform ScaleX="1" ScaleY="1" /> - </Setter.Value> - </Setter> - <Style.Triggers> - <DataTrigger Binding="{Binding IsJobRunning}" Value="True"> - <DataTrigger.EnterActions> - <BeginStoryboard> - <Storyboard> - <DoubleAnimation Storyboard.TargetProperty="LayoutTransform.ScaleY" To="1" Duration="00:00:0.3" /> - </Storyboard> - </BeginStoryboard> - </DataTrigger.EnterActions> - <DataTrigger.ExitActions> - <BeginStoryboard> - <Storyboard> - <DoubleAnimation Storyboard.TargetProperty="LayoutTransform.ScaleY" To="0" Duration="00:00:0.3" /> - </Storyboard> - </BeginStoryboard> - </DataTrigger.ExitActions> - </DataTrigger> - </Style.Triggers> - </Style> - </Grid.Style> - <Border BorderBrush="#404040" BorderThickness="0 0 0 1" Padding="20"> - <DockPanel> - <StackPanel Orientation="Horizontal" DockPanel.Dock="Left"> - <ProgressBar Width="30" Height="30" HorizontalAlignment="Center" VerticalAlignment="Center" IsIndeterminate="True" Style="{StaticResource MaterialDesignCircularProgressBar}" Value="0" /> - <TextBlock VerticalAlignment="Center" Margin="10 0 0 0" FontSize="14" FontStyle="Italic" FontWeight="DemiBold"> + <StackPanel> + <Grid Background="#202020" TextElement.Foreground="Silver"> + <Grid.Style> + <Style TargetType="Grid"> + <Setter Property="LayoutTransform"> + <Setter.Value> + <ScaleTransform ScaleX="1" ScaleY="0" /> + </Setter.Value> + </Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding ShowJobStatus}" Value="True"> + <DataTrigger.EnterActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="LayoutTransform.ScaleY" To="1" Duration="00:00:0.3" /> + </Storyboard> + </BeginStoryboard> + </DataTrigger.EnterActions> + <DataTrigger.ExitActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="LayoutTransform.ScaleY" To="0" Duration="00:00:0.3" /> + </Storyboard> + </BeginStoryboard> + </DataTrigger.ExitActions> + </DataTrigger> + </Style.Triggers> + </Style> + </Grid.Style> + <Border BorderBrush="#404040" BorderThickness="0 0 0 1" Padding="20"> + <DockPanel> + <Grid DockPanel.Dock="Left" MinWidth="190"> + <StackPanel Orientation="Horizontal" Visibility="{Binding IsJobRunning,Converter={StaticResource BooleanToVisibilityConverter}}"> + <ProgressBar Foreground="#FF6464" Width="30" Height="30" HorizontalAlignment="Center" VerticalAlignment="Center" IsIndeterminate="True" Style="{StaticResource MaterialDesignCircularProgressBar}" Value="0" /> + <TextBlock VerticalAlignment="Center" Margin="10 0 0 0" FontSize="14" FontStyle="Italic" FontWeight="DemiBold" Foreground="#FF6464"> <Run Text="Running '"></Run> <Run Text="{Binding RunningJob.Name}"></Run> <Run Text="'..."></Run> - </TextBlock> - </StackPanel> - <StackPanel DockPanel.Dock="Right"> - <Button Height="40" Width="170" Command="{Binding StopJobCommand}" Background="#FF6464" BorderBrush="#FF6464"> + </TextBlock> + </StackPanel> + </Grid> + <StackPanel DockPanel.Dock="Right"> <StackPanel Orientation="Horizontal"> - <materialDesign:PackIcon VerticalAlignment="Center" Width="24" Height="24" Kind="Stop" /> - <TextBlock VerticalAlignment="Center" Margin="10 0 0 0">STOP</TextBlock> + <TextBlock VerticalAlignment="Center" FontSize="30" FontFamily="digital-7" Margin="0 0 40 0" Foreground="#FF6464" Width="100" Text="{Binding RunningJobRemainingTime,StringFormat=hh\\:mm\\:ss}"></TextBlock> + + <Button Height="40" Width="170" Command="{Binding StopJobCommand}" Background="#FF6464" BorderBrush="#FF6464"> + <StackPanel Orientation="Horizontal"> + <materialDesign:PackIcon VerticalAlignment="Center" Width="24" Height="24" Kind="Stop" /> + <TextBlock VerticalAlignment="Center" Margin="10 0 0 0">STOP</TextBlock> + </StackPanel> + </Button> </StackPanel> - </Button> - </StackPanel> - <Grid> + </StackPanel> <Grid> - <Border VerticalAlignment="Bottom" Width="1200" BorderBrush="#404040" BorderThickness="0" ClipToBounds="False"> - <Grid ClipToBounds="False" Height="32"> - <ItemsControl ClipToBounds="False" x:Name="runningJobBrushList"> - <ItemsControl.ItemsPanel> - <ItemsPanelTemplate> - <StackPanel Orientation="Horizontal" ClipToBounds="False"></StackPanel> - </ItemsPanelTemplate> - </ItemsControl.ItemsPanel> - <ItemsControl.ItemTemplate> - <DataTemplate> - <Grid> - <Grid.Width> - <MultiBinding Converter="{StaticResource SegmentLengthToWidthConverter}"> - <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="DataContext.RunningJob"></Binding> - <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="DataContext.RunningJob.Length"></Binding> - <Binding RelativeSource="{RelativeSource AncestorType=ItemsControl}" Path="ActualWidth"></Binding> - <Binding Path="Length"></Binding> - </MultiBinding> - </Grid.Width> - <Rectangle Height="10" VerticalAlignment="Bottom"> - <Rectangle.Fill> - <MultiBinding Converter="{StaticResource SegmentToBrushConverterMulti}"> - <Binding Path="."></Binding> + <Grid> + <Border VerticalAlignment="Bottom" Width="1200" BorderBrush="#404040" BorderThickness="0" ClipToBounds="False"> + <Grid ClipToBounds="False" Height="32"> + <ItemsControl ClipToBounds="False" x:Name="runningJobBrushList"> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <StackPanel Orientation="Horizontal" ClipToBounds="False"></StackPanel> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + <ItemsControl.ItemTemplate> + <DataTemplate> + <Grid> + <Grid.Width> + <MultiBinding Converter="{StaticResource SegmentLengthToWidthConverter}"> <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="DataContext.RunningJob"></Binding> <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="DataContext.RunningJob.Length"></Binding> + <Binding RelativeSource="{RelativeSource AncestorType=ItemsControl}" Path="ActualWidth"></Binding> + <Binding Path="Length"></Binding> </MultiBinding> - </Rectangle.Fill> - </Rectangle> + </Grid.Width> + <Rectangle Height="10" VerticalAlignment="Bottom"> + <Rectangle.Fill> + <MultiBinding Converter="{StaticResource SegmentToBrushConverterMulti}"> + <Binding Path="."></Binding> + <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="DataContext.RunningJob"></Binding> + <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="DataContext.RunningJob.Length"></Binding> + </MultiBinding> + </Rectangle.Fill> + </Rectangle> - <StackPanel Margin="0 0 0 0" HorizontalAlignment="Center"> - <TextBlock FontSize="9" HorizontalAlignment="Right"> + <StackPanel Margin="0 0 0 0" HorizontalAlignment="Center"> + <TextBlock FontSize="9" HorizontalAlignment="Right"> <Run Text="{Binding Length,Mode=OneWay}"></Run> <Run FontSize="8" Text="m"></Run> - </TextBlock> - <materialDesign:PackIcon HorizontalAlignment="Right" RenderTransformOrigin="0.5,0.5" Kind="Triangle" Width="8" Height="8"> - <materialDesign:PackIcon.RenderTransform> - <RotateTransform Angle="180" /> - </materialDesign:PackIcon.RenderTransform> - </materialDesign:PackIcon> - </StackPanel> - </Grid> - </DataTemplate> - </ItemsControl.ItemTemplate> - </ItemsControl> + </TextBlock> + <materialDesign:PackIcon HorizontalAlignment="Right" RenderTransformOrigin="0.5,0.5" Kind="Triangle" Width="8" Height="8"> + <materialDesign:PackIcon.RenderTransform> + <RotateTransform Angle="180" /> + </materialDesign:PackIcon.RenderTransform> + </materialDesign:PackIcon> + </StackPanel> + </Grid> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> - <StackPanel Margin="-20 -5 0 0" HorizontalAlignment="Left"> - <TextBlock FontSize="9"> + <StackPanel Margin="-20 -5 0 0" HorizontalAlignment="Left"> + <TextBlock FontSize="9"> <Run Text="0"></Run> <Run FontSize="8" Text="m"></Run> - </TextBlock> - <materialDesign:PackIcon HorizontalAlignment="Right" RenderTransformOrigin="0.5,0.5" Kind="SubdirectoryArrowRight" Width="16" Height="16"> + </TextBlock> + <materialDesign:PackIcon HorizontalAlignment="Right" RenderTransformOrigin="0.5,0.5" Kind="SubdirectoryArrowRight" Width="16" Height="16"> - </materialDesign:PackIcon> - </StackPanel> + </materialDesign:PackIcon> + </StackPanel> - <StackPanel Margin="0 -5 -20 0" HorizontalAlignment="Right"> - <TextBlock FontSize="9"> + <StackPanel Margin="0 -5 -20 0" HorizontalAlignment="Right"> + <TextBlock FontSize="9"> <Run Text="{Binding RunningJob.Length,Mode=OneWay}"></Run> <Run FontSize="8" Text="m"></Run> - </TextBlock> - <materialDesign:PackIcon HorizontalAlignment="Right" RenderTransformOrigin="0.5,0.5" Kind="FlagCheckered" Width="16" Height="16"> + </TextBlock> + <materialDesign:PackIcon HorizontalAlignment="Right" RenderTransformOrigin="0.5,0.5" Kind="FlagCheckered" Width="16" Height="16"> - </materialDesign:PackIcon> - </StackPanel> + </materialDesign:PackIcon> + </StackPanel> - <Border BorderBrush="#404040" BorderThickness="1" VerticalAlignment="Bottom" Height="10"> + <Border BorderBrush="#404040" BorderThickness="1" VerticalAlignment="Bottom" Height="10"> - </Border> + </Border> - <Canvas x:Name="jobProgressCanvas"> - <Grid Canvas.Top="0"> - <Canvas.Left> - <MultiBinding Converter="{StaticResource JobProgressToPositionConverter}"> - <Binding Path="RunningJob" /> - <Binding Path="RunningJobProgress" /> - <Binding ElementName="jobProgressCanvas" Path="ActualWidth" /> - </MultiBinding> - </Canvas.Left> - <materialDesign:PackIcon Kind="MapMarker" Width="16" Height="16" Margin="-6 0 0 0" /> - <TextBlock Margin="-4 -18 0 0" FontSize="10" Text="{Binding RunningJobProgress,StringFormat=0.0}"></TextBlock> - </Grid> - </Canvas> - </Grid> - </Border> + <Canvas x:Name="jobProgressCanvas"> + <Grid Canvas.Top="0"> + <Canvas.Left> + <MultiBinding Converter="{StaticResource JobProgressToPositionConverter}"> + <Binding Path="RunningJob" /> + <Binding Path="RunningJobProgress" /> + <Binding ElementName="jobProgressCanvas" Path="ActualWidth" /> + </MultiBinding> + </Canvas.Left> + <materialDesign:PackIcon Kind="MapMarker" Foreground="#FF6464" Background="#202020" Width="16" Height="16" Margin="-6 0 0 0" /> + <TextBlock Margin="-4 -18 0 0" FontSize="10" Foreground="#FF6464" VerticalAlignment="Top" Background="#202020" Height="18" Text="{Binding RunningJobProgress,StringFormat=0.0}"></TextBlock> + </Grid> + </Canvas> + </Grid> + </Border> + </Grid> </Grid> - </Grid> - </DockPanel> - </Border> + </DockPanel> + </Border> - <ProgressBar IsIndeterminate="True" VerticalAlignment="Bottom" Height="3"></ProgressBar> - </Grid> + <ProgressBar IsIndeterminate="True" VerticalAlignment="Bottom" Height="3" Visibility="{Binding IsJobRunning,Converter={StaticResource BooleanToVisibilityConverter}}"></ProgressBar> + </Grid> + + <Grid Background="#C1FFC7"> + <Grid.Style> + <Style TargetType="Grid"> + <Setter Property="LayoutTransform"> + <Setter.Value> + <ScaleTransform ScaleX="1" ScaleY="0" /> + </Setter.Value> + </Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding IsJobCompleted}" Value="True"> + <DataTrigger.EnterActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="LayoutTransform.ScaleY" To="1" Duration="00:00:0.3" /> + </Storyboard> + </BeginStoryboard> + </DataTrigger.EnterActions> + <DataTrigger.ExitActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="LayoutTransform.ScaleY" To="0" Duration="00:00:0.3" /> + </Storyboard> + </BeginStoryboard> + </DataTrigger.ExitActions> + </DataTrigger> + </Style.Triggers> + </Style> + </Grid.Style> + + <Border BorderBrush="#404040" BorderThickness="0 1 0 1" Padding="5"> + <DockPanel> + <StackPanel Orientation="Horizontal" DockPanel.Dock="Left"> + <materialDesign:PackIcon Kind="Check" Width="32" Height="32" VerticalAlignment="Center" /> + <TextBlock VerticalAlignment="Center" FontSize="16" FontWeight="SemiBold" Margin="10 0 0 0" FontStyle="Italic">Job Completed Successfully</TextBlock> + </StackPanel> + + <StackPanel Orientation="Horizontal" DockPanel.Dock="Right" Margin="0 0 10 0"> + <Button Height="20" Padding="0" Command="{Binding CloseJobCompletionStatusCommand}" Style="{StaticResource MaterialDesignFlatButton}"> + <StackPanel Orientation="Horizontal"> + <materialDesign:PackIcon Foreground="#202020" VerticalAlignment="Center" Width="20" Height="20" Kind="Close" /> + </StackPanel> + </Button> + </StackPanel> + + <Grid> + + </Grid> + </DockPanel> + </Border> + </Grid> + + <Grid Background="#FF8888"> + <Grid.Style> + <Style TargetType="Grid"> + <Setter Property="LayoutTransform"> + <Setter.Value> + <ScaleTransform ScaleX="1" ScaleY="0" /> + </Setter.Value> + </Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding IsJobFailed}" Value="True"> + <DataTrigger.EnterActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="LayoutTransform.ScaleY" To="1" Duration="00:00:0.3" /> + </Storyboard> + </BeginStoryboard> + </DataTrigger.EnterActions> + <DataTrigger.ExitActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="LayoutTransform.ScaleY" To="0" Duration="00:00:0.3" /> + </Storyboard> + </BeginStoryboard> + </DataTrigger.ExitActions> + </DataTrigger> + </Style.Triggers> + </Style> + </Grid.Style> + + <Border BorderBrush="#404040" BorderThickness="0 1 0 1" Padding="5"> + <DockPanel> + <StackPanel Orientation="Horizontal" DockPanel.Dock="Left"> + <materialDesign:PackIcon Kind="Alert" Width="32" Height="32" VerticalAlignment="Center" /> + <TextBlock VerticalAlignment="Center" FontSize="16" FontWeight="SemiBold" Margin="10 0 0 0" FontStyle="Italic">Job Failed To Complete</TextBlock> + </StackPanel> + + <StackPanel Orientation="Horizontal" DockPanel.Dock="Right" Margin="0 0 10 0"> + <!--<Button Height="40" Width="170" Command="{Binding ViewResultsCommand}" Background="#303030" BorderBrush="#202020"> + <StackPanel Orientation="Horizontal"> + <materialDesign:PackIcon VerticalAlignment="Center" Width="24" Height="24" Kind="ChartLine" /> + <TextBlock VerticalAlignment="Center" Margin="10 0 0 0">RESULTS</TextBlock> + </StackPanel> + </Button>--> + + <Button Padding="0" Height="20" Command="{Binding CloseJobCompletionStatusCommand}" Style="{StaticResource MaterialDesignFlatButton}"> + <StackPanel Orientation="Horizontal"> + <materialDesign:PackIcon Foreground="#202020" VerticalAlignment="Center" Width="20" Height="20" Kind="Close" /> + </StackPanel> + </Button> + </StackPanel> + + <Grid> + + </Grid> + </DockPanel> + </Border> + </Grid> + + <Grid Background="#FFE388"> + <Grid.Style> + <Style TargetType="Grid"> + <Setter Property="LayoutTransform"> + <Setter.Value> + <ScaleTransform ScaleX="1" ScaleY="0" /> + </Setter.Value> + </Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding IsJobCanceled}" Value="True"> + <DataTrigger.EnterActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="LayoutTransform.ScaleY" To="1" Duration="00:00:0.3" /> + </Storyboard> + </BeginStoryboard> + </DataTrigger.EnterActions> + <DataTrigger.ExitActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="LayoutTransform.ScaleY" To="0" Duration="00:00:0.3" /> + </Storyboard> + </BeginStoryboard> + </DataTrigger.ExitActions> + </DataTrigger> + </Style.Triggers> + </Style> + </Grid.Style> + + <Border BorderBrush="#404040" BorderThickness="0 1 0 1" Padding="5"> + <DockPanel> + <StackPanel Orientation="Horizontal" DockPanel.Dock="Left"> + <materialDesign:PackIcon Kind="Alert" Width="32" Height="32" VerticalAlignment="Center" /> + <TextBlock VerticalAlignment="Center" FontSize="16" FontWeight="SemiBold" Margin="10 0 0 0" FontStyle="Italic">Job Aborted By User</TextBlock> + </StackPanel> + + <StackPanel Orientation="Horizontal" DockPanel.Dock="Right" Margin="0 0 10 0"> + <Button Padding="0" Height="20" Command="{Binding CloseJobCompletionStatusCommand}" Style="{StaticResource MaterialDesignFlatButton}"> + <StackPanel Orientation="Horizontal"> + <materialDesign:PackIcon Foreground="#202020" VerticalAlignment="Center" Width="20" Height="20" Kind="Close" /> + </StackPanel> + </Button> + </StackPanel> + + <Grid> + + </Grid> + </DockPanel> + </Border> + </Grid> + </StackPanel> <Grid Grid.Row="1"> <Grid.ColumnDefinitions> @@ -1243,6 +1412,64 @@ </DockPanel> </Grid> </Grid> + + <Grid Grid.RowSpan="2"> + <Grid.Background> + <ImageBrush ImageSource="../Images/White-Background.jpg" Stretch="None" /> + </Grid.Background> + <Grid.Style> + <Style TargetType="Grid"> + <Setter Property="RenderTransform"> + <Setter.Value> + <ScaleTransform ScaleY="0" ScaleX="1"></ScaleTransform> + </Setter.Value> + </Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding ShowJobStatus}" Value="True"> + <DataTrigger.EnterActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleY" To="1" Duration="00:00:0.5"></DoubleAnimation> + </Storyboard> + </BeginStoryboard> + </DataTrigger.EnterActions> + <DataTrigger.ExitActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleY" To="0" Duration="00:00:0.5"></DoubleAnimation> + </Storyboard> + </BeginStoryboard> + </DataTrigger.ExitActions> + </DataTrigger> + </Style.Triggers> + </Style> + </Grid.Style> + + <DockPanel Margin="13"> + <StackPanel Margin="80 20 0 0" Orientation="Horizontal" DockPanel.Dock="Top"> + <materialDesign:PackIcon Kind="Settings" Width="60" Height="60" /> + <TextBlock FontSize="30" FontWeight="SemiBold" VerticalAlignment="Center" Margin="10 0 0 0">Job Status</TextBlock> + </StackPanel> + + <Grid DockPanel.Dock="Bottom" Height="40"> + + </Grid> + + <Grid> + <DataGrid Background="Transparent" HorizontalAlignment="Center" Width="1000" Margin="0 10 0 10" BorderThickness="1" BorderBrush="Gainsboro"> + <DataGrid.Columns> + <DataGridTextColumn Width="Auto" Header="ICON"/> + <DataGridTextColumn Width="1*" Header="ITEM 1"/> + <DataGridTextColumn Width="1*" Header="ITEM 2"/> + <DataGridTextColumn Width="1*" Header="ITEM 3"/> + <DataGridTextColumn Width="1*" Header="ITEM 4"/> + <DataGridTextColumn Width="1*" Header="ITEM 5"/> + <DataGridTextColumn Width="1*" Header="ITEM 6"/> + </DataGrid.Columns> + </DataGrid> + </Grid> + </DockPanel> + </Grid> </Grid> <Grid Grid.Column="1" Margin="10 0 0 0" Width="340"> @@ -1441,7 +1668,7 @@ </Border> </Grid> - <Grid Grid.ColumnSpan="3" Background="White" Visibility="Collapsed"> + <Grid Grid.ColumnSpan="3" Background="White" Visibility="Visible"> <Grid.Style> <Style TargetType="Grid"> <Setter Property="RenderTransform"> 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 index e6f685535..cdf2248a6 100644 --- 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 @@ -17,14 +17,17 @@ 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 { /// <summary> /// Interaction logic for MainView.xaml /// </summary> - public partial class MainView : UserControl + public partial class MainView : UserControl, IMainView { + public static MainView Self { get; set; } + private MainViewVM _vm; private DispatcherTimer _jobBrushTimer; @@ -36,14 +39,19 @@ namespace Tango.MachineStudio.Developer.Views public static readonly DependencyProperty DraggingSurfaceProperty = DependencyProperty.Register("DraggingSurface", typeof(DraggingSurface), typeof(MainView), new PropertyMetadata(null)); + public event EventHandler<IView> 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); }; diff --git a/Software/Visual_Studio/Tango.Integration/Observables/ObservableEntity.cs b/Software/Visual_Studio/Tango.Integration/Observables/ObservableEntity.cs index 6ce7f0012..63f45cd76 100644 --- a/Software/Visual_Studio/Tango.Integration/Observables/ObservableEntity.cs +++ b/Software/Visual_Studio/Tango.Integration/Observables/ObservableEntity.cs @@ -206,7 +206,7 @@ namespace Tango.Integration.Observables #region Operator Overloading - //public static bool operator ==(ObservableEntityBase observable1, ObservableEntityBase observable2) + //public static bool operator ==(ObservableEntity<T> observable1, ObservableEntity<T> observable2) //{ // if (object.ReferenceEquals(observable1, null) || object.ReferenceEquals(observable2, null)) // { @@ -216,7 +216,7 @@ namespace Tango.Integration.Observables // return observable1.Guid.ToLower() == observable2.Guid.ToLower(); //} - //public static bool operator !=(ObservableEntityBase observable1, ObservableEntityBase observable2) + //public static bool operator !=(ObservableEntity<T> observable1, ObservableEntity<T> observable2) //{ // if (object.ReferenceEquals(observable1, null) || object.ReferenceEquals(observable2, null)) // { @@ -233,9 +233,9 @@ namespace Tango.Integration.Observables // return object.ReferenceEquals(this, obj); // } - // if (obj is ObservableEntityBase) + // if (obj is ObservableEntity<T>) // { - // return Guid.ToLower() == (obj as ObservableEntityBase).Guid.ToLower(); + // return Guid.ToLower() == (obj as ObservableEntity<T>).Guid.ToLower(); // } // else // { @@ -243,10 +243,10 @@ namespace Tango.Integration.Observables // } //} - public override int GetHashCode() - { - return base.GetHashCode(); - } + //public override int GetHashCode() + //{ + // return base.GetHashCode(); + //} #endregion } diff --git a/Software/Visual_Studio/Tango.Integration/Printing/LiquidVolume.cs b/Software/Visual_Studio/Tango.Integration/Printing/LiquidVolume.cs index 8f6fb6245..b86c3e52c 100644 --- a/Software/Visual_Studio/Tango.Integration/Printing/LiquidVolume.cs +++ b/Software/Visual_Studio/Tango.Integration/Printing/LiquidVolume.cs @@ -104,7 +104,15 @@ namespace Tango.Integration.Printing if (Configuration != null && RML != null) { List<LiquidTypesRml> factors = Configuration.IdsPacks.OrderBy(x => x.PackIndex).Select(x => x.LiquidType).SelectMany(x => x.LiquidTypesRmls).Where(x => x.Rml.Guid == RML.Guid).ToList(); - return factors[BrushStop.LiquidVolumes.IndexOf(this)].MaxNlPerCm; + + if (BrushStop.LiquidVolumes.IndexOf(this) > factors.Count - 1) + { + return 0d; + } + else + { + return factors[BrushStop.LiquidVolumes.IndexOf(this)].MaxNlPerCm; + } } else { diff --git a/Software/Visual_Studio/Tango.Settings/MachineStudioSettings/DeveloperModule.cs b/Software/Visual_Studio/Tango.Settings/MachineStudioSettings/DeveloperModule.cs new file mode 100644 index 000000000..5f6ed029f --- /dev/null +++ b/Software/Visual_Studio/Tango.Settings/MachineStudioSettings/DeveloperModule.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.Settings.MachineStudioSettings +{ + public class DeveloperModule + { + public String LastSelectedMachineGuid { get; set; } + + public String LastSelectedRMLGuid { get; set; } + + public String LastSelectedJobGuid { get; set; } + } +} diff --git a/Software/Visual_Studio/Tango.Settings/MachineStudioSettings/MachineStudio.cs b/Software/Visual_Studio/Tango.Settings/MachineStudioSettings/MachineStudio.cs index 721a884dd..951d4a407 100644 --- a/Software/Visual_Studio/Tango.Settings/MachineStudioSettings/MachineStudio.cs +++ b/Software/Visual_Studio/Tango.Settings/MachineStudioSettings/MachineStudio.cs @@ -43,6 +43,11 @@ namespace Tango.Settings.MachineStudioSettings public TechnicianModule TechnicianModule { get; set; } /// <summary> + /// Gets or sets the developer module settings. + /// </summary> + public DeveloperModule DeveloperModule { get; set; } + + /// <summary> /// Initializes a new instance of the <see cref="MachineStudio"/> class. /// </summary> public MachineStudio() @@ -50,6 +55,7 @@ namespace Tango.Settings.MachineStudioSettings SynchronizationModule = new SynchronizationModule(); StubsModule = new StubsModule(); TechnicianModule = new TechnicianModule(); + DeveloperModule = new DeveloperModule(); } } } diff --git a/Software/Visual_Studio/Tango.Settings/Tango.Settings.csproj b/Software/Visual_Studio/Tango.Settings/Tango.Settings.csproj index a51e15d9a..b2b751bf7 100644 --- a/Software/Visual_Studio/Tango.Settings/Tango.Settings.csproj +++ b/Software/Visual_Studio/Tango.Settings/Tango.Settings.csproj @@ -45,6 +45,7 @@ </Compile> <Compile Include="DataBase.cs" /> <Compile Include="Integration.cs" /> + <Compile Include="MachineStudioSettings\DeveloperModule.cs" /> <Compile Include="MachineStudioSettings\MachineStudio.cs" /> <Compile Include="MachineStudioSettings\StubsModule.cs" /> <Compile Include="MachineStudioSettings\SynchronizationModule.cs" /> diff --git a/Software/Visual_Studio/Tango.SharedUI/ViewModel.cs b/Software/Visual_Studio/Tango.SharedUI/ViewModel.cs index e83cd3e87..994e6d380 100644 --- a/Software/Visual_Studio/Tango.SharedUI/ViewModel.cs +++ b/Software/Visual_Studio/Tango.SharedUI/ViewModel.cs @@ -106,6 +106,7 @@ namespace Tango.SharedUI /// </summary> public T View { get; set; } + /// <summary> /// Initializes a new instance of the <see cref="ViewModel{T}"/> class. /// </summary> |
