diff options
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules')
11 files changed, 277 insertions, 119 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/MachineStudio.Dispensers/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/MachineStudio.Dispensers/ViewModels/MainViewVM.cs index 2bd7e16a0..4042f84ad 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/MachineStudio.Dispensers/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/MachineStudio.Dispensers/ViewModels/MainViewVM.cs @@ -180,6 +180,8 @@ namespace Tango.MachineStudio.Dispensers.ViewModels { await SelectedDispenser.Reload(_dbContext); } + + View.NavigateTo(DispensersNavigationView.DispensersView); } catch (Exception ex) { diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Tango.MachineStudio.ColorLab.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Tango.MachineStudio.ColorLab.csproj index da97050b7..8a6c16067 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Tango.MachineStudio.ColorLab.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Tango.MachineStudio.ColorLab.csproj @@ -164,10 +164,6 @@ <Project>{cb0b0aa2-bb24-4bca-a720-45e397684e12}</Project> <Name>Tango.MachineStudio.Common</Name> </ProjectReference> - <ProjectReference Include="..\Tango.MachineStudio.MachineDesigner\Tango.MachineStudio.MachineDesigner.csproj"> - <Project>{d0ce8122-077d-42a2-9490-028ae4769b52}</Project> - <Name>Tango.MachineStudio.MachineDesigner</Name> - </ProjectReference> </ItemGroup> <ItemGroup> <Page Include="Views\CalibrationDataView.xaml"> @@ -196,7 +192,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/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/MainViewVM.cs index 6a89955d6..97af89253 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/ViewModels/MainViewVM.cs @@ -232,6 +232,16 @@ namespace Tango.MachineStudio.ColorLab.ViewModels set { _selectedSuggestion = value; RaisePropertyChangedAuto(); OnSelectedSuggestionChanged(); } } + private bool _isHosted; + /// <summary> + /// Gets or sets a value indicating whether this instance is hosted in another view. + /// </summary> + public bool IsHosted + { + get { return _isHosted; } + set { _isHosted = value; RaisePropertyChangedAuto(); } + } + #endregion #region Commands @@ -383,6 +393,15 @@ namespace Tango.MachineStudio.ColorLab.ViewModels input.InputCoordinates.InputLiquids.Add(inputLiquid); } + foreach (var process in SelectedRML.ProcessParametersTablesGroups.Single().ProcessParametersTables) + { + input.ProcessRanges.Add(new ProcessRange() + { + MinInkUptake = process.MinInkUptake, + MaxInkUptake = process.MaxInkUptake, + }); + } + var output = TangoColorConverter.GetSuggestions(input); IsOutOfGamut = output.OutOfGamut; @@ -538,7 +557,7 @@ namespace Tango.MachineStudio.ColorLab.ViewModels if (LiquidsCalibrationData == null || _prevent_inverse_conversion) return; //TODO: This is temporary because of out of range volumes. - if (LiquidVolumes.Where(x => x.IdsPack.IdsPackFormula.Code == IdsPackFormulas.StandardColor.ToInt32()).Sum(x => x.Volume) > 100) + if (LiquidVolumes.Where(x => x.IdsPack.IdsPackFormula.Code == IdsPackFormulas.StandardColor.ToInt32()).Sum(x => x.Volume) > 200) { IsVolumesOutOfRange = true; return; @@ -576,6 +595,15 @@ namespace Tango.MachineStudio.ColorLab.ViewModels input.InputCoordinates.InputLiquids.Add(inputLiquid); } + foreach (var process in SelectedRML.ProcessParametersTablesGroups.Single().ProcessParametersTables) + { + input.ProcessRanges.Add(new ProcessRange() + { + MinInkUptake = process.MinInkUptake, + MaxInkUptake = process.MaxInkUptake, + }); + } + var output = TangoColorConverter.GetSuggestions(input); TargetColor = new RgbVM() @@ -608,10 +636,14 @@ namespace Tango.MachineStudio.ColorLab.ViewModels { using (_notification.PushTaskItem("Loading RML data...")) { - _dbContext.Adapter.GetConfiguration(x => x.Guid == SelectedMachine.ConfigurationGuid); + if (!IsHosted) + { + _dbContext.Adapter.GetConfiguration(x => x.Guid == SelectedMachine.ConfigurationGuid); + } _selectedRML = new RmlBuilder(_dbContext) - .Set(_selectedRML) + .Set(_selectedRML.Guid) + .WithActiveParametersGroup() .WithCAT(SelectedMachine.Guid) .WithCCT() .WithLiquidFactors().Build(); @@ -708,38 +740,7 @@ namespace Tango.MachineStudio.ColorLab.ViewModels { IsFree = false; - if (_isNewCCT) - { - _dbContext.Ccts.Add(CCT); - } - - await CCT.SaveAsync(_dbContext); - - foreach (var calDataVM in LiquidsCalibrationData) - { - var cat = calDataVM.IdsPack.LiquidType.Cats.FirstOrDefault(x => x.Machine == SelectedMachine && x.Rml == SelectedRML); - - if (cat == null) - { - cat = new Cat(); - cat.Name = "untitled"; - _dbContext.Cats.Add(cat); - } - - cat.Rml = SelectedRML; - cat.Machine = SelectedMachine; - cat.LiquidType = calDataVM.IdsPack.LiquidType; - - CalibrationData calData = new CalibrationData(); - calData.LiquidType = (PMR.ColorLab.LiquidType)cat.LiquidType.Code; - calData.CalibrationPoints.AddRange(calDataVM.CalibrationPoints.Select(x => new CalibrationPoint() { X = x.X, Y = x.Y })); - - cat.PutCalibrationData(calData); - - await cat.SaveAsync(_dbContext); - } - - InvalidateLiquidFactorsCalibrationData(); + await SaveChanges(); } catch (Exception ex) { @@ -752,6 +753,40 @@ namespace Tango.MachineStudio.ColorLab.ViewModels } } + public async Task SaveChanges() + { + if (_isNewCCT) + { + _dbContext.Ccts.Add(CCT); + } + + foreach (var calDataVM in LiquidsCalibrationData) + { + var cat = calDataVM.IdsPack.LiquidType.Cats.FirstOrDefault(x => x.Machine == SelectedMachine && x.Rml == SelectedRML); + + if (cat == null) + { + cat = new Cat(); + cat.Name = "untitled"; + _dbContext.Cats.Add(cat); + } + + cat.Rml = SelectedRML; + cat.Machine = SelectedMachine; + cat.LiquidType = calDataVM.IdsPack.LiquidType; + + CalibrationData calData = new CalibrationData(); + calData.LiquidType = (PMR.ColorLab.LiquidType)cat.LiquidType.Code; + calData.CalibrationPoints.AddRange(calDataVM.CalibrationPoints.Select(x => new CalibrationPoint() { X = x.X, Y = x.Y })); + + cat.PutCalibrationData(calData); + } + + await _dbContext.SaveChangesAsync(); + + InvalidateLiquidFactorsCalibrationData(); + } + #endregion #region Override Methods @@ -763,5 +798,21 @@ namespace Tango.MachineStudio.ColorLab.ViewModels } #endregion + + public void InitHost(ObservablesContext context, Machine machine, IEnumerable<Rml> rmls, Rml selectedRml) + { + _dbContext = context; + _selectedMachine = machine; + + Rmls = new ObservableCollection<Rml>(rmls); + _selectedRML = selectedRml; + + RaisePropertyChanged(nameof(SelectedMachine)); + RaisePropertyChanged(nameof(SelectedRML)); + HiveSuggestions = new List<ColorConversionSuggestion>(); + CalibrationDataViewVM = new CalibrationDataViewVM(_notification); + + InvalidateLiquidFactorsCalibrationData(); + } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/MainView.xaml index 19fa9ebe6..59a1a9058 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorLab/Views/MainView.xaml @@ -14,7 +14,6 @@ xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" xmlns:vm="clr-namespace:Tango.MachineStudio.ColorLab.ViewModels" xmlns:brushPicker="clr-namespace:Tango.BrushPicker;assembly=Tango.BrushPicker" - xmlns:designer="clr-namespace:Tango.MachineStudio.MachineDesigner.Views;assembly=Tango.MachineStudio.MachineDesigner" xmlns:global="clr-namespace:Tango.MachineStudio.ColorLab" xmlns:local="clr-namespace:Tango.MachineStudio.ColorLab.Views" mc:Ignorable="d" @@ -28,17 +27,39 @@ <converters:ObjectToObjectTypeConverter x:Key="ObjectToObjectTypeConverter" /> <converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" /> <converters:BooleanInverseConverter x:Key="BooleanInverseConverter" /> + <converters:BooleanToVisibilityInverseConverter x:Key="BooleanToVisibilityInverseConverter" /> </UserControl.Resources> <Grid> + <Grid.Style> + <Style TargetType="Grid"> + <Setter Property="Margin" Value="0"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding IsHosted}" Value="True"> + <Setter Property="Margin" Value="-30 0 -10 0"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </Grid.Style> + <Grid.ColumnDefinitions> <ColumnDefinition Width="500"/> <ColumnDefinition Width="1*"/> </Grid.ColumnDefinitions> - <Grid Background="#B1FFFFFF" IsEnabled="{Binding IsFree}"> + <Grid IsEnabled="{Binding IsFree}"> + <Grid.Style> + <Style TargetType="Grid"> + <Setter Property="Background" Value="#B1FFFFFF"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding IsHosted}" Value="True"> + <Setter Property="Background" Value="Transparent"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </Grid.Style> <DockPanel> - <Grid DockPanel.Dock="Bottom" Margin="20"> + <Grid DockPanel.Dock="Bottom" Margin="20" Visibility="{Binding IsHosted,Converter={StaticResource BooleanToVisibilityInverseConverter}}"> <Button Height="60" Command="{Binding SaveCommand}" Width="200" HorizontalAlignment="Right"> <StackPanel Orientation="Horizontal"> <materialDesign:PackIcon Width="20" Height="20" VerticalAlignment="Center" Kind="ContentSaveSettings"></materialDesign:PackIcon> @@ -48,18 +69,21 @@ </Grid> <StackPanel> - <TextBlock Margin="40 20" FontSize="30" FontWeight="SemiBold" FontStyle="Italic">TARGET MACHINE</TextBlock> - <ComboBox ItemsSource="{Binding Machines}" FontSize="20" SelectedItem="{Binding SelectedMachine}" materialDesign:HintAssist.Hint="Serial Number" Margin="40 0 40 0"> - <ComboBox.ItemTemplate> - <DataTemplate> - <StackPanel> - <TextBlock Text="{Binding SerialNumber}" FontWeight="Bold" FontStyle="Italic"></TextBlock> - <TextBlock FontSize="11" Text="{Binding Name}" Foreground="Gray"></TextBlock> - </StackPanel> - </DataTemplate> - </ComboBox.ItemTemplate> - </ComboBox> - <designer:MachineView Width="500" IsHitTestVisible="False" Margin="0 40 0 0" DataContext="{Binding SelectedMachine}" /> + <StackPanel Visibility="{Binding IsHosted,Converter={StaticResource BooleanToVisibilityInverseConverter}}"> + <TextBlock Margin="40 20" FontSize="30" FontWeight="SemiBold" FontStyle="Italic">TARGET MACHINE</TextBlock> + <ComboBox ItemsSource="{Binding Machines}" FontSize="20" SelectedItem="{Binding SelectedMachine}" materialDesign:HintAssist.Hint="Serial Number" Margin="40 0 40 0"> + <ComboBox.ItemTemplate> + <DataTemplate> + <StackPanel> + <TextBlock Text="{Binding SerialNumber}" FontWeight="Bold" FontStyle="Italic"></TextBlock> + <TextBlock FontSize="11" Text="{Binding Name}" Foreground="Gray"></TextBlock> + </StackPanel> + </DataTemplate> + </ComboBox.ItemTemplate> + </ComboBox> + </StackPanel> + + <commonControls:MachineView Width="500" Margin="0 40 0 0" DataContext="{Binding SelectedMachine}" /> <StackPanel Margin="40 40"> <TextBlock FontSize="16">MEDIA</TextBlock> <ComboBox ItemsSource="{Binding Rmls}" SelectedItem="{Binding SelectedRML}" FontSize="16" IsEnabled="{Binding SelectedMachine,Converter={StaticResource NullObjectToBooleanConverter}}"> @@ -109,13 +133,13 @@ <Grid Grid.Column="1"> <Grid> <Grid.RowDefinitions> - <RowDefinition Height="135" /> + <RowDefinition Height="Auto" /> <RowDefinition Height="Auto"/> <RowDefinition Height="1*" /> </Grid.RowDefinitions> <Grid> - <Grid Margin="10 10 10 0"> + <Grid Margin="10 10 10 0" Height="135" Visibility="{Binding IsHosted,Converter={StaticResource BooleanToVisibilityInverseConverter}}"> <StackPanel HorizontalAlignment="Left" Margin="20 0 0 0"> <TextBlock Margin="0 0 0 0" FontSize="20" TextAlignment="Left">COLOR ADJUSTMENT DATA</TextBlock> <Grid> @@ -123,7 +147,7 @@ <materialDesign:PackIcon Kind="ArrowLeftBoldHexagonOutline" VerticalAlignment="Center" Width="40" Height="40" /> <Image Source="../Images/data-table.png" Height="80" Opacity="0.8"></Image> <StackPanel VerticalAlignment="Center" Width="300" Margin="10 0 0 0"> - + <TextBox IsReadOnly="False" Margin="0 5 0 0" Text="{Binding CCT.ForwardFileName}" HorizontalContentAlignment="Center"></TextBox> <UniformGrid Columns="2" Margin="0 5 0 0" HorizontalAlignment="Right"> <Button Style="{StaticResource MaterialDesignFlatButton}" Padding="0" Command="{Binding ImportForwardDataCommand}"> @@ -145,7 +169,7 @@ </StackPanel> </Grid> - <Rectangle VerticalAlignment="Bottom" Stroke="Silver"></Rectangle> + <Rectangle VerticalAlignment="Bottom" Stroke="Silver" Visibility="{Binding IsHosted,Converter={StaticResource BooleanToVisibilityInverseConverter}}"></Rectangle> </Grid> <Grid Grid.Row="1" Margin="0 40 0 0" HorizontalAlignment="Center"> @@ -278,6 +302,19 @@ </hive:HexList.ItemTemplate> </hive:HexList> + <TextBlock FontSize="40" Foreground="#FF5F5F" VerticalAlignment="Center" HorizontalAlignment="Center" Grid.Column="2" Grid.Row="1" Text="NO INPUT"> + <TextBlock.Style> + <Style TargetType="TextBlock"> + <Setter Property="Visibility" Value="Collapsed"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding HiveSuggestions.Count}" Value="0"> + <Setter Property="Visibility" Value="Visible"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </TextBlock.Style> + </TextBlock> + <Image Source="../Images/arrow-long-right.png" Grid.Column="3" Grid.Row="1" Width="120" Stretch="Fill" Height="30" Opacity="0.8" Margin="20 0 20 0"></Image> <Grid Grid.Column="4" Grid.Row="1" IsHitTestVisible="False"> 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 8ac8e6acd..35aca807c 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 @@ -65,7 +65,6 @@ namespace Tango.MachineStudio.Developer.ViewModels private DeveloperNavigationManager _navigation; private INavigationManager _msNavigation; private bool _blockInvalidateCommands; - private IAuthenticationProvider _authentication; private ObservablesContext _machineDbContext; private ObservablesContext _activeJobDbContext; private IEventLogger _eventLogger; @@ -549,6 +548,8 @@ namespace Tango.MachineStudio.Developer.ViewModels set { _enableColorConversion = value; RaisePropertyChangedAuto(); } } + public IAuthenticationProvider AuthenticationProvider { get; set; } + #endregion #region Commands @@ -707,7 +708,7 @@ namespace Tango.MachineStudio.Developer.ViewModels CanWork = true; EnableColorConversion = true; - _authentication = authentication; + AuthenticationProvider = authentication; _notification = notificationProvider; _speech = speech; @@ -2052,7 +2053,7 @@ namespace Tango.MachineStudio.Developer.ViewModels Job newJob = new Job(); newJob.Name = jobName; newJob.CreationDate = DateTime.UtcNow; - newJob.UserGuid = _authentication.CurrentUser.Guid; + newJob.UserGuid = AuthenticationProvider.CurrentUser.Guid; if (String.IsNullOrWhiteSpace(settings.DefaultJobRmlGuid)) { @@ -2255,7 +2256,7 @@ namespace Tango.MachineStudio.Developer.ViewModels job.Name = jobName; job.Name = jobName; job.CreationDate = DateTime.UtcNow; - job.UserGuid = _authentication.CurrentUser.Guid; + job.UserGuid = AuthenticationProvider.CurrentUser.Guid; job.Rml = _machineDbContext.Rmls.FirstOrDefault(); job.WindingMethod = _machineDbContext.WindingMethods.FirstOrDefault(); job.SpoolType = _machineDbContext.SpoolTypes.FirstOrDefault(); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml index 4fba0cc0b..1057f7c84 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml @@ -20,6 +20,7 @@ xmlns:vm="clr-namespace:Tango.MachineStudio.Developer.ViewModels" xmlns:localConverters="clr-namespace:Tango.MachineStudio.Developer.Converters" xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:commonConverters="clr-namespace:Tango.MachineStudio.Common.Converters;assembly=Tango.MachineStudio.Common" xmlns:observables="clr-namespace:Tango.BL.Entities;assembly=Tango.BL" xmlns:editors="clr-namespace:Tango.SharedUI.Editors;assembly=Tango.SharedUI" xmlns:video="clr-namespace:Tango.Video.DirectCapture;assembly=Tango.Video" @@ -73,6 +74,8 @@ <converters:ObjectToObjectTypeConverter x:Key="ObjectToObjectTypeConverter" /> <converters:MathOperatorConverter x:Key="MathOperatorConverter" /> <localConverters:LiquidVolumesToLubricantLiquidVolume x:Key="LiquidVolumesToLubricantLiquidVolume" /> + <commonConverters:UserRoleToVisibilityConverter x:Key="UserRoleToVisibilityConverter" /> + <commonConverters:UserRoleToBooleanConverter x:Key="UserRoleToBooleanConverter" /> <ObjectDataProvider x:Key="dispenserDivisions" MethodName="GetValues" ObjectType="{x:Type sys:Enum}"> @@ -321,7 +324,7 @@ </Border> </StackPanel> </DataTemplate> - + <DataTemplate x:Key="RGB_Template"> <StackPanel> <StackPanel Orientation="Horizontal"> @@ -426,7 +429,7 @@ <ContentControl Style="{StaticResource colorPicker}"></ContentControl> </StackPanel> </DataTemplate> - + </UserControl.Resources> <Grid> @@ -496,7 +499,7 @@ </StackPanel> </Border> - <controls:MultiSelectListBox FocusVisualStyle="{x:Null}" x:Name="listBoxSegments" MouseEnter="listBoxSegments_MouseEnter" PreviewMouseDown="listBoxSegments_PreviewMouseDown" AutomationProperties.AutomationId="{x:Static automation:Developer.SegmentsListBox}" Style="{StaticResource {x:Type ListBox}}" SelectionMode="Extended" SelectionChanged="ListBox_SelectionChanged" ItemsSource="{Binding SegmentsCollectionView}" SelectedItem="{Binding SelectedSegment}" SelectedItemsList="{Binding SelectedSegments,Mode=TwoWay}" HorizontalContentAlignment="Stretch"> + <controls:MultiSelectListBox FocusVisualStyle="{x:Null}" x:Name="listBoxSegments" MouseEnter="listBoxSegments_MouseEnter" PreviewMouseDown="listBoxSegments_PreviewMouseDown" AutomationProperties.AutomationId="{x:Static automation:Developer.SegmentsListBox}" Style="{StaticResource {x:Type ListBox}}" SelectionMode="Extended" SelectionChanged="ListBox_SelectionChanged" ItemsSource="{Binding SegmentsCollectionView}" SelectedItem="{Binding SelectedSegment}" SelectedItemsList="{Binding SelectedSegments,Mode=TwoWay}" HorizontalContentAlignment="Stretch" Padding="0 0 0 0"> <ListBox.ItemContainerStyle> <Style TargetType="ListBoxItem" BasedOn="{StaticResource basicListBoxItem}"> <EventSetter Event="PreviewMouseDown" Handler="ListBoxItem_PreviewMouseDown"></EventSetter> @@ -505,7 +508,7 @@ <ListBox.ItemTemplate> <DataTemplate> <Grid Margin="5 10" Style="{StaticResource draggableDroppableGrid}" dragAndDrop:DragAndDropService.Drop="OnSegmentDrop"> - <Polygon Points="40,0 290,0 290,100 0,100 0,30" StrokeThickness="0.2" IsHitTestVisible="False"> + <Polygon Points="40,0 290,0 290,100 0,100 0,30" StrokeThickness="0.2" IsHitTestVisible="False" Stretch="Fill"> <Polygon.Effect> <DropShadowEffect Opacity="0.5" /> </Polygon.Effect> @@ -539,7 +542,7 @@ <Border Height="100" Padding="5" IsHitTestVisible="False"> <Grid> <Rectangle VerticalAlignment="Bottom" Height="8" Fill="{Binding SegmentBrush}"> - + </Rectangle> </Grid> </Border> @@ -748,11 +751,11 @@ </StackPanel> </Border> - <Grid Margin="0 0 0 0"> + <Grid Margin="20 10 0 0"> <StackPanel> <TextBlock>MEDIA</TextBlock> <StackPanel Orientation="Horizontal" DockPanel.Dock="Left"> - <ComboBox Width="200" ItemsSource="{Binding Rmls}" SelectedItem="{Binding SelectedRML}"> + <ComboBox Width="250" ItemsSource="{Binding Rmls}" SelectedItem="{Binding SelectedRML}"> <ComboBox.ItemTemplate> <DataTemplate> <StackPanel> @@ -763,12 +766,12 @@ </ComboBox.ItemTemplate> </ComboBox> - <Button Margin="20 30 0 0" Command="{Binding EditRMLCommand}" HorizontalAlignment="Right" Style="{StaticResource MaterialDesignFlatButton}"> + <!--<Button Margin="20 30 0 0" Command="{Binding EditRMLCommand}" HorizontalAlignment="Right" Style="{StaticResource MaterialDesignFlatButton}"> <StackPanel Orientation="Horizontal"> <materialDesign:PackIcon VerticalAlignment="Center" Kind="Pencil"></materialDesign:PackIcon> <TextBlock Margin="10 0 0 0">EDIT MEDIA</TextBlock> </StackPanel> - </Button> + </Button>--> @@ -784,56 +787,48 @@ <StackPanel VerticalAlignment="Center" HorizontalAlignment="Center" Orientation="Horizontal" Margin="0 40 40 0"> <materialDesign:PackIcon Kind="ChevronLeft" Width="24" Height="24" /> - <TextBlock Margin="10 -2 10 0" VerticalAlignment="Center"><Run>RML LIQUID FACTORS</Run> <Run FontSize="10" Foreground="DimGray">( Max Nanolitter/CM )</Run></TextBlock> + <TextBlock Margin="10 -2 10 0" VerticalAlignment="Center"><Run>SUPPORTED MEDIA LIQUID</Run> <Run FontSize="10" Foreground="DimGray">( Max Nanolitter/CM )</Run></TextBlock> <materialDesign:PackIcon Kind="ChevronRight" Width="24" Height="24" /> </StackPanel> - <Grid HorizontalAlignment="Right" Margin="0 0 0 0"> - <Grid> - <DockPanel> - <Grid> - <StackPanel HorizontalAlignment="Right" Margin="0 0 0 0"> - <StackPanel Margin="0 10 0 0" Orientation="Horizontal" VerticalAlignment="Center"> - <ItemsControl ItemsSource="{Binding LiquidTypesRmls}"> - <ItemsControl.ItemsPanel> - <ItemsPanelTemplate> - <WrapPanel IsItemsHost="True"></WrapPanel> - </ItemsPanelTemplate> - </ItemsControl.ItemsPanel> - <ItemsControl.ItemTemplate> - <DataTemplate DataType="{x:Type observables:LiquidTypesRml}"> - <StackPanel Margin="0 0 10 0"> - <TextBlock HorizontalAlignment="Center" FontSize="10" Foreground="DimGray" Text="{Binding LiquidType.Name}"></TextBlock> - <Grid Width="58" Height="48" Margin="0 5 0 0"> - <shapes:Hexagon StrokeThickness="1" Stroke="Gray"> - <shapes:Hexagon.Fill> - <LinearGradientBrush Opacity="0.7" > - <GradientStop Color="{Binding LiquidType.Color,Converter={StaticResource ColorToIntegerConverter}}"/> - <GradientStop Color="White" Offset="1"/> - </LinearGradientBrush> - </shapes:Hexagon.Fill> - </shapes:Hexagon> + <Grid HorizontalAlignment="Right" Margin="0 0 0 0" IsEnabled="{Binding AuthenticationProvider.CurrentUser,Converter={StaticResource UserRoleToBooleanConverter},ConverterParameter='Researcher'}"> + <StackPanel HorizontalAlignment="Right" Margin="0 0 0 0"> + <StackPanel Margin="0 10 0 0" Orientation="Horizontal" VerticalAlignment="Center"> + <ItemsControl ItemsSource="{Binding LiquidTypesRmls}"> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <WrapPanel IsItemsHost="True"></WrapPanel> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + <ItemsControl.ItemTemplate> + <DataTemplate DataType="{x:Type observables:LiquidTypesRml}"> + <StackPanel Margin="0 0 10 0"> + <TextBlock HorizontalAlignment="Center" FontSize="10" Foreground="DimGray" Text="{Binding LiquidType.Name}"></TextBlock> + <Grid Width="58" Height="48" Margin="0 5 0 0"> + <shapes:Hexagon StrokeThickness="1" Stroke="Gray"> + <shapes:Hexagon.Fill> + <LinearGradientBrush Opacity="0.7" > + <GradientStop Color="{Binding LiquidType.Color,Converter={StaticResource ColorToIntegerConverter}}"/> + <GradientStop Color="White" Offset="1"/> + </LinearGradientBrush> + </shapes:Hexagon.Fill> + </shapes:Hexagon> - <TextBox Style="{x:Null}" Background="Transparent" Foreground="Black" BorderThickness="0" Text="{Binding MaxNlPerCm}" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" FontWeight="Bold" FontStyle="Italic"></TextBox> - </Grid> - </StackPanel> - </DataTemplate> - </ItemsControl.ItemTemplate> - </ItemsControl> + <TextBox Style="{x:Null}" Background="Transparent" Foreground="Black" BorderThickness="0" Text="{Binding MaxNlPerCm}" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" FontWeight="Bold" FontStyle="Italic"></TextBox> + </Grid> + </StackPanel> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> - <Button Command="{Binding SaveLiquidFactorsCommand}" HorizontalAlignment="Right" Margin="0 20 0 0" Style="{StaticResource MaterialDesignFlatButton}"> - <StackPanel Orientation="Horizontal"> - <materialDesign:PackIcon VerticalAlignment="Center" Kind="Harddisk"></materialDesign:PackIcon> - <TextBlock Margin="10 0 0 0">SAVE FACTORS</TextBlock> - </StackPanel> - </Button> - </StackPanel> + <Button Command="{Binding SaveLiquidFactorsCommand}" HorizontalAlignment="Right" Margin="0 20 0 0" Style="{StaticResource MaterialDesignFlatButton}"> + <StackPanel Orientation="Horizontal"> + <materialDesign:PackIcon VerticalAlignment="Center" Kind="Harddisk"></materialDesign:PackIcon> + <TextBlock Margin="10 0 0 0">SAVE FACTORS</TextBlock> </StackPanel> - - - </Grid> - </DockPanel> - </Grid> + </Button> + </StackPanel> + </StackPanel> </Grid> </Grid> </Grid> @@ -965,7 +960,7 @@ <TextBlock Width="180" TextAlignment="Center" HorizontalAlignment="Center" FontSize="16"> <Run FontWeight="Bold" FontStyle="Italic" Text="OFFSET:" Foreground="#5E5E5E"></Run> <Run FontFamily="{StaticResource digital-7}" Text="{Binding OffsetPercent,StringFormat={}{0:F1}%}"></Run> - <Run Foreground="Gray" Text="{Binding OffsetMeters,Mode=OneWay,StringFormat={} ( {0:F1}m )}"></Run> + <Run FontSize="12" Foreground="Gray" Text="{Binding OffsetMeters,Mode=OneWay,StringFormat={} ( {0:F1}m )}"></Run> </TextBlock> <Slider ValueChanged="Offset_Slider_ValueChanged" Style="{StaticResource GradientOffsetSlider}" SmallChange="0.1" IsSnapToTickEnabled="True" TickFrequency="0.1" Margin="0 20 0 0" HorizontalAlignment="Center" Width="300" Value="{Binding OffsetPercent}" IsEnabled="{Binding IsMiddle}"> <Slider.Foreground> @@ -1529,7 +1524,7 @@ TEMP OFF </TextBlock> </Button> - <Button Height="40" Command="{Binding SaveProcessParametersCommand}" HorizontalAlignment="Left"> + <Button Height="40" Command="{Binding SaveProcessParametersCommand}" HorizontalAlignment="Left" IsEnabled="{Binding AuthenticationProvider.CurrentUser,Converter={StaticResource UserRoleToBooleanConverter},ConverterParameter='Researcher'}"> <StackPanel Orientation="Horizontal"> <materialDesign:PackIcon VerticalAlignment="Center" Kind="ContentSave"></materialDesign:PackIcon> <TextBlock Margin="10 0 0 0">SAVE PARAMETERS</TextBlock> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj index 6ae893e72..d5ad86e2a 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj @@ -81,6 +81,9 @@ <Compile Include="ViewModels\MachineCreationDialogVM.cs" /> <Compile Include="ViewModels\MachineVersionDialogVM.cs" /> <Compile Include="ViewModels\MainViewVM.cs" /> + <Compile Include="Views\ColorCalibrationView.xaml.cs"> + <DependentUpon>ColorCalibrationView.xaml</DependentUpon> + </Compile> <Compile Include="Views\MachineCreationDialog.xaml.cs"> <DependentUpon>MachineCreationDialog.xaml</DependentUpon> </Compile> @@ -109,6 +112,10 @@ <Compile Include="Views\SpoolsView.xaml.cs"> <DependentUpon>SpoolsView.xaml</DependentUpon> </Compile> + <Page Include="Views\ColorCalibrationView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> <Page Include="Views\MachineCreationDialog.xaml"> <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> @@ -230,6 +237,10 @@ <Project>{cb0b0aa2-bb24-4bca-a720-45e397684e12}</Project> <Name>Tango.MachineStudio.Common</Name> </ProjectReference> + <ProjectReference Include="..\Tango.MachineStudio.ColorLab\Tango.MachineStudio.ColorLab.csproj"> + <Project>{4d183aca-552b-4135-ae81-7c5a8e5fc3b1}</Project> + <Name>Tango.MachineStudio.ColorLab</Name> + </ProjectReference> </ItemGroup> <ItemGroup> <Resource Include="Images\machine-full-fx.png" /> @@ -276,7 +287,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/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs index 22bf03148..044217c62 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs @@ -112,6 +112,12 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels set { _selectedSpool = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } } + private ColorLab.ViewModels.MainViewVM _colorLabVM; + public ColorLab.ViewModels.MainViewVM ColorLabVM + { + get { return _colorLabVM; } + set { _colorLabVM = value; RaisePropertyChangedAuto(); } + } #endregion @@ -201,6 +207,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels public override async void OnApplicationReady() { MachinesAdapter.MachineVersions = (await MachinesAdapter.Context.MachineVersions.ToListAsync()).ToObservableCollection(); + ColorLabVM = new ColorLab.ViewModels.MainViewVM(_notification) { IsHosted = true }; } #endregion @@ -419,6 +426,8 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels } } + ColorLabVM.InitHost(ActiveMachineAdapter.Context, ActiveMachine, ActiveMachineAdapter.Rmls, ActiveMachineAdapter.Rmls.FirstOrDefault()); + View.NavigateTo(MachineDesignerNavigationView.MachineDetailsView); } catch (Exception ex) @@ -561,6 +570,8 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels ActiveMachine.ProductionDate = DateTime.UtcNow; await ActiveMachineAdapter.Context.SaveChangesAsync(); + await ColorLabVM.SaveChanges(); + if (SelectedMachine != null) { await SelectedMachine.Reload(MachinesAdapter.Context); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/ColorCalibrationView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/ColorCalibrationView.xaml new file mode 100644 index 000000000..e73c9661f --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/ColorCalibrationView.xaml @@ -0,0 +1,20 @@ +<UserControl x:Class="Tango.MachineStudio.MachineDesigner.Views.ColorCalibrationView" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:local="clr-namespace:Tango.MachineStudio.MachineDesigner.Views" + xmlns:global="clr-namespace:Tango.MachineStudio.MachineDesigner" + xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:observables="clr-namespace:Tango.BL.Entities;assembly=Tango.BL" + xmlns:vm="clr-namespace:Tango.MachineStudio.MachineDesigner.ViewModels" + xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:colorLab="clr-namespace:Tango.MachineStudio.ColorLab.Views;assembly=Tango.MachineStudio.ColorLab" + mc:Ignorable="d" + d:DesignHeight="1080" d:DesignWidth="1920" Background="Transparent" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> + <Grid> + <colorLab:MainView DataContext="{Binding ColorLabVM}" /> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/ColorCalibrationView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/ColorCalibrationView.xaml.cs new file mode 100644 index 000000000..d617df37f --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/ColorCalibrationView.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Tango.MachineStudio.MachineDesigner.Views +{ + /// <summary> + /// Interaction logic for ColorCalibrationView.xaml + /// </summary> + public partial class ColorCalibrationView : UserControl + { + public ColorCalibrationView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineDetailsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineDetailsView.xaml index 31e7f535b..ce60ebf02 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineDetailsView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MachineDetailsView.xaml @@ -42,6 +42,9 @@ <Style TargetType="TabPanel"> <Setter Property="HorizontalAlignment" Value="Center"/> </Style> + <Style TargetType="TabItem" BasedOn="{StaticResource {x:Type TabItem}}"> + <Setter Property="Padding" Value="20,2"></Setter> + </Style> </TabControl.Resources> <TabItem Header="SETTINGS"> <local:MachineSettingsView/> @@ -52,6 +55,9 @@ <TabItem Header="SPOOLS"> <local:SpoolsView/> </TabItem> + <TabItem Header="COLOR CALIBRATION"> + <local:ColorCalibrationView/> + </TabItem> </TabControl> </Grid> </DockPanel> |
