aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Controls/JobSummeryViewer.xaml
blob: eeb25dc835d4355cb7838a52df233ae204640ecc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<UserControl x:Class="Tango.MachineStudio.Developer.Controls.JobSummeryViewer"
             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:enumerations="clr-namespace:Tango.BL.Enumerations;assembly=Tango.BL"
             xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI"
             xmlns:entities="clr-namespace:Tango.BL.Entities;assembly=Tango.BL"
             xmlns:local="clr-namespace:Tango.MachineStudio.Developer.Controls"
             mc:Ignorable="d" 
             d:DesignHeight="60" d:DesignWidth="500" Height="38" d:DataContext="{d:DesignInstance Type=entities:Job, IsDesignTimeCreatable=False}" x:Name="control">

    <UserControl.Resources>
        <converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
        <converters:SegmentLengthToWidthConverter x:Key="SegmentLengthToWidthConverter" />
        <converters:SmallerThanToBooleanConverter x:Key="SmallerThanToBooleanConverter" />
        <converters:WidthHeightToRectConverter x:Key="WidthHeightToRectConverter" />

    </UserControl.Resources>
    

    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="1*"/>
            <ColumnDefinition Width="Auto"/>
        </Grid.ColumnDefinitions>
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="1*" />
            </Grid.RowDefinitions>

            <ItemsControl ClipToBounds="False" ItemsSource="{Binding EffectiveSegments,IsAsync=True}" Visibility="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DisplayMarkers,Converter={StaticResource BooleanToVisibilityConverter}}">
                <ItemsControl.ItemsPanel>
                    <ItemsPanelTemplate>
                        <StackPanel Orientation="Horizontal" ClipToBounds="False"></StackPanel>
                    </ItemsPanelTemplate>
                </ItemsControl.ItemsPanel>
                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                        <Grid x:Name="grid">
                            <Grid.Width>
                                <MultiBinding Converter="{StaticResource SegmentLengthToWidthConverter}">
                                    <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="DataContext.Length"></Binding>
                                    <Binding RelativeSource="{RelativeSource AncestorType=ItemsControl}" Path="ActualWidth"></Binding>
                                    <Binding Path="LengthWithFactor"></Binding>
                                </MultiBinding>
                            </Grid.Width>

                            <TextBlock HorizontalAlignment="Center" FontSize="10">
                                <TextBlock.Style>
                                    <Style TargetType="TextBlock">
                                        <Setter Property="Visibility" Value="Visible"></Setter>
                                        <Style.Triggers>
                                            <DataTrigger Binding="{Binding ElementName=grid,Path=ActualWidth,Converter={StaticResource SmallerThanToBooleanConverter},ConverterParameter=20}" Value="True">
                                                <Setter Property="Visibility" Value="Collapsed"></Setter>
                                            </DataTrigger>
                                        </Style.Triggers>
                                    </Style>
                                </TextBlock.Style>
                                 <Run Text="{Binding LengthWithFactor,Mode=OneWay,StringFormat=N0,IsAsync=True}"></Run><Run Text="m"></Run>
                            </TextBlock>
                        </Grid>
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ItemsControl>

            <Border Grid.Row="1" x:Name="brush_border" ClipToBounds="False" CornerRadius="10" Margin="0 5 0 0">
                <Border.Clip>
                    <RectangleGeometry RadiusX="10" RadiusY="10">
                        <RectangleGeometry.Rect>
                            <MultiBinding Converter="{StaticResource WidthHeightToRectConverter}">
                                <Binding ElementName="brush_border" Path="ActualWidth"  />
                                <Binding ElementName="brush_border" Path="ActualHeight"  />
                            </MultiBinding>
                        </RectangleGeometry.Rect>
                    </RectangleGeometry>
                </Border.Clip>
                <!--<Border.Background>
                    --><!--<ImageBrush ImageSource="../Images/JobView/transparent_small.jpg" Stretch="None" TileMode="Tile" AlignmentX="Left" ViewportUnits="Absolute" Viewport="0,0,94,30" />--><!--
                </Border.Background>-->
                <Grid>
                    <ItemsControl ClipToBounds="False" ItemsSource="{Binding EffectiveSegments,IsAsync=True}">
                        <ItemsControl.ItemsPanel>
                            <ItemsPanelTemplate>
                                <StackPanel Orientation="Horizontal" ClipToBounds="False"></StackPanel>
                            </ItemsPanelTemplate>
                        </ItemsControl.ItemsPanel>
                        <ItemsControl.ItemTemplate>
                            <DataTemplate>
                                <Grid>
                                    <Grid.Width>
                                        <MultiBinding Converter="{StaticResource SegmentLengthToWidthConverter}">
                                            <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="DataContext.Length"></Binding>
                                            <Binding RelativeSource="{RelativeSource AncestorType=ItemsControl}" Path="ActualWidth"></Binding>
                                            <Binding Path="LengthWithFactor"></Binding>
                                        </MultiBinding>
                                    </Grid.Width>
                                    <Rectangle Fill="{Binding SegmentBrush}"></Rectangle>
                                </Grid>
                            </DataTemplate>
                        </ItemsControl.ItemTemplate>
                    </ItemsControl>

                    <Rectangle Stroke="{StaticResource GrayBrush}" StrokeThickness="1" StrokeDashArray="5 5 5 5" RadiusX="8" RadiusY="8" />
                </Grid>
            </Border>
        </Grid>

        <Grid Grid.Column="1" VerticalAlignment="Bottom">
            <Grid.Style>
                <Style TargetType="Grid">
                    <Setter Property="Visibility" Value="Collapsed"></Setter>
                    <Style.Triggers>
                        <MultiDataTrigger>
                            <MultiDataTrigger.Conditions>
                                <Condition Binding="{Binding JobType}" Value="{x:Static enumerations:JobTypes.Embroidery}" />
                                <Condition Binding="{Binding ElementName=control,Path=IsActive}" Value="False" />
                            </MultiDataTrigger.Conditions>
                            <Setter Property="Visibility" Value="Visible"></Setter>
                        </MultiDataTrigger>
                    </Style.Triggers>
                </Style>
            </Grid.Style>

            <TextBlock Margin="10 0 0 -2" VerticalAlignment="Center" FontSize="16">
                <Run Text="x"></Run><Run Text="{Binding NumberOfUnits}"></Run>
            </TextBlock>
        </Grid>
    </Grid>
