<commit_before>﻿<controls:MetroWindow xmlns:controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
                      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="400"
                      d:DesignWidth="600"
                      d:DataContext="{d:DesignInstance viewModels:MainWindowViewModel}"
                      xmlns:converter="clr-namespace:Toxy.Converter"
                      xmlns:viewModels="clr-namespace:Toxy.ViewModels"
                      xmlns:views="clr-namespace:Toxy.Views"
                      xmlns:common="clr-namespace:Toxy.Common"
                      x:Class="Toxy.MainWindow"
                      x:Name="mv"
                      Title="Toxy"
                      MinWidth="700"
                      MinHeight="600"
                      Height="600"
                      Width="700"
                      ResizeMode="CanResizeWithGrip"
                      Closing="MetroWindow_Closing"
                      GlowBrush="{DynamicResource AccentColorBrush}"
                      Icon="Resources/Icons/icon.ico"
                      SizeChanged="MetroWindow_SizeChanged"
                      TitleTemplate="{DynamicResource WindowTitleDataTemplate}"
                      RenderOptions.ClearTypeHint="Enabled"
                      TextOptions.TextRenderingMode="ClearType"
                      TextOptions.TextFormattingMode="Display"
                      Activated="mv_Activated" >

    <controls:MetroWindow.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="pack://application:,,,/Toxy;component/Resources/Icons.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </controls:MetroWindow.Resources>

    <Grid x:Name="RootGrid"
          MouseLeftButtonUp="Grid_MouseLeftButtonUp">
        <Grid.Resources>
            <converter:GridColumnMaxWidthConverter x:Key="MaxWidthConverter" />
        </Grid.Resources>

        <Grid.ColumnDefinitions>
            <!-- left side of the grid splitter -->
            <ColumnDefinition Width="1*"
                              MinWidth="250"
                              MaxWidth="{Binding ElementName=RootGrid, Path=ActualWidth, Mode=OneWay, Converter={StaticResource MaxWidthConverter}, ConverterParameter='250'}" />
            <!-- the grid splitter -->
            <ColumnDefinition Width="2" />
            <!-- right side of the grid splitter -->
            <ColumnDefinition Width="2*" />
        </Grid.ColumnDefinitions>

        <Grid Grid.Column="0">
            <Grid.RowDefinitions>
                <!-- toxy user info -->
                <RowDefinition Height="Auto" />
                <!-- friends, groups and requests -->
                <RowDefinition Height="*" />
                <!-- add friend, create group, settings -->
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>

            <!-- toxy user info -->
            <Grid Grid.Row="0"
                  Margin="5">
                <Grid.ColumnDefinitions>
                    <!-- the user icon -->
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>

                <Grid Grid.Column="0"
                      Height="50"
                      Width="50"
                      Margin="4"
                      HorizontalAlignment="Center"
                      VerticalAlignment="Center">
                <Image Height="50"
                           Width="50"
                           Source="{Binding MainToxyUser.Avatar, Mode=OneWay, TargetNullValue='pack://application:,,,/Resources/Icons/profilepicture.png'}"
                           MouseLeftButtonDown="AvatarImage_MouseLeftButtonDown">
                    <Image.ContextMenu>
                        <ContextMenu Name="AvatarContextMenu"
                                     MenuItem.Click="AvatarMenuItem_MouseLeftButtonDown">
                            <MenuItem Header="Edit"
                                      Tag="{x:Static common:AvatarMenuItem.ChangeAvatar}">
                            </MenuItem>
                            <MenuItem Header="Remove Avatar"
                                      Tag="{x:Static common:AvatarMenuItem.RemoveAvatar}">
                            </MenuItem>
                        </ContextMenu>
                    </Image.ContextMenu>
                </Image>
                <Rectangle Height="10"
                               Width="10"
                               Fill="{Binding MainToxyUser.ToxStatus, Mode=OneWay, Converter={StaticResource ToxUserStatusToBrushConverter}}"
                               VerticalAlignment="Bottom"
                               MouseLeftButtonDown="StatusRectangle_MouseLeftButtonDown"
                               HorizontalAlignment="Right" />
                    <Grid.ContextMenu>
                        <ContextMenu Name="StatusContextMenu"
                                     MenuItem.Click="MenuItem_MouseLeftButtonDown">
                            <MenuItem Header="Online"
                                      Tag="0">
                                <MenuItem.Icon>
                                    <Image Width="15"
                                           Height="15"
                                           Source="Resources/Icons/Online.png"></Image>
                                </MenuItem.Icon>
                            </MenuItem>
                            <MenuItem Header="Away"
                                      Tag="1">
                                <MenuItem.Icon>
                                    <Image Width="15"
                                           Height="15"
                                           Source="Resources/Icons/Away.png"></Image>
                                </MenuItem.Icon>
                            </MenuItem>
                            <MenuItem Header="Busy"
                                      Tag="2">
                                <MenuItem.Icon>
                                    <Image Width="15"
                                           Height="15"
                                           Source="Resources/Icons/Busy.png"></Image>
                                </MenuItem.Icon>
                            </MenuItem>
                        </ContextMenu>
                    </Grid.ContextMenu>
                </Grid>

                <Grid Grid.Column="1"
                      Margin="2">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>

                    <TextBlock Grid.Row="0"
                               Text="{Binding MainToxyUser.Name, Mode=OneWay}"
                               FontSize="25"
                               TextTrimming="CharacterEllipsis" />

                    <TextBlock Grid.Row="1"
                               Text="{Binding MainToxyUser.StatusMessage, Mode=OneWay}"
                               FontSize="14"
                               TextTrimming="CharacterEllipsis" />
                </Grid>
            </Grid>

            <!-- friends, groups and requests -->
            <TabControl Grid.Row="1"
                        x:Name="ListViewTabControl"
                        SelectionChanged="ListViewTabControl_OnSelectionChanged">
                <TabItem Header="Chats">
                    <Grid>

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

                        <TextBox Name="SearchBox"
                                 Grid.Row="0"
                                 Margin="0 3"
                                 TextChanged="SearchBox_TextChanged"
                                 controls:TextBoxHelper.Watermark="Search for friends/groups"
                                 BorderBrush="{DynamicResource AccentColorBrush}"/>

                        <views:CallControl Grid.Row="1"
                                           x:Name="CurrentCallControl"
                                           DataContext="{Binding CallingFriend, Mode=OneWay}"
                                           Visibility="{Binding Mode=OneWay, Converter={StaticResource NullToVisibilityConverter}}" />

                        <!-- bind to collection of friends and groups -->
                        <ListBox x:Name="ChatsListBox"
                                 Grid.Row="2"
                                 common:ListBoxScrollViewerAttachedBehavior.ScrollingLines="1"
                                 ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                                 HorizontalContentAlignment="Stretch"
                                 ItemsSource="{Binding ChatCollection, Mode=OneWay}"
                                 SelectedItem="{Binding SelectedChatObject}">
                            <ListBox.Resources>
                                <DataTemplate DataType="{x:Type viewModels:FriendControlModelView}">
                                    <views:FriendControlView DataContext="{Binding Mode=OneWay}" />
                                </DataTemplate>
                                <DataTemplate DataType="{x:Type viewModels:GroupControlModelView}">
                                    <views:GroupControlView DataContext="{Binding Mode=OneWay}" />
                                </DataTemplate>
                            </ListBox.Resources>
                        </ListBox>

                    </Grid>
                </TabItem>
                <TabItem x:Name="RequestsTabItem"
                         Header="Requests">

                    <!-- bind to collection of friend requests -->
                    <ListBox x:Name="ChatRequestsListBox"
                             common:ListBoxScrollViewerAttachedBehavior.ScrollingLines="1"
                             ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                             HorizontalContentAlignment="Stretch"
                             ItemsSource="{Binding ChatRequestCollection, Mode=OneWay}">
                        <ListBox.ItemContainerStyle>
                            <Style TargetType="{x:Type ListBoxItem}"
                                   BasedOn="{StaticResource ToxyMetroListBoxItem}">
                                <Setter Property="IsSelected"
                                        Value="{Binding Selected}" /><commit_msg>Revert "Removed style bug in friendlist"<commit_after>﻿<controls:MetroWindow xmlns:controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
                      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="400"
                      d:DesignWidth="600"
                      d:DataContext="{d:DesignInstance viewModels:MainWindowViewModel}"
                      xmlns:converter="clr-namespace:Toxy.Converter"
                      xmlns:viewModels="clr-namespace:Toxy.ViewModels"
                      xmlns:views="clr-namespace:Toxy.Views"
                      xmlns:common="clr-namespace:Toxy.Common"
                      x:Class="Toxy.MainWindow"
                      x:Name="mv"
                      Title="Toxy"
                      MinWidth="700"
                      MinHeight="600"
                      Height="600"
                      Width="700"
                      ResizeMode="CanResizeWithGrip"
                      Closing="MetroWindow_Closing"
                      GlowBrush="{DynamicResource AccentColorBrush}"
                      Icon="Resources/Icons/icon.ico"
                      SizeChanged="MetroWindow_SizeChanged"
                      TitleTemplate="{DynamicResource WindowTitleDataTemplate}"
                      RenderOptions.ClearTypeHint="Enabled"
                      TextOptions.TextRenderingMode="ClearType"
                      TextOptions.TextFormattingMode="Display"
                      Activated="mv_Activated" >

    <controls:MetroWindow.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="pack://application:,,,/Toxy;component/Resources/Icons.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </controls:MetroWindow.Resources>

    <Grid x:Name="RootGrid"
          MouseLeftButtonUp="Grid_MouseLeftButtonUp">
        <Grid.Resources>
            <converter:GridColumnMaxWidthConverter x:Key="MaxWidthConverter" />
        </Grid.Resources>

        <Grid.ColumnDefinitions>
            <!-- left side of the grid splitter -->
            <ColumnDefinition Width="1*"
                              MinWidth="250"
                              MaxWidth="{Binding ElementName=RootGrid, Path=ActualWidth, Mode=OneWay, Converter={StaticResource MaxWidthConverter}, ConverterParameter='250'}" />
            <!-- the grid splitter -->
            <ColumnDefinition Width="2" />
            <!-- right side of the grid splitter -->
            <ColumnDefinition Width="2*" />
        </Grid.ColumnDefinitions>

        <Grid Grid.Column="0">
            <Grid.RowDefinitions>
                <!-- toxy user info -->
                <RowDefinition Height="Auto" />
                <!-- friends, groups and requests -->
                <RowDefinition Height="*" />
                <!-- add friend, create group, settings -->
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>

            <!-- toxy user info -->
            <Grid Grid.Row="0"
                  Margin="5">
                <Grid.ColumnDefinitions>
                    <!-- the user icon -->
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>

                <Grid Grid.Column="0"
                      Height="50"
                      Width="50"
                      Margin="4"
                      HorizontalAlignment="Center"
                      VerticalAlignment="Center">
                <Image Height="50"
                           Width="50"
                           Source="{Binding MainToxyUser.Avatar, Mode=OneWay, TargetNullValue='pack://application:,,,/Resources/Icons/profilepicture.png'}"
                           MouseLeftButtonDown="AvatarImage_MouseLeftButtonDown">
                    <Image.ContextMenu>
                        <ContextMenu Name="AvatarContextMenu"
                                     MenuItem.Click="AvatarMenuItem_MouseLeftButtonDown">
                            <MenuItem Header="Edit"
                                      Tag="{x:Static common:AvatarMenuItem.ChangeAvatar}">
                            </MenuItem>
                            <MenuItem Header="Remove Avatar"
                                      Tag="{x:Static common:AvatarMenuItem.RemoveAvatar}">
                            </MenuItem>
                        </ContextMenu>
                    </Image.ContextMenu>
                </Image>
                <Rectangle Height="10"
                               Width="10"
                               Fill="{Binding MainToxyUser.ToxStatus, Mode=OneWay, Converter={StaticResource ToxUserStatusToBrushConverter}}"
                               VerticalAlignment="Bottom"
                               MouseLeftButtonDown="StatusRectangle_MouseLeftButtonDown"
                               HorizontalAlignment="Right" />
                    <Grid.ContextMenu>
                        <ContextMenu Name="StatusContextMenu"
                                     MenuItem.Click="MenuItem_MouseLeftButtonDown">
                            <MenuItem Header="Online"
                                      Tag="0">
                                <MenuItem.Icon>
                                    <Image Width="15"
                                           Height="15"
                                           Source="Resources/Icons/Online.png"></Image>
                                </MenuItem.Icon>
                            </MenuItem>
                            <MenuItem Header="Away"
                                      Tag="1">
                                <MenuItem.Icon>
                                    <Image Width="15"
                                           Height="15"
                                           Source="Resources/Icons/Away.png"></Image>
                                </MenuItem.Icon>
                            </MenuItem>
                            <MenuItem Header="Busy"
                                      Tag="2">
                                <MenuItem.Icon>
                                    <Image Width="15"
                                           Height="15"
                                           Source="Resources/Icons/Busy.png"></Image>
                                </MenuItem.Icon>
                            </MenuItem>
                        </ContextMenu>
                    </Grid.ContextMenu>
                </Grid>

                <Grid Grid.Column="1"
                      Margin="2">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>

                    <TextBlock Grid.Row="0"
                               Text="{Binding MainToxyUser.Name, Mode=OneWay}"
                               FontSize="25"
                               TextTrimming="CharacterEllipsis" />

                    <TextBlock Grid.Row="1"
                               Text="{Binding MainToxyUser.StatusMessage, Mode=OneWay}"
                               FontSize="14"
                               TextTrimming="CharacterEllipsis" />
                </Grid>
            </Grid>

            <!-- friends, groups and requests -->
            <TabControl Grid.Row="1"
                        x:Name="ListViewTabControl"
                        SelectionChanged="ListViewTabControl_OnSelectionChanged">
                <TabItem Header="Chats">
                    <Grid>

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

                        <TextBox Name="SearchBox"
                                 Grid.Row="0"
                                 Margin="0 3"
                                 TextChanged="SearchBox_TextChanged"
                                 controls:TextBoxHelper.Watermark="Search for friends/groups"
                                 BorderBrush="{DynamicResource AccentColorBrush}"/>

                        <views:CallControl Grid.Row="1"
                                           x:Name="CurrentCallControl"
                                           DataContext="{Binding CallingFriend, Mode=OneWay}"
                                           Visibility="{Binding Mode=OneWay, Converter={StaticResource NullToVisibilityConverter}}" />

                        <!-- bind to collection of friends and groups -->
                        <ListBox x:Name="ChatsListBox"
                                 Grid.Row="2"
                                 common:ListBoxScrollViewerAttachedBehavior.ScrollingLines="1"
                                 ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                                 HorizontalContentAlignment="Stretch"
                                 ItemsSource="{Binding ChatCollection, Mode=OneWay}"
                                 SelectedItem="{Binding SelectedChatObject}">
                            <ListBox.ItemContainerStyle>
                                <Style TargetType="{x:Type ListBoxItem}"
                                       BasedOn="{StaticResource ToxyMetroListBoxItem}">
                                    <Setter Property="IsSelected"
                                            Value="{Binding Selected}" />
                                    <Style.Triggers>
                                        <DataTrigger Binding="{Binding Visible}" Value="False">
                                            <Setter Property="Visibility" Value="Collapsed"/>
                                        </DataTrigger>
                                        <DataTrigger Binding="{Binding Visible}" Value="True">
                                            <Setter Property="Visibility" Value="Visible"/>
                                        </DataTrigger>
                                    </Style.Triggers>
                                </Style>
                            </ListBox.ItemContainerStyle>
                            <ListBox.Resources>
                                <DataTemplate DataType="{x:Type viewModels:FriendControlModelView}">
                                    <views:FriendControlView DataContext="{Binding Mode=OneWay}" />
                                </DataTemplate>
                                <DataTemplate DataType="{x:Type viewModels:GroupControlModelView}">
                                    <views:GroupControlView DataContext="{Binding Mode=OneWay}" />
                                </DataTemplate>
                            </ListBox.Resources>
                        </ListBox>

                    </Grid>
                </TabItem>
                <TabItem x:Name="RequestsTabItem"
                         Header="Requests">

                    <!-- bind to collection of friend requests -->
                    <ListBox x:Name="ChatRequestsListBox"
                             common:ListBoxScrollViewerAttachedBehavior.ScrollingLines="1"
                             ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                             HorizontalContentAlignment="Stretch"
                             ItemsSource="{Binding ChatRequestCollection, Mode=OneWay}">
                        <ListBox.ItemContainerStyle>
                            <Style TargetType="{x:Type ListBoxItem}"
                                   BasedOn="{StaticResource ToxyMetroListBoxItem}">
                                <Setter Property="IsSelected"
                                        Value="{Binding Selected}" />
{'fraction_non_alphanumeric': 0.09186116098144824, 'fraction_numerical': 0.007779772591262717, 'mean_word_length': 1.0699876128118917, 'pattern_counts': {'":': 0, '<': 236, '<?xml version=': 0, '>': 236, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 20}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 100, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4360300', 'n_tokens_mistral': 5191, 'n_tokens_neox': 4618, 'n_words': 689}