aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/RunningJobViewerEureka.xaml
blob: dfbd47514436d94ad29349727c4d7618cdbe0080 (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
<UserControl x:Class="Tango.PPC.UI.Controls.RunningJobViewerEureka"
             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:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch"
             xmlns:converters="clr-namespace:Tango.PPC.UI.Converters"
             xmlns:local="clr-namespace:Tango.PPC.UI.Controls"
             xmlns:enumerations="clr-namespace:Tango.BL.Enumerations;assembly=Tango.BL"
             mc:Ignorable="d" 
             Name="RunningJobViewerEurekaContr"
             d:DesignHeight="60" d:DesignWidth="500" Height="38" d:DataContext="{d:DesignInstance Type=local:RunningJobViewerEureka, IsDesignTimeCreatable=False}">
    <UserControl.Resources>
        <converters:DoubleWidthConverter x:Key="DoubleWidthConverter" />
        <converters:ProgressBorderWidthConverter x:Key="ProgressBorderWidthConverter" />
    </UserControl.Resources>
    <Grid>
        <touch:SliderContentControl x:Name="slider_control" ThumbColor="{StaticResource TangoPrimaryAccentColor}" 
                                    Height="{Binding RelativeSource={RelativeSource AncestorType=local:RunningJobViewerEureka}, Path=HeightSlider}"
                                    ThumbHeight="{Binding RelativeSource={RelativeSource AncestorType=local:RunningJobViewerEureka}, Path=ThumbHeight}" 
                                    Width="{Binding RelativeSource={RelativeSource AncestorType=local:RunningJobViewerEureka}, Path=Width}"
                                    
                                    Minimum="{Binding RelativeSource={RelativeSource AncestorType=local:RunningJobViewerEureka}, Path=MinimumValue}"
                                    Maximum="{Binding RelativeSource={RelativeSource AncestorType=local:RunningJobViewerEureka}, Path=MaximumValue}"
                                    MouseDown="SliderContentControl_MouseDown" TouchDown="SliderContentControl_TouchDown" SizeChanged="Slider_control_SizeChanged" >


            <Border x:Name="brush_border" ClipToBounds="False" CornerRadius="7" Margin="0 0 0 0" Background="{StaticResource TangoLightForegroundBrush}">
                <Border.Clip>
                        <RectangleGeometry RadiusX="7" RadiusY="7">
                            <RectangleGeometry.Rect>
                                <MultiBinding Converter="{StaticResource WidthHeightToRectConverter}">
                                    <Binding ElementName="brush_border" Path="ActualWidth"  />
                                    <Binding ElementName="brush_border" Path="ActualHeight"  />
                                </MultiBinding>
                            </RectangleGeometry.Rect>
                        </RectangleGeometry>
                    </Border.Clip>
                <Grid>
                    <Canvas x:Name="ColorCanvas" Width="{Binding ElementName=slider_control, Path=ActualWidth}" Height="{Binding ElementName=slider_control, Path=ActualHeight}" ClipToBounds="True" >
                        <Border x:Name="ItemsBorder"   ClipToBounds="False" Margin="0 0 0 0" Height="{Binding ElementName=slider_control, Path=ActualHeight}"  >
                            <Grid ClipToBounds="False" HorizontalAlignment="Stretch" >
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto"/>
                                    <ColumnDefinition Width="1*"/>
                                </Grid.ColumnDefinitions>
                                <Grid>
                                    <ItemsControl  HorizontalAlignment="Left" x:Name="SegmentsItemsControl"   Width="{Binding ElementName=brush_border, Path=ActualWidth, Converter={StaticResource DoubleWidthConverter}}">
                                        <ItemsControl.ItemsPanel>
                                            <ItemsPanelTemplate>
                                                <StackPanel Orientation="Horizontal" ></StackPanel>
                                            </ItemsPanelTemplate>
                                        </ItemsControl.ItemsPanel>
                                        <ItemsControl.ItemTemplate>
                                            <DataTemplate>
                                                <Grid>
                                                    <Grid.Width>
                                                        <MultiBinding Converter="{StaticResource SegmentLengthToWidthConverter}">
                                                            <Binding RelativeSource="{RelativeSource AncestorType=local:RunningJobViewerEureka}" Path="JobUnitLength" Converter="{StaticResource DoubleWidthConverter}"></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>
                                </Grid>
                                <Grid Grid.Column="1">
                                    <ItemsControl  x:Name="LastSegmentsItemsControl" HorizontalAlignment="Right"  Margin="0 0 0 0" Width="{Binding ElementName=brush_border, Path=ActualWidth}">
                                        <ItemsControl.ItemsPanel>
                                            <ItemsPanelTemplate>
                                                <StackPanel Orientation="Horizontal" ></StackPanel>
                                            </ItemsPanelTemplate>
                                        </ItemsControl.ItemsPanel>
                                        <ItemsControl.ItemTemplate>
                                            <DataTemplate>
                                                <Grid>
                                                    <Grid.Width>
                                                        <MultiBinding Converter="{StaticResource SegmentLengthToWidthConverter}">
                                                            <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="RunningJobStatus.CurrentUnitTotalProgress" ></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>
                                </Grid>
                            </Grid>
                        </Border>
                    </Canvas>
                    <Rectangle Stroke="{StaticResource TangoGrayBrush}" StrokeThickness="1" StrokeDashArray="5 5 5 5" RadiusX="7" RadiusY="7" />
                </Grid>
            </Border>
        </touch:SliderContentControl>
    </Grid>
</UserControl>