</UserControl>
quot;/> </Trigger> <Trigger Property="IsKeyboardFocused" Value="true"> <Setter Property="Background" TargetName="Bd" Value="{DynamicResource ToolBarButtonHover}"/> <Setter Property="Stroke" TargetName="Path2" Value="{DynamicResource Grip.Submenu.Background.Selected}"/> <Setter Property="Fill" TargetName="Path4" Value="{DynamicResource Grip.Submenu.Background.Selected}"/> </Trigger> <Trigger Property="IsEnabled" Value="false"> <Setter Property="Foreground" Value="{DynamicResource ToolBarGripper}"/> </Trigger> <Trigger Property="IsPressed" Value="True"> <Setter Property="Stroke" TargetName="Path2" Value="{DynamicResource Grip.Submenu.Background.Selected}"/> <Setter Property="Fill" TargetName="Path4" Value="{DynamicResource Grip.Submenu.Background.Selected}"/> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> <Style.Triggers> <DataTrigger Binding="{Binding Source={x:Static SystemParameters.HighContrast}}" Value="true"> <Setter Property="Background" Value="{DynamicResource ControlBrushColorKey}"/> </DataTrigger> </Style.Triggers> </Style> <Style x:Key="ToolBarThumbStyle" TargetType="{x:Type Thumb}"> <Setter Property="OverridesDefaultStyle" Value="true" /> <Setter Property="Cursor" Value="SizeAll" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Thumb}"> <Border Background="Transparent" SnapsToDevicePixels="True"> <Rectangle Margin="0,2" > <Rectangle.Fill> <DrawingBrush Viewport="0,0,4,4" ViewportUnits="Absolute" Viewbox="0,0,8,8" ViewboxUnits="Absolute" TileMode="Tile"> <DrawingBrush.Drawing> <DrawingGroup> <GeometryDrawing Brush="#FF46464A" Geometry="M 4 4 L 4 8 L 8 8 L 8 4 z" /> </DrawingGroup> </DrawingBrush.Drawing> </DrawingBrush> </Rectangle.Fill> </Rectangle> </Border> </ControlTemplate> </Setter.Value> </Setter> </Style> <Style x:Key="ToolBarMainPanelBorderStyle" TargetType="{x:Type Border}"> <Setter Property="Margin" Value="0,0,11,0"/> <Setter Property="CornerRadius" Value="3,3,3,3"/> <Style.Triggers> <DataTrigger Binding="{Binding Source={x:Static SystemParameters.HighContrast}}" Value="true"> <Setter Property="CornerRadius" Value="0,0,0,0"/> </DataTrigger> </Style.Triggers> </Style> <Style x:Key="TangoToolBarStyle" TargetType="{x:Type ToolBar}"> <Setter Property="Background" Value="{DynamicResource ToolBarHorizontalBackground}"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ToolBar}"> <Grid x:Name="Grid" Margin="3,1,1,1" SnapsToDevicePixels="true"> <Grid x:Name="OverflowGrid" HorizontalAlignment="Right"> <ToggleButton x:Name="OverflowButton" ClickMode="Press" FocusVisualStyle="{x:Null}" IsChecked="{Binding IsOverflowOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" IsEnabled="{TemplateBinding HasOverflowItems}" Style="{DynamicResource ToolBarHorizontalOverflowButtonStyle}"/> <Popup x:Name="OverflowPopup" AllowsTransparency="true" Focusable="false" IsOpen="{Binding IsOverflowOpen, RelativeSource={RelativeSource TemplatedParent}}" PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}" Placement="Bottom" StaysOpen="false"> <!--<AThemes:SystemDropShadowChrome x:Name="Shdw" Color="Transparent">--> <Border x:Name="ToolBarSubMenuBorder" BorderBrush="{DynamicResource ToolBarMenuBorder}" BorderThickness="1" Background="{DynamicResource ToolBarSubMenuBackground}" RenderOptions.ClearTypeHint="Enabled"> <ToolBarOverflowPanel x:Name="PART_ToolBarOverflowPanel" KeyboardNavigation.DirectionalNavigation="Cycle" FocusVisualStyle="{x:Null}" Focusable="true" Margin="2" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" KeyboardNavigation.TabNavigation="Cycle" WrapWidth="200"/> </Border> <!--</AThemes:SystemDropShadowChrome>--> </Popup> </Grid> <Border x:Name="MainPanelBorder" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" Style="{DynamicResource ToolBarMainPanelBorderStyle}"> <DockPanel KeyboardNavigation.TabIndex="1" KeyboardNavigation.TabNavigation="Local"> <Thumb x:Name="ToolBarThumb" Margin="-3,-1,0,0" Padding="6,5,1,6" Style="{StaticResource ToolBarThumbStyle}" Width="10"/> <ContentPresenter x:Name="ToolBarHeader" ContentSource="Header" HorizontalAlignment="Center" Margin="4,0,4,0" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Center"/> <ToolBarPanel x:Name="PART_ToolBarPanel" IsItemsHost="true" Margin="0,1,2,2" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/> </DockPanel> </Border> </Grid> <ControlTemplate.Triggers> <Trigger Property="IsOverflowOpen" Value="true"> <Setter Property="IsEnabled" TargetName="ToolBarThumb" Value="false"/> </Trigger> <Trigger Property="Header" Value="{x:Null}"> <Setter Property="Visibility" TargetName="ToolBarHeader" Value="Collapsed"/> </Trigger> <Trigger Property="ToolBarTray.IsLocked" Value="true"> <Setter Property="Visibility" TargetName="ToolBarThumb" Value="Collapsed"/> </Trigger> <Trigger Property="HasDropShadow" SourceName="OverflowPopup" Value="true"> <!--<Setter Property="Margin" TargetName="Shdw" Value="0,0,5,5"/> <Setter Property="SnapsToDevicePixels" TargetName="Shdw" Value="true"/> <Setter Property="Color" TargetName="Shdw" Value="#71000000"/>--> </Trigger> <Trigger Property="Orientation" Value="Vertical"> <Setter Property="Margin" TargetName="Grid" Value="1,3,1,1"/> <Setter Property="Style" TargetName="OverflowButton" Value="{StaticResource ToolBarVerticalOverflowButtonStyle}"/> <Setter Property="Height" TargetName="ToolBarThumb" Value="10"/> <Setter Property="Width" TargetName="ToolBarThumb" Value="Auto"/> <Setter Property="Margin" TargetName="ToolBarThumb" Value="-1,-3,0,0"/> <Setter Property="Padding" TargetName="ToolBarThumb" Value="5,6,6,1"/> <Setter Property="Margin" TargetName="ToolBarHeader" Value="0,0,0,4"/> <Setter Property="Margin" TargetName="PART_ToolBarPanel" Value="1,0,2,2"/> <Setter Property="DockPanel.Dock" TargetName="ToolBarThumb" Value="Top"/> <Setter Property="DockPanel.Dock" TargetName="ToolBarHeader" Value="Top"/> <Setter Property="HorizontalAlignment" TargetName="OverflowGrid" Value="Stretch"/> <Setter Property="VerticalAlignment" TargetName="OverflowGrid" Value="Bottom"/> <Setter Property="Placement" TargetName="OverflowPopup" Value="Right"/> <Setter Property="Margin" TargetName="MainPanelBorder" Value="0,0,0,11"/> <Setter Property="Background" Value="{DynamicResource ToolBarVerticalBackground}"/> </Trigger> <Trigger Property="IsEnabled" Value="false"> <Setter Property="Foreground" Value="{DynamicResource Menu.Disable.Foreground}"/> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> <Style.Triggers> <DataTrigger Binding="{Binding Source={x:Static SystemParameters.HighContrast}}" Value="true"> <Setter Property="Background" Value="{DynamicResource ControlBrushColorKey}"/> </DataTrigger> </Style.Triggers> <Style.Resources> <Style TargetType="{x:Type Button}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Button}"> <Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="true"> <Grid> <Rectangle x:Name="background" Fill="Transparent" Opacity="1"/> <ContentPresenter x:Name="contentPresenter" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/> </Grid> </Border> <ControlTemplate.Triggers> <Trigger Property="IsDefaulted" Value="true"> <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/> </Trigger> <Trigger Property="IsMouseOver" Value="true"> <Setter Property="Fill" TargetName="background" Value="{DynamicResource Toolbar.Button.MaouseMove.Background}"/> </Trigger> <Trigger Property="IsPressed" Value="true"> <Setter Property="Fill" TargetName="background" Value="{DynamicResource ControlBrushColorKey}"/> </Trigger> <Trigger Property="IsEnabled" Value="false"> <Setter Property="Background" TargetName="border" Value="{DynamicResource Button.Disabled.Background}"/> <Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource Button.Disabled.Border}"/> <Setter Property="TextElement.Foreground" TargetName="contentPresenter" Value="{DynamicResource Button.Disabled.Foreground}"/> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style> </Style.Resources> </Style> <Style x:Key="{x:Static ToolBar.SeparatorStyleKey}" TargetType="{x:Type Separator}"> <Setter Property="Width" Value="1" /> <Setter Property="Margin" Value="10,2,10,2" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Separator}"> <Rectangle Fill="{DynamicResource Inactive.Selection}" VerticalAlignment="Stretch"/> </ControlTemplate> </Setter.Value> </Setter> </Style> </ResourceDictionary>