<commit_before>﻿<UserControl x:Class="openPDC.UI.UserControls.RealTimeStatisticUserControl"
             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" 
             mc:Ignorable="d" d:DesignHeight="590" d:DesignWidth="850"
             xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:uc="clr-namespace:TimeSeriesFramework.UI.UserControls;assembly=TimeSeriesFramework.UI.WPF"
             xmlns:tsfBinding="clr-namespace:TimeSeriesFramework.UI.Binding;assembly=TimeSeriesFramework.UI"
             xmlns:tsf="clr-namespace:TimeSeriesFramework.UI;assembly=TimeSeriesFramework.UI.WPF"
             xmlns:d3="http://research.microsoft.com/DynamicDataDisplay/1.0"
             Background="Transparent">

    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/TimeSeriesFramework.UI.WPF;Component/Resources/CommonResource.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>

    <StackPanel Orientation="Vertical">

        <StackPanel.Resources>

            <HierarchicalDataTemplate x:Key="MeasurementTemplate">
                
                <Border BorderThickness="0,0,0,1" BorderBrush="#FFDDDDDD">
                    <StackPanel Orientation="Horizontal" VerticalAlignment="Center">
                        <StackPanel.Resources>
                            <Style TargetType="{x:Type TextBlock}">
                                <Setter Property="HorizontalAlignment" Value="Left"/>
                                <Setter Property="TextAlignment" Value="Left"/>
                                <Setter Property="VerticalAlignment" Value="Center"/>
                            </Style>
                        </StackPanel.Resources>

                        <TextBlock Text="{tsfBinding:Column Path=ID}" Width="120"/>
                        <TextBlock Text="{tsfBinding:Column Path=SignalReference}" Width="140"/>
                        <TextBlock Text="{tsfBinding:Column Path=StatisticName}" ToolTip="{tsfBinding:Column Path=StatisticDescription}" Width="250" TextWrapping="Wrap"/>
                        <TextBlock Text="{tsfBinding:Column Path=TimeTag}" FontWeight="Bold" Width="90" HorizontalAlignment="Center" TextAlignment="Center"/>
                        <TextBlock Text="{tsfBinding:Column Path=Value}" FontWeight="Bold" Width="170"
                                   Foreground="{tsfBinding:Column Path=Quality, Converter={StaticResource StringToStatusColorConverter}}" HorizontalAlignment="Center" TextAlignment="Center"/>
                    </StackPanel>
                </Border>
                
            </HierarchicalDataTemplate>

            <HierarchicalDataTemplate x:Key="DeviceTemplate" ItemsSource="{tsfBinding:Column Path=StatisticMeasurementList}" ItemTemplate="{StaticResource MeasurementTemplate}">
                <StackPanel Orientation="Horizontal" VerticalAlignment="Center">

                    <StackPanel.Resources>
                        <Style TargetType="{x:Type TextBlock}">
                            <Setter Property="HorizontalAlignment" Value="Left"/>
                            <Setter Property="TextAlignment" Value="Left"/>
                            <Setter Property="VerticalAlignment" Value="Center"/>
                        </Style>
                    </StackPanel.Resources>

                    <TextBlock Text="{tsfBinding:Column Path=DeviceAcronym}" Width="145" FontWeight="Bold"/>
                    <TextBlock Text="{tsfBinding:Column Path=DeviceName}" Width="550" FontWeight="Bold"/>                    
                </StackPanel>
            </HierarchicalDataTemplate>

            <HierarchicalDataTemplate x:Key="StreamTemplate" ItemsSource="{tsfBinding:Column Path=DeviceStatisticList}" ItemTemplate="{StaticResource DeviceTemplate}">

                <StackPanel Orientation="Horizontal" VerticalAlignment="Center">
                    
                    <StackPanel.Resources>
                        <Style TargetType="{x:Type TextBlock}">
                            <Setter Property="HorizontalAlignment" Value="Left"/>
                            <Setter Property="TextAlignment" Value="Left"/>
                            <Setter Property="VerticalAlignment" Value="Center"/>
                        </Style>
                    </StackPanel.Resources>

                    <Ellipse Width="12" Height="12" VerticalAlignment="Center" Fill="{tsfBinding:Column Path=StatusColor, Converter={StaticResource StringToStatusColorConverter}}" Margin="0,0,5,0"/>
                    <TextBlock Text="{tsfBinding:Column Path=Acronym}" Width="145" FontWeight="Bold"/>
                    <TextBlock Text="{tsfBinding:Column Path=Name}" Width="575" FontWeight="Bold"/>
                    
                </StackPanel>
                
            </HierarchicalDataTemplate>

            <HierarchicalDataTemplate x:Key="RootNodeTemplate" ItemsSource="{tsfBinding:Column Path=StreamStatisticList}" ItemTemplate="{StaticResource StreamTemplate}">

                <StackPanel Orientation="Horizontal" VerticalAlignment="Center">

                    <StackPanel.Resources>
                        <Style TargetType="{x:Type TextBlock}">
                            <Setter Property="HorizontalAlignment" Value="Left"/>
                            <Setter Property="TextAlignment" Value="Left"/>
                            <Setter Property="VerticalAlignment" Value="Center"/>
                        </Style>
                    </StackPanel.Resources>

                    <TextBlock Text="{tsfBinding:Column Path=SourceType}" Width="755" FontWeight="Bold"/>
                    
                </StackPanel>

            </HierarchicalDataTemplate>

            <Style x:Key="ExpandedItemStyle" TargetType="TreeViewItem">
                <Setter Property="IsExpanded" Value="{tsfBinding:Column Path=DataContext.Expanded, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl, AncestorLevel=1}}"/>
            </Style>

        </StackPanel.Resources>

        <StackPanel Orientation="Vertical" >
            <tsf:TsfPopup x:Name="PopupSettings" Topmost="False" Placement="Center">

                <Border CornerRadius="5" BorderThickness="1" Background="White" BorderBrush="Blue" >

                    <Grid>

                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="2*"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>

                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>

                        <TextBlock Text="Statistic Data Refresh Interval (in seconds)" Grid.Column="0" Grid.Row="0"/>
                        <TextBox x:Name="TextBoxRefreshInterval" Grid.Row="0" Grid.Column="1" Width="50"/>

                        <StackPanel Orientation="Horizontal" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" HorizontalAlignment="Right">
                            <Button x:Name="ButtonRestore" Content="Restore Default" Margin="2" Width="Auto" Click="ButtonRestore_Click"/>
                            <Button Content="Cancel" Margin="2" Click="ButtonCancel_Click"/>
                            <Button x:Name="ButtonSave" Content="Save" Margin="2" IsDefault="True" Click="ButtonSave_Click"/>
                        </StackPanel>

                    </Grid>

                </Border>

            </tsf:TsfPopup>

            <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
            <Button x:Name="ButtonDisplaySettings" Content="Display Settings" Template="{StaticResource HyperlinkStyleButtonTemplate}" 
                     Width="Auto" Click="ButtonDisplaySettings_Click"/>
            <TextBlock Text="Refresh Interval: " Width="Auto" />                
            <TextBlock x:Name="TextBlockMeasurementRefreshInterval" Width="Auto"/>                
            <TextBlock Text="{Binding Path=DataContext.LastRefresh, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl, AncestorLevel=1}}" />
        </StackPanel>

        <TreeView ItemsSource="{tsfBinding:Column Path=ItemsSource}" ItemTemplate="{StaticResource RootNodeTemplate}" 
                      Height="610" VerticalAlignment="Top" HorizontalAlignment="Left" Width="830" ScrollViewer.HorizontalScrollBarVisibility="Disabled"/>

      </StackPanel>

    </StackPanel>

