diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2019-03-10 09:06:35 +0200 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2019-03-10 09:06:35 +0200 |
| commit | abc70316f80a9cb05b320828051bb7dcbfeaad1b (patch) | |
| tree | a334c1cc23b307710f6338523e5c20fb09017665 /Software/Visual_Studio/MachineStudio | |
| parent | cbdd79778764ce38017790e1e1f9316e52ec8104 (diff) | |
| parent | 7256fe1c07cf5ecbe485c3cdac238b88dfc2cd1d (diff) | |
| download | Tango-abc70316f80a9cb05b320828051bb7dcbfeaad1b.tar.gz Tango-abc70316f80a9cb05b320828051bb7dcbfeaad1b.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/MachineStudio')
38 files changed, 763 insertions, 123 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> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/MachineView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/MachineView.xaml new file mode 100644 index 000000000..6f352f35c --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/MachineView.xaml @@ -0,0 +1,268 @@ +<UserControl x:Class="Tango.MachineStudio.Common.Controls.MachineView" + 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:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + xmlns:sharedConverters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:local="clr-namespace:Tango.MachineStudio.Common.Controls" + mc:Ignorable="d" + d:DesignHeight="720" d:DesignWidth="1280"> + + <UserControl.Resources> + <sharedConverters:ColorToIntegerConverter x:Key="ColorToIntegerConverter" /> + + <Style TargetType="Expander" BasedOn="{StaticResource {x:Type Expander}}"> + <Setter Property="HeaderTemplate"> + <Setter.Value> + <DataTemplate> + <TextBlock Text="{Binding}" FontSize="13"></TextBlock> + </DataTemplate> + </Setter.Value> + </Setter> + </Style> + </UserControl.Resources> + + <Grid> + <Viewbox MaxWidth="1200" Grid.Row="1" > + <Grid VerticalAlignment="Top"> + + <Image IsHitTestVisible="False" Source="../Images/machine-full-fx.png" MaxWidth="800" RenderOptions.BitmapScalingMode="Fant"> + <Image.Effect> + <DropShadowEffect ShadowDepth="0" BlurRadius="20" Opacity="1" RenderingBias="Performance" Color="DimGray"></DropShadowEffect> + </Image.Effect> + </Image> + + <Canvas ClipToBounds="False" x:Name="canvas"> + + <Grid x:Name="hardwareGrid" Width="118" Height="27" Canvas.Left="342" Canvas.Top="80" Background="#6B303030" IsHitTestVisible="True"> + <Border BorderBrush="#6C6C6C" BorderThickness="1" IsHitTestVisible="False"> + <StackPanel Orientation="Horizontal"> + <Image Source="../Images/hardware.png" Width="10" VerticalAlignment="Center" Margin="5" RenderOptions.BitmapScalingMode="Fant"></Image> + <TextBlock Padding="2 0 2 0" VerticalAlignment="Center" TextAlignment="Center" Foreground="Gainsboro" IsHitTestVisible="False" FontSize="6" TextWrapping="Wrap"> + <Run Text="{Binding Configuration.HardwareVersion.Name}"></Run> + <Run Text="{Binding Configuration.HardwareVersion.Version}"></Run> + </TextBlock> + </StackPanel> + </Border> + </Grid> + + <TextBlock Canvas.Left="532" FontStyle="Italic" Foreground="Gray" Canvas.Top="-22">Hardware</TextBlock> + <Grid Width="97" Height="90" Canvas.Left="431" Canvas.Top="-13"> + <Rectangle Stroke="Gray" VerticalAlignment="Top" StrokeThickness="1" StrokeDashArray="5" RenderTransformOrigin="0.5,0.5"/> + <Rectangle Stroke="Gray" HorizontalAlignment="Left" StrokeThickness="1" StrokeDashArray="5" RenderTransformOrigin="0.5,0.5"/> + </Grid> + + <UniformGrid Width="310" Canvas.Top="295" Canvas.Left="420" Rows="1" Columns="8" TextElement.FontSize="9"> + <TextBlock HorizontalAlignment="Center">1</TextBlock> + <TextBlock HorizontalAlignment="Center">2</TextBlock> + <TextBlock HorizontalAlignment="Center">3</TextBlock> + <TextBlock HorizontalAlignment="Center">4</TextBlock> + <TextBlock HorizontalAlignment="Center">5</TextBlock> + <TextBlock HorizontalAlignment="Center">6</TextBlock> + <TextBlock HorizontalAlignment="Center">7</TextBlock> + <TextBlock HorizontalAlignment="Center">8</TextBlock> + </UniformGrid> + + <Grid x:Name="gridIds" Width="310" Height="195" Canvas.Top="314" Canvas.Left="420"> + <ListBox ItemsSource="{Binding Configuration.IdsPacks}" ScrollViewer.VerticalScrollBarVisibility="Disabled" ScrollViewer.HorizontalScrollBarVisibility="Disabled"> + <ListBox.ItemContainerStyle> + <Style TargetType="ListBoxItem" BasedOn="{StaticResource {x:Type ListBoxItem}}"> + <Setter Property="Padding" Value="0"></Setter> + <Setter Property="VerticalContentAlignment" Value="Stretch"></Setter> + <Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter> + </Style> + </ListBox.ItemContainerStyle> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <UniformGrid Columns="8"></UniformGrid> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + <ItemsControl.ItemTemplate> + <DataTemplate> + <Grid> + <Grid.RowDefinitions> + <RowDefinition Height="1*"/> + <RowDefinition Height="30"/> + </Grid.RowDefinitions> + <UniformGrid Columns="1" Rows="2"> + <Grid Margin="2"> + <Image IsHitTestVisible="False" Source="../Images/dispenser.png" RenderOptions.BitmapScalingMode="Fant"> + <Image.Style> + <Style TargetType="Image"> + <Style.Triggers> + <DataTrigger Binding="{Binding Dispenser}" Value="{x:Null}"> + <Setter Property="Opacity" Value="0.2"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </Image.Style> + </Image> + <Rectangle IsHitTestVisible="False" Margin="14 25 13 34"> + <Rectangle.Fill> + <LinearGradientBrush StartPoint="0,0" EndPoint="0,0.8" Opacity="0.8"> + <GradientStop Offset="0" Color="Transparent" /> + <GradientStop Offset="1" Color="{Binding LiquidType.Color,Converter={StaticResource ColorToIntegerConverter}}"/> + </LinearGradientBrush> + </Rectangle.Fill> + </Rectangle> + </Grid> + + <Grid Margin="2"> + <Image IsHitTestVisible="False" Stretch="Fill" Source="../Images/mid-tank.png" RenderOptions.BitmapScalingMode="Fant"> + <Image.Style> + <Style TargetType="Image"> + <Style.Triggers> + <DataTrigger Binding="{Binding MidTankType}" Value="{x:Null}"> + <Setter Property="Opacity" Value="0.2"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </Image.Style> + </Image> + <Rectangle IsHitTestVisible="False" Margin="4 25 4 1"> + <Rectangle.Fill> + <LinearGradientBrush StartPoint="0,0" EndPoint="0,0.8" Opacity="0.8"> + <GradientStop Offset="0" Color="Transparent" /> + <GradientStop Offset="1" Color="{Binding LiquidType.Color,Converter={StaticResource ColorToIntegerConverter}}"/> + </LinearGradientBrush> + </Rectangle.Fill> + </Rectangle> + </Grid> + </UniformGrid> + + <Grid Grid.Row="1" Margin="3" IsHitTestVisible="False"> + <Grid.Style> + <Style TargetType="Grid"> + <Style.Triggers> + <DataTrigger Binding="{Binding CartridgeType}" Value="{x:Null}"> + <Setter Property="Opacity" Value="0.2"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </Grid.Style> + <Border BorderBrush="#252525" BorderThickness="1" CornerRadius="3"> + <Border.Background> + <LinearGradientBrush> + <GradientStop Color="#FF252525"/> + <GradientStop Color="#FF838383" Offset="1"/> + </LinearGradientBrush> + </Border.Background> + </Border> + <Border BorderBrush="#252525" BorderThickness="1" CornerRadius="3"> + <Border.Background> + <LinearGradientBrush Opacity="0.7"> + <GradientStop Offset="0" Color="Transparent" /> + <GradientStop Offset="1" Color="{Binding LiquidType.Color,Converter={StaticResource ColorToIntegerConverter}}"/> + </LinearGradientBrush> + </Border.Background> + </Border> + </Grid> + </Grid> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ListBox> + + <Grid Margin="0 50 0 0"> + <Grid.Style> + <Style TargetType="Grid"> + <Setter Property="Visibility" Value="Hidden"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding Configuration.IdsPacks.Count}" Value="0"> + <Setter Property="Visibility" Value="Visible"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </Grid.Style> + <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="20" FontWeight="Bold" Foreground="Gainsboro">NO IDS PACKS</TextBlock> + </Grid> + + <Rectangle VerticalAlignment="Bottom" Stroke="DimGray" StrokeThickness="1"> + <Rectangle.Effect> + <DropShadowEffect ShadowDepth="1" Opacity="1" Color="Black" /> + </Rectangle.Effect> + </Rectangle> + </Grid> + + <Grid x:Name="gridEmbedded" Width="70" Height="100" Canvas.Left="80" Canvas.Top="331" IsHitTestVisible="True" SnapsToDevicePixels="True"> + <Image Source="../Images/ti-tm4c129x.png" RenderOptions.BitmapScalingMode="Fant"></Image> + </Grid> + + <Grid Width="61" IsHitTestVisible="True" SnapsToDevicePixels="True" ClipToBounds="True" Height="42" Canvas.Left="85" Canvas.Top="385"> + <Grid.RowDefinitions> + <RowDefinition Height="1*" /> + </Grid.RowDefinitions> + + <StackPanel Orientation="Horizontal"> + <Image Source="../Images/embedded.png" Width="10" VerticalAlignment="Center" Margin="1" RenderOptions.BitmapScalingMode="Fant"></Image> + <TextBlock VerticalAlignment="Center" Padding="1" Foreground="Gainsboro" IsHitTestVisible="False" FontSize="5" TextAlignment="Center" TextWrapping="Wrap" Height="15" Margin="0,6,0,0" Width="47"><Run Text="{Binding Configuration.EmbeddedFirmwareVersion.Name}"/><Run Text=" "/><Run Text="{Binding Configuration.EmbeddedFirmwareVersion.Version}"/></TextBlock> + </StackPanel> + </Grid> + + <TextBlock Canvas.Top="163" Canvas.Left="288" FontStyle="Italic" Foreground="Gray">Touch Panel</TextBlock> + <Grid Width="53" Height="55" Canvas.Top="184" Canvas.Left="279"> + <Rectangle Stroke="Gray" VerticalAlignment="Bottom" StrokeThickness="1" StrokeDashArray="5" RenderTransformOrigin="0.5,0.5"/> + <Rectangle Stroke="Gray" HorizontalAlignment="Right" StrokeThickness="1" StrokeDashArray="5" RenderTransformOrigin="0.5,0.5"/> + </Grid> + + <TextBlock Canvas.Top="441" Canvas.Left="156" FontStyle="Italic" Foreground="Gray">Embedded Firmware</TextBlock> + <Grid Width="82" Height="26" Canvas.Top="410" Canvas.Left="158"> + <Rectangle Stroke="Gray" VerticalAlignment="Top" StrokeThickness="1" StrokeDashArray="5" RenderTransformOrigin="0.5,0.5"/> + <Rectangle Stroke="Gray" HorizontalAlignment="Right" StrokeThickness="1" StrokeDashArray="6" RenderTransformOrigin="0.5,0.5"/> + </Grid> + + <TextBlock Canvas.Top="310" Canvas.Left="340" FontStyle="Italic" Foreground="Gray">Dispensers</TextBlock> + <Grid Width="53" Height="20" Canvas.Top="331" Canvas.Left="377"> + <Rectangle Stroke="Gray" VerticalAlignment="Bottom" StrokeThickness="1" StrokeDashArray="5" RenderTransformOrigin="0.5,0.5"/> + <Rectangle Stroke="Gray" HorizontalAlignment="Left" StrokeThickness="1" StrokeDashArray="5" RenderTransformOrigin="0.5,0.5"/> + </Grid> + + <TextBlock Canvas.Top="395" Canvas.Left="331" FontStyle="Italic" Foreground="Gray">Mid Tanks</TextBlock> + <Grid Width="62" Height="29" Canvas.Top="418" Canvas.Left="357"> + <Rectangle Stroke="Gray" VerticalAlignment="Bottom" StrokeThickness="1" StrokeDashArray="5" RenderTransformOrigin="0.5,0.5"/> + <Rectangle Stroke="Gray" HorizontalAlignment="Left" StrokeThickness="1" StrokeDashArray="5" RenderTransformOrigin="0.5,0.5"/> + </Grid> + + <TextBlock Canvas.Top="469" Canvas.Left="304" FontStyle="Italic" Foreground="Gray">Cartridges</TextBlock> + <Grid Width="87" Height="10" Canvas.Top="487" Canvas.Left="332"> + <Rectangle Stroke="Gray" VerticalAlignment="Bottom" StrokeThickness="1" StrokeDashArray="5" RenderTransformOrigin="0.5,0.5"/> + <Rectangle Stroke="Gray" HorizontalAlignment="Left" StrokeThickness="1" StrokeDashArray="5" RenderTransformOrigin="0.5,0.5"/> + </Grid> + + <Grid x:Name="gridTablet" Width="67" IsHitTestVisible="True" SnapsToDevicePixels="True" ClipToBounds="True" Height="90" Canvas.Left="188" Canvas.Top="198"> + <Grid.RowDefinitions> + <RowDefinition Height="1*" /> + <RowDefinition Height="1*" /> + <RowDefinition Height="1*" /> + </Grid.RowDefinitions> + + <StackPanel> + <Image Source="../Images/tablet.png" Width="10" Margin="2" RenderOptions.BitmapScalingMode="Fant"></Image> + <TextBlock Padding="2 0 2 0" Foreground="Gainsboro" IsHitTestVisible="False" FontSize="6" TextAlignment="Center" TextWrapping="Wrap"> + <Run Text="{Binding Configuration.ApplicationDisplayPanelVersion.Name}"></Run> + <Run Text="{Binding Configuration.ApplicationDisplayPanelVersion.Version}"></Run> + </TextBlock> + </StackPanel> + + + <StackPanel Grid.Row="3" > + <Image Source="../Images/application-firmware.png" Width="10" Margin="2" RenderOptions.BitmapScalingMode="Fant"></Image> + <TextBlock Padding="2 0 2 0" IsHitTestVisible="False" Foreground="Gainsboro" FontSize="6" TextAlignment="Center" TextWrapping="Wrap"> + <Run Text="{Binding Configuration.ApplicationFirmwareVersion.Name}"></Run> + <Run Text="{Binding Configuration.ApplicationFirmwareVersion.Version}"></Run> + </TextBlock> + </StackPanel> + + <StackPanel Grid.Row="1" > + <Image Source="../Images/android.png" Width="10" Margin="2" RenderOptions.BitmapScalingMode="Fant"></Image> + <TextBlock Padding="2 0 2 0" IsHitTestVisible="False" Foreground="Gainsboro" FontSize="6" TextAlignment="Center" TextWrapping="Wrap"> + <Run Text="{Binding Configuration.ApplicationOsVersion.Name}"></Run> + <Run Text="{Binding Configuration.ApplicationOsVersion.Version}"></Run> + </TextBlock> + </StackPanel> + </Grid> + </Canvas> + </Grid> + </Viewbox> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/MachineView.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/MachineView.xaml.cs new file mode 100644 index 000000000..9d400549b --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/MachineView.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.Common.Controls +{ + /// <summary> + /// Interaction logic for MachineView.xaml + /// </summary> + public partial class MachineView : UserControl + { + public MachineView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Converters/UserRoleToBooleanConverter.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Converters/UserRoleToBooleanConverter.cs new file mode 100644 index 000000000..87a4d621e --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Converters/UserRoleToBooleanConverter.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Data; +using Tango.BL.Entities; +using Tango.BL.Enumerations; +using Tango.Core.DI; + +namespace Tango.MachineStudio.Common.Converters +{ + public class UserRoleToVisibilityConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + var user = value as User; + + if (user != null && parameter != null) + { + Roles role; + if (Enum.TryParse<Roles>(parameter.ToString(),out role)) + { + if (user.HasRole(role)) + { + return Visibility.Visible; + } + } + } + + return Visibility.Collapsed; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Converters/UserRoleToVisibilityConverter.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Converters/UserRoleToVisibilityConverter.cs new file mode 100644 index 000000000..7144d38be --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Converters/UserRoleToVisibilityConverter.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Data; +using Tango.BL.Entities; +using Tango.BL.Enumerations; +using Tango.Core.DI; + +namespace Tango.MachineStudio.Common.Converters +{ + public class UserRoleToBooleanConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + var user = value as User; + + if (user != null && parameter != null) + { + Roles role; + if (Enum.TryParse<Roles>(parameter.ToString(),out role)) + { + if (user.HasRole(role)) + { + return true; + } + } + } + + return false; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Images/android.png b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Images/android.png Binary files differnew file mode 100644 index 000000000..7fc5fbfe1 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Images/android.png diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Images/app.png b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Images/app.png Binary files differnew file mode 100644 index 000000000..9798ed866 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Images/app.png diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Images/application-firmware.png b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Images/application-firmware.png Binary files differnew file mode 100644 index 000000000..110ae36aa --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Images/application-firmware.png diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Images/cartridge.png b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Images/cartridge.png Binary files differnew file mode 100644 index 000000000..e3a9116fa --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Images/cartridge.png diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Images/dispenser.png b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Images/dispenser.png Binary files differnew file mode 100644 index 000000000..a070c94e0 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Images/dispenser.png diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Images/embedded-software.png b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Images/embedded-software.png Binary files differnew file mode 100644 index 000000000..b6a2087aa --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Images/embedded-software.png diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Images/embedded.png b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Images/embedded.png Binary files differnew file mode 100644 index 000000000..d0b917b44 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Images/embedded.png diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Images/formula.png b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Images/formula.png Binary files differnew file mode 100644 index 000000000..6f476e79c --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Images/formula.png diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Images/hardware.png b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Images/hardware.png Binary files differnew file mode 100644 index 000000000..856cf1ec7 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Images/hardware.png diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Images/injection.png b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Images/injection.png Binary files differnew file mode 100644 index 000000000..af1b3d575 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Images/injection.png diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Images/liquid.png b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Images/liquid.png Binary files differnew file mode 100644 index 000000000..7c5a4bceb --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Images/liquid.png diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Images/machine-full-fx.png b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Images/machine-full-fx.png Binary files differnew file mode 100644 index 000000000..b3c497546 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Images/machine-full-fx.png diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Images/mid-tank.png b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Images/mid-tank.png Binary files differnew file mode 100644 index 000000000..4da752a42 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Images/mid-tank.png diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Images/tablet.png b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Images/tablet.png Binary files differnew file mode 100644 index 000000000..1a09683eb --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Images/tablet.png diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Images/tank.png b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Images/tank.png Binary files differnew file mode 100644 index 000000000..59440e1e5 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Images/tank.png diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Images/ti-tm4c129x.png b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Images/ti-tm4c129x.png Binary files differnew file mode 100644 index 000000000..e414e3355 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Images/ti-tm4c129x.png diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs index f7c05c1a8..e5fe63d87 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs @@ -5,6 +5,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; +using Tango.BL; using Tango.Logging; using Tango.PMR.Printing; using Tango.Settings; @@ -108,6 +109,16 @@ namespace Tango.MachineStudio.Common public bool ByPassEnvironmentVersionCheck { get; set; } /// <summary> + /// Gets or sets a value indicating whether to enable database entity caching. + /// </summary> + public ObservablesContextInMemoryCachingMode CachingMode { get; set; } + + /// <summary> + /// Gets or sets the maximum cache time for a single entity (when CachingMode is set Absolute or Relative). + /// </summary> + public TimeSpan MaximumCacheTime { get; set; } + + /// <summary> /// Gets the machine service address. /// </summary> public String MachineServiceAddress @@ -136,6 +147,8 @@ namespace Tango.MachineStudio.Common Environment = WorkingEnvironment.Remote; DeploymentSlot = DeploymentSlot.DEV; JobUploadStrategy = JobUploadStrategy.Default; + MaximumCacheTime = TimeSpan.FromMinutes(5); + CachingMode = ObservablesContextInMemoryCachingMode.None; } } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Resources/GradientOffsetSlider.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Resources/GradientOffsetSlider.xaml index 28d29a727..4108e1cb6 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Resources/GradientOffsetSlider.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Resources/GradientOffsetSlider.xaml @@ -39,7 +39,7 @@ <Setter.Value> <ControlTemplate TargetType="Thumb"> <Canvas> - <materialDesign:PackIcon Kind="MapMarker" Width="24" Background="Transparent" Height="24" IsHitTestVisible="True" Margin="0 0 0 0" /> + <materialDesign:PackIcon Kind="MapMarker" Foreground="DimGray" Width="24" Background="Transparent" Height="24" IsHitTestVisible="True" Margin="0 0 0 0" /> </Canvas> </ControlTemplate> </Setter.Value> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj index 5d9c48cd4..4cf1855ca 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Tango.MachineStudio.Common.csproj @@ -84,6 +84,11 @@ <Link>GlobalVersionInfo.cs</Link> </Compile> <Compile Include="Authentication\AuthenticationLoginResult.cs" /> + <Compile Include="Controls\MachineView.xaml.cs"> + <DependentUpon>MachineView.xaml</DependentUpon> + </Compile> + <Compile Include="Converters\UserRoleToBooleanConverter.cs" /> + <Compile Include="Converters\UserRoleToVisibilityConverter.cs" /> <Compile Include="Web\LoginRequest.cs" /> <Compile Include="Web\LoginResponse.cs" /> <Compile Include="AutoComplete\MachinesProvider.cs" /> @@ -153,6 +158,10 @@ <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> </Page> + <Page Include="Controls\MachineView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> <Page Include="Controls\MdiContainerControl.xaml"> <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> @@ -326,7 +335,54 @@ <EmbedInteropTypes>True</EmbedInteropTypes> </COMReference> </ItemGroup> - <ItemGroup /> + <ItemGroup> + <Resource Include="Images\android.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\app.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\application-firmware.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\cartridge.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\dispenser.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\embedded-software.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\embedded.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\formula.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\hardware.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\injection.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\liquid.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\machine-full-fx.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\mid-tank.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\tablet.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\tank.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\ti-tm4c129x.png" /> + </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <ProjectExtensions> <VisualStudio> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs index d4598867c..2e2b1a014 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/App.xaml.cs @@ -84,6 +84,26 @@ namespace Tango.MachineStudio.UI exceptionTrapper = new WpfGlobalExceptionTrapper(); exceptionTrapper.Initialize(this); exceptionTrapper.ApplicationCrashed += ExceptionTrapper_ApplicationCrashed; + + //Apply Caching + if (settings.CachingMode != ObservablesContextInMemoryCachingMode.None) + { + LogManager.Log("EF Caching is enabled."); + LogManager.Log($"EF Caching mode is: {settings.CachingMode}."); + LogManager.Log($"EF Caching timeout: {settings.MaximumCacheTime.ToString()}"); + try + { + ObservablesContext.EnableInMemoryCache(settings.MaximumCacheTime, settings.CachingMode); + } + catch (Exception ex) + { + LogManager.Log(ex, "Error while trying to activate EF caching."); + } + } + else + { + LogManager.Log("EF Caching is disabled"); + } } #region Global Exception Trapping diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs index d6fb50a8c..7aa9ae890 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Authentication/DefaultAuthenticationProvider.cs @@ -84,7 +84,15 @@ namespace Tango.MachineStudio.UI.Authentication ObservablesContext.OverrideSettingsDataSource(response.DataSource); } - ObservablesStaticCollections.Instance.Initialize(); + try + { + ObservablesStaticCollections.Instance.Initialize(); + } + catch (System.Data.Entity.Core.MetadataException) + { + ObservablesContext.ClearModelStore(); + ObservablesStaticCollections.Instance.Initialize(); + } using (ObservablesContext db = ObservablesContext.CreateDefault()) { diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs index f313e9073..8440c88b2 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs @@ -4,5 +4,5 @@ using System.Runtime.InteropServices; [assembly: System.Windows.ThemeInfo(System.Windows.ResourceDictionaryLocation.None, System.Windows.ResourceDictionaryLocation.SourceAssembly)] [assembly: AssemblyTitle("Tango - Machine Studio")] -[assembly: AssemblyVersion("4.0.9.0")] +[assembly: AssemblyVersion("4.0.10.0")] [assembly: ComVisible(false)]
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/AboutView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/AboutView.xaml index 640c3c1df..54a8349e6 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/AboutView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/AboutView.xaml @@ -6,6 +6,7 @@ xmlns:vm="clr-namespace:Tango.MachineStudio.UI.ViewModels" xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:bl="clr-namespace:Tango.BL;assembly=Tango.BL" xmlns:local="clr-namespace:Tango.MachineStudio.UI.Views" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300" Width="600" Height="700" Background="White" d:DataContext="{d:DesignInstance Type=vm:AboutViewVM, IsDesignTimeCreatable=False}" DataContext="{Binding AboutViewVM, Source={StaticResource Locator}}"> @@ -13,6 +14,7 @@ <UserControl.Resources> <converters:VersionToShortVersionConverter x:Key="VersionToShortVersionConverter" /> <converters:EnumToDescriptionConverter x:Key="EnumToDescriptionConverter" /> + <converters:EnumToItemsSourceConverter x:Key="EnumToItemsSourceConverter" /> </UserControl.Resources> <Grid> @@ -60,6 +62,11 @@ <TextBlock><Run Text="{Binding DataSource.Address,Mode=OneWay}"></Run> <Run>(</Run><Run Foreground="Gray" Text="{Binding DataSource.Catalog,Mode=OneWay}"></Run><Run>)</Run> </TextBlock> + <TextBlock FontWeight="SemiBold">Caching Mode:</TextBlock> + <DockPanel> + <ComboBox Width="150" DockPanel.Dock="Left" ItemsSource="{Binding Source={x:Type bl:ObservablesContextInMemoryCachingMode},Converter={StaticResource EnumToItemsSourceConverter}}" SelectedValue="{Binding MachineStudioSettings.CachingMode}" SelectedValuePath="Value" DisplayMemberPath="DisplayName"></ComboBox> + <TextBlock Margin="20 0 0 0" Foreground="Gray" VerticalAlignment="Center">(Requires restart)</TextBlock> + </DockPanel> </controls:TableGrid> <DockPanel Margin="0 0 0 0"> |
