diff options
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views')
7 files changed, 161 insertions, 11 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/EmbroideryDisplayView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/EmbroideryDisplayView.xaml new file mode 100644 index 000000000..22414b4b2 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/EmbroideryDisplayView.xaml @@ -0,0 +1,57 @@ +<UserControl x:Class="Tango.MachineStudio.Developer.Views.EmbroideryDisplayView" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:emb="clr-namespace:Tango.EmbroideryUI;assembly=Tango.EmbroideryUI" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + xmlns:vm="clr-namespace:Tango.MachineStudio.Developer.ViewModels" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:converters="clr-namespace:Tango.MachineStudio.Developer.Converters" + xmlns:local="clr-namespace:Tango.MachineStudio.Developer.Views" + mc:Ignorable="d" + Width="1280" Height="720" Background="White" d:DataContext="{d:DesignInstance Type=vm:EmbroideryDisplayViewVM, IsDesignTimeCreatable=False}"> + + <UserControl.Resources> + <converters:ByteArrayToBitmapSourceConverter x:Key="ByteArrayToBitmapSourceConverter" /> + </UserControl.Resources> + + <Grid> + <Grid> + <Grid.RowDefinitions> + <RowDefinition Height="60"/> + <RowDefinition Height="593*"/> + <RowDefinition Height="60"/> + </Grid.RowDefinitions> + + <Grid> + <StackPanel Orientation="Horizontal"> + <Image Source="../Images/sewing-machine.png" Width="48"></Image> + <TextBlock VerticalAlignment="Center" Margin="10 0 0 0" FontSize="20" Text="{Binding Job.EmbroideryFileName}"></TextBlock> + </StackPanel> + + <Rectangle VerticalAlignment="Bottom" Stroke="Silver"></Rectangle> + </Grid> + + <Grid Grid.Row="1"> + <Grid.Background> + <ImageBrush ImageSource="../Images/seamless-grid.jpg" Stretch="None" Opacity="0.5" TileMode="Tile" ViewportUnits="Absolute" Viewport="0,0,32,32"></ImageBrush> + </Grid.Background> + <Rectangle HorizontalAlignment="Left" Stroke="Silver"></Rectangle> + <Rectangle HorizontalAlignment="Right" Stroke="Silver"></Rectangle> + <Image HorizontalAlignment="Center" VerticalAlignment="Center" Source="{Binding Job.EmbroideryJpeg,Converter={StaticResource ByteArrayToBitmapSourceConverter}}"></Image> + </Grid> + + <Grid Grid.Row="2"> + <Rectangle VerticalAlignment="Top" Stroke="Silver"></Rectangle> + <StackPanel Orientation="Horizontal" HorizontalAlignment="Right"> + <Button Height="50" Command="{Binding ExportCommand}" Width="180"> + <StackPanel Orientation="Horizontal"> + <materialDesign:PackIcon Kind="Export" Width="24" Height="24" /> + <TextBlock Margin="5 0 0 0" FontSize="16">EXPORT</TextBlock> + </StackPanel> + </Button> + </StackPanel> + </Grid> + </Grid> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/EmbroideryDisplayView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/EmbroideryDisplayView.xaml.cs new file mode 100644 index 000000000..7d0771098 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/EmbroideryDisplayView.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.Developer.Views +{ + /// <summary> + /// Interaction logic for EmbroideryDisplayView.xaml + /// </summary> + public partial class EmbroideryDisplayView : UserControl + { + public EmbroideryDisplayView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/EmbroideryImportView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/EmbroideryImportView.xaml index 220e7d3ab..42d0bb106 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/EmbroideryImportView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/EmbroideryImportView.xaml @@ -6,6 +6,7 @@ xmlns:emb="clr-namespace:Tango.EmbroideryUI;assembly=Tango.EmbroideryUI" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:vm="clr-namespace:Tango.MachineStudio.Developer.ViewModels" + xmlns:mahApps="http://metro.mahapps.com/winfx/xaml/controls" xmlns:brushPicker="clr-namespace:Tango.BrushPicker;assembly=Tango.BrushPicker" xmlns:local="clr-namespace:Tango.MachineStudio.Developer.Views" mc:Ignorable="d" @@ -33,21 +34,55 @@ <Rectangle VerticalAlignment="Bottom" Stroke="Silver"></Rectangle> </Grid> - <Grid Grid.Row="1"> - <emb:EmbroideryFileEditor x:Name="editor" Background="White" FileName="{Binding FileName}" EmbroideryFile="{Binding EmbroideryFile,Mode=OneWayToSource}" Paths="{Binding Paths,Mode=OneWayToSource}" /> + <Grid Grid.Row="1" x:Name="gridEditor"> + <Grid.Background> + <ImageBrush ImageSource="../Images/seamless-grid.jpg" Stretch="None" Opacity="0.5" TileMode="Tile" ViewportUnits="Absolute" Viewport="0,0,32,32"></ImageBrush> + </Grid.Background> + <Rectangle HorizontalAlignment="Left" Stroke="Silver"></Rectangle> + <emb:EmbroideryFileEditor x:Name="editor" Background="Transparent" FileName="{Binding FileName}" EmbroideryFile="{Binding EmbroideryFile,Mode=OneWayToSource}" Paths="{Binding Paths,Mode=OneWayToSource}" /> </Grid> <Grid Grid.Column="1" Grid.Row="1"> <StackPanel> <TextBlock Margin="5">Region Brush</TextBlock> - <brushPicker:BrushPicker Margin="0 10 0 0" Background="White" BorderThickness="0" Brush="{Binding ElementName=editor,Path=SelectedPath.Brush,Mode=TwoWay}" /> + <Border Margin="5" BorderThickness="1" BorderBrush="Silver"> + <brushPicker:BrushPicker Background="White" BorderThickness="0" Brush="{Binding ElementName=editor,Path=SelectedPath.Brush,Mode=TwoWay}" /> + </Border> + + <Border BorderThickness="1" BorderBrush="Silver" Padding="5 0 5 5" Margin="5"> + <Border.Resources> + <Style TargetType="TextBlock"> + <Setter Property="Margin" Value="0 10 0 5"></Setter> + </Style> + </Border.Resources> + <StackPanel> + <TextBlock Text="Material"></TextBlock> + <ComboBox ItemsSource="{Binding EmbroideryMaterials}" SelectedItem="{Binding SelectedEmbroideryMaterial}" DisplayMemberPath="Name" Margin="5 0"></ComboBox> + + <TextBlock Text="Material Thickness"></TextBlock> + <mahApps:NumericUpDown Minimum="0" Maximum="100" StringFormat="# mm" Value="{Binding EmbroideryMaterialThickness}" HasDecimals="False" HorizontalContentAlignment="Center" /> + + <Grid Margin="0 20 0 5"> + <TextBlock Text="Stabilizer" Margin="0" HorizontalAlignment="Left"></TextBlock> + <ToggleButton HorizontalAlignment="Right" IsChecked="{Binding HasStabilizer}"></ToggleButton> + </Grid> + <ComboBox IsEnabled="{Binding HasStabilizer}" ItemsSource="{Binding EmbroideryMaterials}" SelectedItem="{Binding SelectedStabilizer}" DisplayMemberPath="Name" Margin="5 0"></ComboBox> + + <TextBlock Text="Stabilizer Thickness"></TextBlock> + <mahApps:NumericUpDown IsEnabled="{Binding HasStabilizer}" Minimum="1" Maximum="100" StringFormat="# mm" Value="{Binding StabilizerThickness}" HasDecimals="False" HorizontalContentAlignment="Center" /> + </StackPanel> + </Border> </StackPanel> <Rectangle HorizontalAlignment="Left" Stroke="Silver" /> </Grid> + <Grid Grid.Row="2" Grid.ColumnSpan="2"> + <Rectangle VerticalAlignment="Top" Stroke="Silver"></Rectangle> + </Grid> + <Grid Grid.Row="2" Grid.Column="1"> - <Button Height="50" Command="{Binding ImportCommand}"> + <Button Height="50" Click="OnImportClick" Command="{Binding ImportCommand}"> <StackPanel Orientation="Horizontal"> <materialDesign:PackIcon Kind="Import" Width="24" Height="24" /> <TextBlock Margin="5 0 0 0" FontSize="16">IMPORT</TextBlock> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/EmbroideryImportView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/EmbroideryImportView.xaml.cs index c34b6fef7..0b368a809 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/EmbroideryImportView.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/EmbroideryImportView.xaml.cs @@ -12,6 +12,7 @@ using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; +using Tango.SharedUI.Helpers; namespace Tango.MachineStudio.Developer.Views { @@ -20,9 +21,17 @@ namespace Tango.MachineStudio.Developer.Views /// </summary> public partial class EmbroideryImportView : UserControl { + public byte[] EmbroideryImageBytes { get; set; } + public EmbroideryImportView() { InitializeComponent(); } + + private void OnImportClick(object sender, RoutedEventArgs e) + { + var source = UIHelper.TakeSnapshot(gridEditor); + EmbroideryImageBytes = source.ToJpegBytes(50); + } } } 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 9ba41f688..1dea01de7 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 @@ -438,13 +438,13 @@ <Grid HorizontalAlignment="Right" Margin="0 0 10 0"> <StackPanel Orientation="Horizontal"> - <Button Height="70" Width="135" Margin="0 0 10 0" Background="White" Foreground="#202020" VerticalAlignment="Bottom" BorderBrush="Transparent" Command="{Binding DiscardJobCommand}"> + <Button Height="70" Width="100" Margin="0 0 10 0" Style="{StaticResource MaterialDesignFlatButton}" Foreground="#202020" VerticalAlignment="Bottom" BorderBrush="Transparent" Command="{Binding DiscardJobCommand}"> <StackPanel> <materialDesign:PackIcon HorizontalAlignment="Center" Width="24" Height="24" Kind="KeyboardBackspace" /> <TextBlock VerticalAlignment="Center" Margin="0 10 0 0">TO JOBS</TextBlock> </StackPanel> </Button> - <Button Height="70" Width="135" Margin="0 0 0 0" Background="White" Foreground="#202020" VerticalAlignment="Bottom" BorderBrush="Transparent" Command="{Binding SaveJobCommand}"> + <Button Height="70" Width="100" Margin="0 0 0 0" Style="{StaticResource MaterialDesignFlatButton}" Foreground="#202020" VerticalAlignment="Bottom" BorderBrush="Transparent" Command="{Binding SaveJobCommand}"> <StackPanel> <materialDesign:PackIcon HorizontalAlignment="Center" Width="24" Height="24" Kind="ContentSave" /> <TextBlock VerticalAlignment="Center" Margin="0 10 0 0">SAVE JOB</TextBlock> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MachineJobSelectionView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MachineJobSelectionView.xaml index 2115f2503..a8274a4f7 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MachineJobSelectionView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MachineJobSelectionView.xaml @@ -14,7 +14,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Tango.MachineStudio.Developer.Views" 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}"> + x:Name="control" d:DesignHeight="1080" d:DesignWidth="1920" Background="Transparent" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> <UserControl.Resources> <localConverters:SegmentToBrushConverterMulti x:Key="SegmentToBrushConverterMulti" /> @@ -131,8 +131,29 @@ <DataGrid.Columns> <DataGridTemplateColumn> <DataGridTemplateColumn.CellTemplate> - <DataTemplate> - <Image Source="../Images/rgb.png" Width="40" Margin="5"></Image> + <DataTemplate DataType="{x:Type observables:Job}"> + <ContentControl> + <ContentControl.Style> + <Style TargetType="ContentControl"> + <Setter Property="Content"> + <Setter.Value> + <Image Source="../Images/rgb.png" Width="40" Margin="5"></Image> + </Setter.Value> + </Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding HasEmbroideryFile}" Value="True"> + <Setter Property="Content"> + <Setter.Value> + <Button ToolTip="Press to display the attached embroidery file information" Style="{StaticResource emptyButton}" Cursor="Hand" Command="{Binding DataContext.DisplayJobEmbroideryFileCommand, Source={x:Reference control}}" CommandParameter="{Binding}"> + <Image Source="../Images/job-emb.png" Width="40" Margin="5"></Image> + </Button> + </Setter.Value> + </Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </ContentControl.Style> + </ContentControl> </DataTemplate> </DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml index 7a50a499e..c4915a4c8 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml @@ -132,7 +132,7 @@ <StackPanel Margin="0 0 0 0" HorizontalAlignment="Center" VerticalAlignment="Center"> <TextBlock Margin="0 0 0 0" FontSize="14" HorizontalAlignment="Right"> - <Run Text="{Binding Length,Mode=OneWay}"></Run> + <Run Text="{Binding Length,Mode=OneWay,StringFormat=N2}"></Run> <Run FontSize="12" Text="m"></Run> </TextBlock> <materialDesign:PackIcon HorizontalAlignment="Center" RenderTransformOrigin="0.5,0.5" Kind="Triangle" Width="12" Height="12"> @@ -197,7 +197,7 @@ <StackPanel Margin="0 -5 -40 0" HorizontalAlignment="Right"> <TextBlock FontSize="14"> - <Run Text="{Binding RunningJob.Length,Mode=OneWay}"></Run> + <Run Text="{Binding RunningJob.Length,Mode=OneWay,StringFormat=N2}"></Run> <Run FontSize="13" Text="m"></Run> </TextBlock> <materialDesign:PackIcon HorizontalAlignment="Right" RenderTransformOrigin="0.5,0.5" Kind="FlagCheckered" Width="20" Height="20"> |