</UserControl>
<commit_msg>openPDC Manager: UI changes for Stream Statistics.<commit_after>﻿<UserControl x:Class="openPDC.UI.UserControls.RealTimeStatisticUserControl"
             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" 
             mc:Ignorable="d" d:DesignHeight="590" d:DesignWidth="850"
             xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:uc="clr-namespace:TimeSeriesFramework.UI.UserControls;assembly=TimeSeriesFramework.UI.WPF"
             xmlns:tsfBinding="clr-namespace:TimeSeriesFramework.UI.Binding;assembly=TimeSeriesFramework.UI"
             xmlns:tsf="clr-namespace:TimeSeriesFramework.UI;assembly=TimeSeriesFramework.UI.WPF"
             xmlns:d3="http://research.microsoft.com/DynamicDataDisplay/1.0"
             Background="Transparent">

    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/TimeSeriesFramework.UI.WPF;Component/Resources/CommonResource.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>

    <StackPanel Orientation="Vertical">

        <StackPanel.Resources>

            <HierarchicalDataTemplate x:Key="MeasurementTemplate">
                
                <Border BorderThickness="0,0,0,1" BorderBrush="#FFDDDDDD">
                    <StackPanel Orientation="Horizontal" VerticalAlignment="Center">
                        <StackPanel.Resources>
                            <Style TargetType="{x:Type TextBlock}">
                                <Setter Property="HorizontalAlignment" Value="Left"/>
                                <Setter Property="TextAlignment" Value="Left"/>
                                <Setter Property="VerticalAlignment" Value="Center"/>
                            </Style>
                        </StackPanel.Resources>

                        <TextBlock Text="{tsfBinding:Column Path=ID}" Width="120"/>
                        <TextBlock Text="{tsfBinding:Column Path=SignalReference}" Width="140"/>
                        <TextBlock Text="{tsfBinding:Column Path=StatisticName}" ToolTip="{tsfBinding:Column Path=StatisticDescription}" Width="225" TextWrapping="Wrap"/>
                        <TextBlock Text="{tsfBinding:Column Path=TimeTag}" FontWeight="Bold" Width="75" HorizontalAlignment="Center" TextAlignment="Center"/>
                        <TextBlock Text="{tsfBinding:Column Path=Value}" FontWeight="Bold" Width="215"
                                   Foreground="{tsfBinding:Column Path=Quality, Converter={StaticResource StringToStatusColorConverter}}" HorizontalAlignment="Center" TextAlignment="Center"/>
                    </StackPanel>
                </Border>
                
            </HierarchicalDataTemplate>

            <HierarchicalDataTemplate x:Key="DeviceTemplate" ItemsSource="{tsfBinding:Column Path=StatisticMeasurementList}" ItemTemplate="{StaticResource MeasurementTemplate}">
                <StackPanel Orientation="Horizontal" VerticalAlignment="Center">

                    <StackPanel.Resources>
                        <Style TargetType="{x:Type TextBlock}">
                            <Setter Property="HorizontalAlignment" Value="Left"/>
                            <Setter Property="TextAlignment" Value="Left"/>
                            <Setter Property="VerticalAlignment" Value="Center"/>
                        </Style>
                    </StackPanel.Resources>

                    <TextBlock Text="{tsfBinding:Column Path=DeviceAcronym}" Width="145" FontWeight="Bold"/>
                    <TextBlock Text="{tsfBinding:Column Path=DeviceName}" Width="550" FontWeight="Bold"/>                    
                </StackPanel>
            </HierarchicalDataTemplate>

            <HierarchicalDataTemplate x:Key="StreamTemplate" ItemsSource="{tsfBinding:Column Path=DeviceStatisticList}" ItemTemplate="{StaticResource DeviceTemplate}">

                <StackPanel Orientation="Horizontal" VerticalAlignment="Center">
                    
                    <StackPanel.Resources>
                        <Style TargetType="{x:Type TextBlock}">
                            <Setter Property="HorizontalAlignment" Value="Left"/>
                            <Setter Property="TextAlignment" Value="Left"/>
                            <Setter Property="VerticalAlignment" Value="Center"/>
                        </Style>
                    </StackPanel.Resources>

                    <Ellipse Width="12" Height="12" VerticalAlignment="Center" Fill="{tsfBinding:Column Path=StatusColor, Converter={StaticResource StringToStatusColorConverter}}" Margin="0,0,5,0"/>
                    <TextBlock Text="{tsfBinding:Column Path=Acronym}" Width="145" FontWeight="Bold"/>
                    <TextBlock Text="{tsfBinding:Column Path=Name}" Width="575" FontWeight="Bold"/>
                    
                </StackPanel>
                
            </HierarchicalDataTemplate>

            <HierarchicalDataTemplate x:Key="RootNodeTemplate" ItemsSource="{tsfBinding:Column Path=StreamStatisticList}" ItemTemplate="{StaticResource StreamTemplate}">

                <StackPanel Orientation="Horizontal" VerticalAlignment="Center">

                    <StackPanel.Resources>
                        <Style TargetType="{x:Type TextBlock}">
                            <Setter Property="HorizontalAlignment" Value="Left"/>
                            <Setter Property="TextAlignment" Value="Left"/>
                            <Setter Property="VerticalAlignment" Value="Center"/>
                        </Style>
                    </StackPanel.Resources>

                    <TextBlock Text="{tsfBinding:Column Path=SourceType}" Width="755" FontWeight="Bold"/>
                    
                </StackPanel>

            </HierarchicalDataTemplate>

            <Style x:Key="ExpandedItemStyle" TargetType="TreeViewItem">
                <Setter Property="IsExpanded" Value="{tsfBinding:Column Path=DataContext.Expanded, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl, AncestorLevel=1}}"/>
            </Style>

        </StackPanel.Resources>

        <StackPanel Orientation="Vertical" >
            <tsf:TsfPopup x:Name="PopupSettings" Topmost="False" Placement="Center">

                <Border CornerRadius="5" BorderThickness="1" Background="White" BorderBrush="Blue" >

                    <Grid>

                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="2*"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>

                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>

                        <TextBlock Text="Statistic Data Refresh Interval (in seconds)" Grid.Column="0" Grid.Row="0"/>
                        <TextBox x:Name="TextBoxRefreshInterval" Grid.Row="0" Grid.Column="1" Width="50"/>

                        <StackPanel Orientation="Horizontal" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" HorizontalAlignment="Right">
                            <Button x:Name="ButtonRestore" Content="Restore Default" Margin="2" Width="Auto" Click="ButtonRestore_Click"/>
                            <Button Content="Cancel" Margin="2" Click="ButtonCancel_Click"/>
                            <Button x:Name="ButtonSave" Content="Save" Margin="2" IsDefault="True" Click="ButtonSave_Click"/>
                        </StackPanel>

                    </Grid>

                </Border>

            </tsf:TsfPopup>

            <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
            <Button x:Name="ButtonDisplaySettings" Content="Display Settings" Template="{StaticResource HyperlinkStyleButtonTemplate}" 
                     Width="Auto" Click="ButtonDisplaySettings_Click"/>
            <TextBlock Text="Refresh Interval: " Width="Auto" />                
            <TextBlock x:Name="TextBlockMeasurementRefreshInterval" Width="Auto"/>                
            <TextBlock Text="{Binding Path=DataContext.LastRefresh, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl, AncestorLevel=1}}" />
        </StackPanel>

        <TreeView ItemsSource="{tsfBinding:Column Path=ItemsSource}" ItemTemplate="{StaticResource RootNodeTemplate}" 
                      Height="610" VerticalAlignment="Top" HorizontalAlignment="Left" Width="850" ScrollViewer.HorizontalScrollBarVisibility="Disabled"/>

      </StackPanel>

    </StackPanel>

</UserControl>

{'fraction_non_alphanumeric': 0.11411345574129898, 'fraction_numerical': 0.010194573855850918, 'mean_word_length': 2.051170568561873, 'pattern_counts': {'":': 0, '<': 209, '<?xml version=': 0, '>': 209, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 20}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6101482', 'n_tokens_mistral': 4786, 'n_tokens_neox': 4114, 'n_words': 634}