Merge with OUT-587 sync
authorThomas
Fri, 09 Aug 2019 16:07:35 +0200
branchsync
changeset 27024ebc6523e502
parent 2697 b9b470a40aec
parent 2701 727366b902e3
child 2703 2915c07d9628
child 2704 6efa9f0ab7ca
Merge with OUT-587
     1.1 --- a/Resources/Dictionary.xaml	Fri Aug 09 12:49:04 2019 +0200
     1.2 +++ b/Resources/Dictionary.xaml	Fri Aug 09 16:07:35 2019 +0200
     1.3 @@ -351,4 +351,62 @@
     1.4          </Setter>
     1.5      </Style>
     1.6  
     1.7 +    <!-- Style for the Unencrypted preview reply/forward buttons -->
     1.8 +    <Style x:Key="StyleReplyButton"
     1.9 +           TargetType="Button"
    1.10 +           BasedOn="{StaticResource {x:Static ToolBar.ButtonStyleKey}}">
    1.11 +        <Setter Property="Padding"
    1.12 +                Value="10,7" />
    1.13 +        <Setter Property="BorderBrush"
    1.14 +                Value="DarkGray" />
    1.15 +        <Setter Property="Margin"
    1.16 +                Value="0,0,0,0" />
    1.17 +        <Setter Property="BorderThickness"
    1.18 +                Value="1" />
    1.19 +        <Setter Property="MinHeight"
    1.20 +                Value="28" />
    1.21 +        <Setter Property="MinWidth"
    1.22 +                Value="80" />
    1.23 +        <Setter Property="HorizontalContentAlignment"
    1.24 +                Value="Center" />
    1.25 +        <Setter Property="VerticalContentAlignment"
    1.26 +                Value="Center" />
    1.27 +        <Setter Property="Template">
    1.28 +            <Setter.Value>
    1.29 +                <ControlTemplate TargetType="ButtonBase">
    1.30 +                    <Border BorderThickness="{TemplateBinding Border.BorderThickness}"
    1.31 +                            BorderBrush="{TemplateBinding Border.BorderBrush}"
    1.32 +                            Background="{TemplateBinding Panel.Background}"
    1.33 +                            Name="border"
    1.34 +                            SnapsToDevicePixels="True">
    1.35 +                        <ContentPresenter RecognizesAccessKey="True"
    1.36 +                                          Content="{TemplateBinding ContentControl.Content}"
    1.37 +                                          ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}"
    1.38 +                                          ContentStringFormat="{TemplateBinding ContentControl.ContentStringFormat}"
    1.39 +                                          Name="contentPresenter"
    1.40 +                                          Margin="{TemplateBinding Control.Padding}"
    1.41 +                                          HorizontalAlignment="{TemplateBinding Control.HorizontalContentAlignment}"
    1.42 +                                          VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}"
    1.43 +                                          SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}"
    1.44 +                                          Focusable="False" />
    1.45 +                    </Border>
    1.46 +                    <ControlTemplate.Triggers>
    1.47 +                        <Trigger Property="UIElement.IsMouseOver"
    1.48 +                                 Value="True">
    1.49 +                            <Setter Property="Panel.Background"
    1.50 +                                    TargetName="border"
    1.51 +                                    Value="{x:Static SystemColors.GradientInactiveCaptionBrush}" />
    1.52 +                        </Trigger>
    1.53 +                        <Trigger Property="ButtonBase.IsPressed"
    1.54 +                                 Value="True">
    1.55 +                            <Setter Property="Panel.Background"
    1.56 +                                    TargetName="border"
    1.57 +                                    Value="{x:Static SystemColors.GradientActiveCaptionBrush}" />
    1.58 +                        </Trigger>
    1.59 +                    </ControlTemplate.Triggers>
    1.60 +                </ControlTemplate>
    1.61 +            </Setter.Value>
    1.62 +        </Setter>
    1.63 +    </Style>
    1.64 +
    1.65  </ResourceDictionary>
    1.66 \ No newline at end of file
     2.1 --- a/UI/FormControlPreviewMessage.xaml	Fri Aug 09 12:49:04 2019 +0200
     2.2 +++ b/UI/FormControlPreviewMessage.xaml	Fri Aug 09 16:07:35 2019 +0200
     2.3 @@ -26,6 +26,11 @@
     2.4                  <local:IsListEmptyConverter />
     2.5                  <local:InvertBoolConverter />
     2.6              </local:ValueConverterGroup>
     2.7 +            <local:ValueConverterGroup x:Key="IsListEmptyToInvertVisibility">
     2.8 +                <local:IsListEmptyConverter />
     2.9 +                <local:InvertBoolConverter />
    2.10 +                <BooleanToVisibilityConverter />
    2.11 +            </local:ValueConverterGroup>
    2.12              <local:ValueConverterGroup x:Key="IsStringEmptyToVisibility">
    2.13                  <local:IsStringEmptyConverter />
    2.14                  <BooleanToVisibilityConverter />
    2.15 @@ -42,111 +47,179 @@
    2.16              </ResourceDictionary.MergedDictionaries>
    2.17          </ResourceDictionary>
    2.18      </UserControl.Resources>
    2.19 -    <Grid Name="GridLayoutRoot"
    2.20 -          Margin="5">
    2.21 -        <Grid.RowDefinitions>
    2.22 -            <RowDefinition Height="25" />
    2.23 -            <RowDefinition Height="5" />
    2.24 -            <RowDefinition Height="Auto" />
    2.25 -            <RowDefinition Height="Auto" />
    2.26 -            <RowDefinition Height="Auto" />
    2.27 -            <RowDefinition Height="Auto" />
    2.28 -            <RowDefinition Height="Auto" />
    2.29 -            <RowDefinition Height="*" />
    2.30 -        </Grid.RowDefinitions>
    2.31 +    <DockPanel Name="DockPanelLayoutRoot"
    2.32 +                Margin="5">
    2.33  
    2.34 -        <!-- Buttons & preview text -->
    2.35 -        <StackPanel Grid.Row="0"
    2.36 -                    Orientation="Horizontal"
    2.37 -                    HorizontalAlignment="Left"
    2.38 -                    VerticalAlignment="Stretch">
    2.39 -            <Button Name="ButtonReply"
    2.40 -                    Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}"
    2.41 -                    Padding="{StaticResource ButtonPaddingStandard}"
    2.42 -                    Margin="0"
    2.43 -                    HorizontalContentAlignment="Center"
    2.44 -                    VerticalContentAlignment="Center"
    2.45 -                    Click="ButtonReply_Click"
    2.46 -                    Visibility="{Binding Path='IsNoteModeEnabled', Mode=OneWay, Converter={StaticResource InvertBoolToVisibility}}">
    2.47 -                <StackPanel Orientation="Horizontal">
    2.48 -                    <Image Stretch="Uniform"
    2.49 -                           Source="pack://application:,,,/pEp;component/Resources/ImagePreviewReply.png"
    2.50 -                           Margin="0,0,4,0" />
    2.51 -                    <TextBlock VerticalAlignment="Center"
    2.52 -                               FontFamily="Segoe UI"
    2.53 -                               FontSize="12"
    2.54 -                               Text="{x:Static p:Resources.PreviewMessage_ReplyText}" />
    2.55 -                </StackPanel>
    2.56 -            </Button>
    2.57 -            <Button Name="ButtonReplyAll"
    2.58 -                    Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}"
    2.59 -                    Padding="{StaticResource ButtonPaddingStandard}"
    2.60 -                    Margin="5,0,0,0"
    2.61 -                    HorizontalContentAlignment="Center"
    2.62 -                    VerticalContentAlignment="Center"
    2.63 -                    Click="ButtonReplyAll_Click"
    2.64 -                    Visibility="{Binding Path='IsNoteModeEnabled', Mode=OneWay, Converter={StaticResource InvertBoolToVisibility}}">
    2.65 -                <StackPanel Orientation="Horizontal">
    2.66 -                    <Image Stretch="Uniform"
    2.67 -                           Source="pack://application:,,,/pEp;component/Resources/ImagePreviewReplyAll.png"
    2.68 -                           Margin="0,0,4,0" />
    2.69 -                    <TextBlock VerticalAlignment="Center"
    2.70 -                               FontFamily="Segoe UI"
    2.71 -                               FontSize="12"
    2.72 -                               Text="{x:Static p:Resources.PreviewMessage_ReplyAllText}" />
    2.73 -                </StackPanel>
    2.74 -            </Button>
    2.75 -            <Button Name="ButtonForward"
    2.76 -                    Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}"
    2.77 -                    Padding="{StaticResource ButtonPaddingStandard}"
    2.78 -                    Margin="5,0,0,0"
    2.79 -                    HorizontalContentAlignment="Center"
    2.80 -                    VerticalContentAlignment="Center"
    2.81 -                    Click="ButtonForward_Click"
    2.82 -                    Visibility="{Binding Path='IsNoteModeEnabled', Mode=OneWay, Converter={StaticResource InvertBoolToVisibility}}">
    2.83 -                <StackPanel Orientation="Horizontal">
    2.84 -                    <Image Stretch="Uniform"
    2.85 -                           Source="pack://application:,,,/pEp;component/Resources/ImagePreviewForward.png"
    2.86 -                           Margin="0,0,4,0" />
    2.87 -                    <TextBlock VerticalAlignment="Center"
    2.88 -                               FontFamily="Segoe UI"
    2.89 -                               FontSize="12"
    2.90 -                               Text="{x:Static p:Resources.PreviewMessage_ForwardText}" />
    2.91 -                </StackPanel>
    2.92 -            </Button>
    2.93 -        </StackPanel>
    2.94 -        <TextBlock Text="{x:Static p:Resources.PreviewMessage_PreviewText}"
    2.95 +        <!--'Preview' text-->
    2.96 +        <TextBlock DockPanel.Dock="Top"
    2.97 +                   Text="{x:Static p:Resources.PreviewMessage_PreviewText}"
    2.98                     FontFamily="Segoe UI"
    2.99                     FontSize="12"
   2.100                     TextAlignment="Right"
   2.101                     HorizontalAlignment="Right"
   2.102                     VerticalAlignment="Top"
   2.103                     Margin="0"
   2.104 -                   Visibility="{Binding Path='IsNoteModeEnabled', Mode=OneWay, Converter={StaticResource InvertBoolToVisibility}}" />
   2.105 +                   Visibility="{Binding IsNoteModeEnabled, Mode=OneWay, Converter={StaticResource InvertBoolToVisibility}}" />
   2.106  
   2.107 -        <!-- Message info header -->
   2.108 -        <Grid Grid.Row="2">
   2.109 +        <!--Subject-->
   2.110 +        <TextBox DockPanel.Dock="Top"
   2.111 +                 Background="Transparent"
   2.112 +                 BorderThickness="0"
   2.113 +                 IsReadOnly="True"
   2.114 +                 IsTabStop="False"
   2.115 +                 FontFamily="Segoe UI Semibold"
   2.116 +                 FontSize="20"
   2.117 +                 Margin="0,5"
   2.118 +                 Text="{Binding Message.ShortMsg}"
   2.119 +                 TextWrapping="NoWrap"
   2.120 +                 HorizontalAlignment="Stretch"
   2.121 +                 VerticalAlignment="Center" />
   2.122 +
   2.123 +        <!--Contact image, recipients and reply buttons-->
   2.124 +        <Grid DockPanel.Dock="Top"
   2.125 +              Name="GridContactRecipients"
   2.126 +              Visibility="{Binding IsNoteModeEnabled, Mode=OneWay, Converter={StaticResource InvertBoolToVisibility}}" >
   2.127              <Grid.ColumnDefinitions>
   2.128                  <ColumnDefinition Width="Auto" />
   2.129 -                <ColumnDefinition Width="20" />
   2.130                  <ColumnDefinition Width="Auto" />
   2.131 +                <ColumnDefinition Width="*" />
   2.132              </Grid.ColumnDefinitions>
   2.133              <Grid.RowDefinitions>
   2.134 -                <RowDefinition Height="Auto" />
   2.135 -                <RowDefinition Height="Auto" />
   2.136 -                <RowDefinition Height="Auto" />
   2.137 +                <RowDefinition Height="Auto"/>
   2.138 +                <RowDefinition Height="Auto"/>
   2.139 +                <RowDefinition Height="Auto"/>
   2.140              </Grid.RowDefinitions>
   2.141  
   2.142 -            <!--Image-->
   2.143 -            <Image Grid.Row="0"
   2.144 -                   Grid.RowSpan="3"
   2.145 -                   Grid.Column="0"
   2.146 -                   Stretch="Uniform"
   2.147 -                   Source="pack://application:,,,/pEp;component/Resources/ImagePreviewContact.png"
   2.148 -                   Visibility="{Binding Path='IsNoteModeEnabled', Mode=OneWay, Converter={StaticResource InvertBoolToVisibility}}" />
   2.149 +            <!--Contact image-->
   2.150 +            <Canvas x:Name="CanvasContactName"
   2.151 +                    Grid.Row="0"
   2.152 +                    Grid.RowSpan="3"
   2.153 +                    Grid.Column="0"
   2.154 +                    Height="60"
   2.155 +                    Width="60"
   2.156 +                    Margin="0,0,5,0">
   2.157 +                <Ellipse Name="EllipseContactImage"
   2.158 +                         Width="48"
   2.159 +                         Height="48"
   2.160 +                         Fill="{Binding ContactIconBackground}"
   2.161 +                         Canvas.Left="6"
   2.162 +                         Canvas.Top="6"
   2.163 +                         Panel.ZIndex="0"/>
   2.164 +                <Grid Width="{Binding ActualWidth, ElementName=CanvasContactName}"
   2.165 +                      Height="{Binding ActualHeight, ElementName=CanvasContactName}">
   2.166 +                    <TextBlock Text="{Binding ContactIconText}"                           
   2.167 +                           Foreground="White"
   2.168 +                           FontFamily="Segoe UI Light"
   2.169 +                           FontSize="20"
   2.170 +                           Panel.ZIndex="1"
   2.171 +                           HorizontalAlignment="Center"
   2.172 +                           VerticalAlignment="Center"/>
   2.173 +                </Grid>
   2.174 +            </Canvas>
   2.175  
   2.176 -            <!-- Date -->
   2.177 +            <!-- From recipient -->
   2.178              <TextBox Grid.Row="0"
   2.179 +                     Grid.Column="1"
   2.180 +                     Background="Transparent"
   2.181 +                     FontFamily="Segoe UI"
   2.182 +                     FontSize="14"
   2.183 +                     Foreground="DarkSlateGray"
   2.184 +                     BorderThickness="0"
   2.185 +                     IsReadOnly="True"
   2.186 +                     IsTabStop="False"
   2.187 +                     Text="{Binding FromRecipient, Mode=OneWay}"
   2.188 +                     TextWrapping="NoWrap"
   2.189 +                     HorizontalAlignment="Stretch"
   2.190 +                     VerticalAlignment="Center" />
   2.191 +
   2.192 +            <!--Reply buttons-->
   2.193 +            <StackPanel Grid.Row="0"
   2.194 +                        Grid.Column="2"
   2.195 +                    Orientation="Horizontal"
   2.196 +                    HorizontalAlignment="Right"
   2.197 +                    VerticalAlignment="Stretch">
   2.198 +                <Button Name="ButtonReply"
   2.199 +                    Style="{StaticResource StyleReplyButton}"                    
   2.200 +                    Click="ButtonReply_Click">
   2.201 +                    <StackPanel Orientation="Horizontal">
   2.202 +                        <Image Stretch="Uniform"
   2.203 +                           Source="pack://application:,,,/pEp;component/Resources/ImagePreviewReply.png"
   2.204 +                           Margin="0,0,4,0" />
   2.205 +                        <TextBlock VerticalAlignment="Center"
   2.206 +                               FontFamily="Segoe UI"
   2.207 +                               FontSize="12"
   2.208 +                               Text="{x:Static p:Resources.PreviewMessage_ReplyText}" />
   2.209 +                    </StackPanel>
   2.210 +                </Button>
   2.211 +                <Button Name="ButtonReplyAll"
   2.212 +                    Style="{StaticResource StyleReplyButton}"
   2.213 +                    Click="ButtonReplyAll_Click">
   2.214 +                    <StackPanel Orientation="Horizontal">
   2.215 +                        <Image Stretch="Uniform"
   2.216 +                           Source="pack://application:,,,/pEp;component/Resources/ImagePreviewReplyAll.png"
   2.217 +                           Margin="0,0,4,0" />
   2.218 +                        <TextBlock VerticalAlignment="Center"
   2.219 +                               FontFamily="Segoe UI"
   2.220 +                               FontSize="12"
   2.221 +                               Text="{x:Static p:Resources.PreviewMessage_ReplyAllText}" />
   2.222 +                    </StackPanel>
   2.223 +                </Button>
   2.224 +                <Button Name="ButtonForward"
   2.225 +                    Style="{StaticResource StyleReplyButton}" 
   2.226 +                    Click="ButtonForward_Click">
   2.227 +                    <StackPanel Orientation="Horizontal">
   2.228 +                        <Image Stretch="Uniform"
   2.229 +                           Source="pack://application:,,,/pEp;component/Resources/ImagePreviewForward.png"
   2.230 +                           Margin="0,0,4,0" />
   2.231 +                        <TextBlock VerticalAlignment="Center"
   2.232 +                               FontFamily="Segoe UI"
   2.233 +                               FontSize="12"
   2.234 +                               Text="{x:Static p:Resources.PreviewMessage_ForwardText}" />
   2.235 +                    </StackPanel>
   2.236 +                </Button>
   2.237 +            </StackPanel>
   2.238 +
   2.239 +            <!--'To' recipients-->
   2.240 +            <StackPanel Grid.Row="1" 
   2.241 +                        Grid.Column="1"
   2.242 +                        Orientation="Horizontal">
   2.243 +
   2.244 +                <!--Recipients "To" text-->
   2.245 +                <TextBlock Margin="0,0,10,0"
   2.246 +                           Background="Transparent"
   2.247 +                           FontFamily="Segoe UI"
   2.248 +                           FontSize="11"
   2.249 +                           Foreground="Gray"
   2.250 +                           Text="{x:Static p:Resources.PreviewMessage_ToText}"
   2.251 +                           TextWrapping="NoWrap"
   2.252 +                           HorizontalAlignment="Stretch"
   2.253 +                           VerticalAlignment="Center" />
   2.254 +
   2.255 +                <ItemsControl ItemsSource="{Binding Message.To}"
   2.256 +                              VerticalAlignment="Center">
   2.257 +                    <ItemsControl.ItemsPanel>
   2.258 +                        <ItemsPanelTemplate>
   2.259 +                            <WrapPanel />
   2.260 +                        </ItemsPanelTemplate>
   2.261 +                    </ItemsControl.ItemsPanel>
   2.262 +                    <ItemsControl.ItemTemplate>
   2.263 +                        <DataTemplate>
   2.264 +                            <TextBlock Margin="0,0,10,0"
   2.265 +                                       Background="Transparent"
   2.266 +                                       FontFamily="Segoe UI"
   2.267 +                                       FontSize="11"
   2.268 +                                       Foreground="DarkSlateGray"
   2.269 +                                       Text="{Binding Address}"
   2.270 +                                       TextWrapping="NoWrap"
   2.271 +                                       HorizontalAlignment="Stretch"
   2.272 +                                       VerticalAlignment="Center" />
   2.273 +                        </DataTemplate>
   2.274 +                    </ItemsControl.ItemTemplate>
   2.275 +                </ItemsControl>
   2.276 +            </StackPanel>
   2.277 +
   2.278 +            <!--Date-->
   2.279 +            <TextBox Grid.Row="1"
   2.280                       Grid.Column="2"
   2.281                       Background="Transparent"
   2.282                       BorderThickness="0"
   2.283 @@ -156,171 +229,99 @@
   2.284                       FontSize="11"
   2.285                       Foreground="DarkSlateGray"
   2.286                       TextWrapping="NoWrap"
   2.287 -                     HorizontalAlignment="Stretch"
   2.288 +                     HorizontalAlignment="Right"
   2.289                       VerticalAlignment="Center"
   2.290 -                     Text="{Binding Path='Date', Mode=OneWay}"
   2.291 -                     Visibility="{Binding Path='IsNoteModeEnabled', Mode=OneWay, Converter={StaticResource InvertBoolToVisibility}}" />
   2.292 +                     Text="{Binding Path='Date', Mode=OneWay}" />
   2.293  
   2.294 -            <!-- From recipient -->
   2.295 -            <TextBox Grid.Row="1"
   2.296 -                     Grid.Column="2"
   2.297 -                     Background="Transparent"
   2.298 -                     Margin="0,5,0,5"
   2.299 -                     FontFamily="Segoe UI Light"
   2.300 -                     FontSize="22"
   2.301 -                     Foreground="DarkSlateGray"
   2.302 -                     BorderThickness="0"
   2.303 -                     IsReadOnly="True"
   2.304 -                     IsTabStop="False"
   2.305 -                     Text="{Binding Path='FromRecipient', Mode=OneWay}"
   2.306 -                     TextWrapping="NoWrap"
   2.307 -                     HorizontalAlignment="Stretch"
   2.308 -                     VerticalAlignment="Center"
   2.309 -                     Visibility="{Binding Path='IsNoteModeEnabled', Mode=OneWay, Converter={StaticResource InvertBoolToVisibility}}" />
   2.310  
   2.311 -            <!-- Subject -->
   2.312 -            <TextBox Grid.Row="2"
   2.313 -                     Grid.Column="2"
   2.314 -                     Background="Transparent"
   2.315 -                     BorderThickness="0"
   2.316 -                     IsReadOnly="True"
   2.317 -                     IsTabStop="False"
   2.318 -                     FontFamily="Segoe UI Semibold"
   2.319 -                     FontSize="15"
   2.320 -                     Text="{Binding Path='Message.ShortMsg', Mode=OneWay}"
   2.321 -                     TextWrapping="NoWrap"
   2.322 -                     HorizontalAlignment="Stretch"
   2.323 -                     VerticalAlignment="Center"
   2.324 -                     Visibility="{Binding Path='IsNoteModeEnabled', Mode=OneWay, Converter={StaticResource InvertBoolToVisibility}}" />
   2.325 +            <!--'Cc' recipients-->
   2.326 +            <StackPanel Grid.Row="2" 
   2.327 +                        Grid.Column="1"
   2.328 +                        Orientation="Horizontal"
   2.329 +                        Visibility="{Binding Message.Cc, Converter={StaticResource IsListEmptyToInvertVisibility}}">
   2.330  
   2.331 +                <!--Recipients "Cc" text-->
   2.332 +                <TextBlock Margin="0,0,10,0"
   2.333 +                           Background="Transparent"
   2.334 +                           FontFamily="Segoe UI"
   2.335 +                           FontSize="11"
   2.336 +                           Foreground="Gray"
   2.337 +                           Text="{x:Static p:Resources.PreviewMessage_CcText}"
   2.338 +                           TextWrapping="NoWrap"
   2.339 +                           HorizontalAlignment="Stretch"
   2.340 +                           VerticalAlignment="Center" />
   2.341 +
   2.342 +                <ItemsControl ItemsSource="{Binding Message.Cc}">
   2.343 +                    <ItemsControl.ItemsPanel>
   2.344 +                        <ItemsPanelTemplate>
   2.345 +                            <WrapPanel />
   2.346 +                        </ItemsPanelTemplate>
   2.347 +                    </ItemsControl.ItemsPanel>
   2.348 +                    <ItemsControl.ItemTemplate>
   2.349 +                        <DataTemplate>
   2.350 +                            <TextBlock Margin="0,0,10,0"
   2.351 +                           Background="Transparent"
   2.352 +                           FontFamily="Segoe UI"
   2.353 +                           FontSize="11"
   2.354 +                           Foreground="DarkSlateGray"
   2.355 +                           Text="{Binding Address}"
   2.356 +                           TextWrapping="NoWrap"
   2.357 +                           HorizontalAlignment="Stretch"
   2.358 +                           VerticalAlignment="Center" />
   2.359 +                        </DataTemplate>
   2.360 +                    </ItemsControl.ItemTemplate>
   2.361 +                </ItemsControl>
   2.362 +            </StackPanel>
   2.363          </Grid>
   2.364  
   2.365 -        <Grid Grid.Row="3"
   2.366 -              Grid.Column="0"
   2.367 -              Grid.ColumnSpan="3"
   2.368 -              Margin="0,5,0,5">
   2.369 -            <Grid.ColumnDefinitions>
   2.370 -                <ColumnDefinition Width="Auto" />
   2.371 -                <ColumnDefinition Width="Auto" />
   2.372 -            </Grid.ColumnDefinitions>
   2.373 -
   2.374 -            <!--Recipients "To" text-->
   2.375 -            <TextBlock Grid.Column="0"
   2.376 -                       Margin="0,0,10,0"
   2.377 -                       Background="Transparent"
   2.378 -                       FontFamily="Segoe UI"
   2.379 -                       FontSize="11"
   2.380 -                       Foreground="DarkSlateGray"
   2.381 -                       Text="{x:Static p:Resources.PreviewMessage_ToText}"
   2.382 -                       TextWrapping="NoWrap"
   2.383 -                       HorizontalAlignment="Stretch"
   2.384 -                       VerticalAlignment="Center"
   2.385 -                       Visibility="{Binding Path='IsNoteModeEnabled', Mode=OneWay, Converter={StaticResource InvertBoolToVisibility}}" />
   2.386 -
   2.387 -            <!--To Recipients-->
   2.388 -            <TextBlock Grid.Column="1"
   2.389 -                       Background="Transparent"
   2.390 -                       FontFamily="Segoe UI"
   2.391 -                       FontSize="11"
   2.392 -                       Foreground="DarkSlateGray"
   2.393 -                       Text="{Binding Path='ToRecipients', Mode=OneWay}"
   2.394 -                       TextWrapping="NoWrap"
   2.395 -                       HorizontalAlignment="Stretch"
   2.396 -                       VerticalAlignment="Center" />
   2.397 -        </Grid>
   2.398 -
   2.399 -        <Grid Grid.Row="4"
   2.400 -              Grid.Column="0"
   2.401 -              Grid.ColumnSpan="3"
   2.402 -              Margin="0,5,0,5">
   2.403 -            <Grid.ColumnDefinitions>
   2.404 -                <ColumnDefinition Width="Auto" />
   2.405 -                <ColumnDefinition Width="Auto" />
   2.406 -            </Grid.ColumnDefinitions>
   2.407 -
   2.408 -            <!--Recipients "Cc" text-->
   2.409 -            <TextBlock Grid.Column="0"
   2.410 -                       Margin="0,0,10,0"
   2.411 -                       Background="Transparent"
   2.412 -                       FontFamily="Segoe UI"
   2.413 -                       FontSize="11"
   2.414 -                       Foreground="DarkSlateGray"
   2.415 -                       Text="{x:Static p:Resources.PreviewMessage_CcText}"
   2.416 -                       TextWrapping="NoWrap"
   2.417 -                       HorizontalAlignment="Stretch"
   2.418 -                       VerticalAlignment="Center"
   2.419 -                       Visibility="{Binding Path=CcRecipients, Mode=OneWay, Converter={StaticResource IsStringNotEmptyToVisibility}}" />
   2.420 -
   2.421 -            <!--Cc Recipients-->
   2.422 -            <TextBlock Grid.Column="1"
   2.423 -                       Background="Transparent"
   2.424 -                       FontFamily="Segoe UI"
   2.425 -                       FontSize="11"
   2.426 -                       Foreground="DarkSlateGray"
   2.427 -                       Text="{Binding Path='CcRecipients', Mode=OneWay}"
   2.428 -                       TextWrapping="NoWrap"
   2.429 -                       HorizontalAlignment="Stretch"
   2.430 -                       VerticalAlignment="Center"
   2.431 -                       Visibility="{Binding Path=CcRecipients, Mode=OneWay, Converter={StaticResource IsStringNotEmptyToVisibility}}" />
   2.432 -        </Grid>
   2.433 -
   2.434 -        <!-- Attachments -->
   2.435 -        <Grid Grid.Row="5">
   2.436 -            <Grid.RowDefinitions>
   2.437 -                <RowDefinition Height="Auto" />
   2.438 -                <RowDefinition Height="Auto" />
   2.439 -                <RowDefinition Height="Auto" />
   2.440 -            </Grid.RowDefinitions>
   2.441 -            <Separator Grid.Row="0"
   2.442 -                       Margin="0,3,0,3"
   2.443 -                       Visibility="{Binding Path='IsNoteModeEnabled', Mode=OneWay, Converter={StaticResource InvertBoolToVisibility}}" />
   2.444 -            <ItemsControl Grid.Row="1"
   2.445 -                          HorizontalAlignment="Stretch"
   2.446 -                          VerticalAlignment="Top"
   2.447 -                          ItemsSource="{Binding Path='Message.Attachments', Mode=OneWay}">
   2.448 -                <ItemsControl.Visibility>
   2.449 -                    <MultiBinding Converter="{StaticResource MultiBooleanToVisibility}">
   2.450 -                        <Binding Path="Message.Attachments"
   2.451 +        <!--Attachments-->
   2.452 +        <ItemsControl DockPanel.Dock="Top"
   2.453 +                      HorizontalAlignment="Stretch"
   2.454 +                      VerticalAlignment="Top"
   2.455 +                      ItemsSource="{Binding Message.Attachments, Mode=OneWay}">
   2.456 +            <ItemsControl.Visibility>
   2.457 +                <MultiBinding Converter="{StaticResource MultiBooleanToVisibility}">
   2.458 +                    <Binding Path="Message.Attachments"
   2.459                                   Mode="OneWay"
   2.460                                   Converter="{StaticResource IsListEmptyToInvertBool}" />
   2.461 -                        <Binding Path="Message.Attachments"
   2.462 +                    <Binding Path="Message.Attachments"
   2.463                                   Mode="OneWay"
   2.464                                   Converter="{StaticResource HasNonInlineAttachments}" />
   2.465 -                        <Binding Path="IsNoteModeEnabled"
   2.466 +                    <Binding Path="IsNoteModeEnabled"
   2.467                                   Mode="OneWay"
   2.468                                   Converter="{StaticResource InvertBool}" />
   2.469 -                    </MultiBinding>
   2.470 -                </ItemsControl.Visibility>
   2.471 -                <ItemsControl.ItemTemplate>
   2.472 -                    <DataTemplate>
   2.473 -                        <StackPanel Visibility="{Binding Path=ContentId, Converter={StaticResource IsStringEmptyToVisibility}}">
   2.474 -                            <Border BorderBrush="DarkGray"
   2.475 +                </MultiBinding>
   2.476 +            </ItemsControl.Visibility>
   2.477 +            <ItemsControl.ItemTemplate>
   2.478 +                <DataTemplate>
   2.479 +                    <StackPanel Visibility="{Binding Path=ContentId, Converter={StaticResource IsStringEmptyToVisibility}}">
   2.480 +                        <Border BorderBrush="DarkGray"
   2.481                                      BorderThickness="1"
   2.482                                      Height="35"
   2.483                                      Width="180"
   2.484                                      Margin="2">
   2.485 -                                <Grid>
   2.486 -                                    <Grid.ColumnDefinitions>
   2.487 -                                        <ColumnDefinition Width="*" />
   2.488 -                                        <ColumnDefinition Width="20" />
   2.489 -                                    </Grid.ColumnDefinitions>
   2.490 -                                    <Grid.RowDefinitions>
   2.491 -                                        <RowDefinition Height="*" />
   2.492 -                                    </Grid.RowDefinitions>
   2.493 -                                    <ContentControl MouseDoubleClick="ButtonAttachment_DoubleClick">
   2.494 -                                        <Grid Grid.Column="0"
   2.495 +                            <Grid>
   2.496 +                                <Grid.ColumnDefinitions>
   2.497 +                                    <ColumnDefinition Width="*" />
   2.498 +                                    <ColumnDefinition Width="20" />
   2.499 +                                </Grid.ColumnDefinitions>
   2.500 +                                <Grid.RowDefinitions>
   2.501 +                                    <RowDefinition Height="*" />
   2.502 +                                </Grid.RowDefinitions>
   2.503 +                                <ContentControl MouseDoubleClick="ButtonAttachment_DoubleClick">
   2.504 +                                    <Grid Grid.Column="0"
   2.505                                                Grid.Row="0">
   2.506 -                                            <Grid.ColumnDefinitions>
   2.507 -                                                <ColumnDefinition Width="30" />
   2.508 -                                                <ColumnDefinition Width="*" />
   2.509 -                                            </Grid.ColumnDefinitions>
   2.510 -                                            <Grid.RowDefinitions>
   2.511 -                                                <RowDefinition Height="*" />
   2.512 -                                                <RowDefinition Height="*" />
   2.513 -                                            </Grid.RowDefinitions>
   2.514 +                                        <Grid.ColumnDefinitions>
   2.515 +                                            <ColumnDefinition Width="30" />
   2.516 +                                            <ColumnDefinition Width="*" />
   2.517 +                                        </Grid.ColumnDefinitions>
   2.518 +                                        <Grid.RowDefinitions>
   2.519 +                                            <RowDefinition Height="*" />
   2.520 +                                            <RowDefinition Height="*" />
   2.521 +                                        </Grid.RowDefinitions>
   2.522  
   2.523 -                                            <!-- File icon -->
   2.524 -                                            <Image Grid.Column="0"
   2.525 +                                        <!-- File icon -->
   2.526 +                                        <Image Grid.Column="0"
   2.527                                                     Grid.Row="0"
   2.528                                                     Grid.RowSpan="2"
   2.529                                                     Stretch="Uniform"
   2.530 @@ -329,27 +330,27 @@
   2.531                                                     VerticalAlignment="Stretch"
   2.532                                                     Margin="5" />
   2.533  
   2.534 -                                            <!-- File name and size -->
   2.535 -                                            <TextBlock Grid.Column="1"
   2.536 +                                        <!-- File name and size -->
   2.537 +                                        <TextBlock Grid.Column="1"
   2.538                                                         Grid.Row="0"
   2.539                                                         HorizontalAlignment="Stretch"
   2.540                                                         VerticalAlignment="Bottom"
   2.541                                                         Text="{Binding Path='FileName', Mode=OneWay}" />
   2.542 -                                            <TextBlock Grid.Column="1"
   2.543 +                                        <TextBlock Grid.Column="1"
   2.544                                                         Grid.Row="1"
   2.545                                                         HorizontalAlignment="Stretch"
   2.546                                                         VerticalAlignment="Center"
   2.547                                                         Text="{Binding Path='FileSizeString', Mode=OneWay}" />
   2.548 -                                        </Grid>
   2.549 -                                    </ContentControl>
   2.550 -                                    <Grid Grid.Column="1"
   2.551 +                                    </Grid>
   2.552 +                                </ContentControl>
   2.553 +                                <Grid Grid.Column="1"
   2.554                                            Grid.Row="0">
   2.555 -                                        <!-- Attachment actions -->
   2.556 -                                        <!-- The button needs to pass both the PEPAttachment and DataContext to the ContextMenu
   2.557 +                                    <!-- Attachment actions -->
   2.558 +                                    <!-- The button needs to pass both the PEPAttachment and DataContext to the ContextMenu
   2.559                                       This is a little tricky because the ContextMenu is outside of the visual tree. 
   2.560                                       In order to do this, the Button Tag is set to the DataContext and the Tag is the UserControl DataContext.
   2.561                                       You cannot Set the Button DataContext to the UserControl DataContext or the PEPAttachment is lost. -->
   2.562 -                                        <Button Name="ButtonAttachment"
   2.563 +                                    <Button Name="ButtonAttachment"
   2.564                                                  Grid.Column="0"
   2.565                                                  Grid.Row="0"
   2.566                                                  Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}"
   2.567 @@ -362,58 +363,40 @@
   2.568                                                  Tag="{Binding Path='DataContext', RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}"
   2.569                                                  DataContext="{Binding Path=.}"
   2.570                                                  Click="ButtonAttachment_Click">
   2.571 -                                            <Button.ContextMenu>
   2.572 -                                                <ContextMenu Name="ContextMenuAttachment"
   2.573 +                                        <Button.ContextMenu>
   2.574 +                                            <ContextMenu Name="ContextMenuAttachment"
   2.575                                                               Placement="Bottom"
   2.576                                                               DataContext="{Binding Path='PlacementTarget', RelativeSource={RelativeSource Self}}">
   2.577 -                                                    <MenuItem Header='{x:Static p:Resources.PreviewMessage_OpenText}'
   2.578 +                                                <MenuItem Header='{x:Static p:Resources.PreviewMessage_OpenText}'
   2.579                                                                Tag="{Binding Path='DataContext'}"
   2.580                                                                Click="MenuItemOpen_Click" />
   2.581 -                                                    <Separator />
   2.582 -                                                    <MenuItem Header='{x:Static p:Resources.PreviewMessage_SaveAsText}'
   2.583 +                                                <Separator />
   2.584 +                                                <MenuItem Header='{x:Static p:Resources.PreviewMessage_SaveAsText}'
   2.585                                                                Tag="{Binding Path='DataContext'}"
   2.586                                                                Click="MenuItemSaveAs_Click" />
   2.587 -                                                </ContextMenu>
   2.588 -                                            </Button.ContextMenu>
   2.589 -                                            <TextBlock Text="▼"
   2.590 +                                            </ContextMenu>
   2.591 +                                        </Button.ContextMenu>
   2.592 +                                        <TextBlock Text="▼"
   2.593                                                         TextAlignment="Center"
   2.594                                                         FontFamily="Arial"
   2.595                                                         FontSize="9"
   2.596                                                         Foreground="DarkGray" />
   2.597 -                                        </Button>
   2.598 -                                    </Grid>
   2.599 +                                    </Button>
   2.600                                  </Grid>
   2.601 -                            </Border>
   2.602 -                        </StackPanel>
   2.603 -                    </DataTemplate>
   2.604 -                </ItemsControl.ItemTemplate>
   2.605 -                <ItemsControl.ItemsPanel>
   2.606 -                    <ItemsPanelTemplate>
   2.607 -                        <WrapPanel Orientation="Horizontal" />
   2.608 -                    </ItemsPanelTemplate>
   2.609 -                </ItemsControl.ItemsPanel>
   2.610 -            </ItemsControl>
   2.611 -            <Separator Grid.Row="2"
   2.612 -                       Margin="0,3,0,3"
   2.613 -                       Foreground="DarkSlateGray">
   2.614 -                <Separator.Visibility>
   2.615 -                    <MultiBinding Converter="{StaticResource MultiBooleanToVisibility}">
   2.616 -                        <Binding Path="Message.Attachments"
   2.617 -                                 Mode="OneWay"
   2.618 -                                 Converter="{StaticResource IsListEmptyToInvertBool}" />
   2.619 -                        <Binding Path="Message.Attachments"
   2.620 -                                 Mode="OneWay"
   2.621 -                                 Converter="{StaticResource HasNonInlineAttachments}" />
   2.622 -                        <Binding Path="IsNoteModeEnabled"
   2.623 -                                 Mode="OneWay"
   2.624 -                                 Converter="{StaticResource InvertBool}" />
   2.625 -                    </MultiBinding>
   2.626 -                </Separator.Visibility>
   2.627 -            </Separator>
   2.628 -        </Grid>
   2.629 +                            </Grid>
   2.630 +                        </Border>
   2.631 +                    </StackPanel>
   2.632 +                </DataTemplate>
   2.633 +            </ItemsControl.ItemTemplate>
   2.634 +            <ItemsControl.ItemsPanel>
   2.635 +                <ItemsPanelTemplate>
   2.636 +                    <WrapPanel Orientation="Horizontal" />
   2.637 +                </ItemsPanelTemplate>
   2.638 +            </ItemsControl.ItemsPanel>
   2.639 +        </ItemsControl>
   2.640  
   2.641 -        <TextBlock x:Name="RemoteImagesWarning"
   2.642 -                   Grid.Row="6"
   2.643 +        <TextBlock x:Name="RemoteImagesWarning" 
   2.644 +                   DockPanel.Dock="Top"
   2.645                     Visibility="Collapsed"
   2.646                     Padding="5"
   2.647                     Text="{x:Static p:Resources.PreviewMessage_RemoteImagesWarningText}"
   2.648 @@ -434,11 +417,12 @@
   2.649          </TextBlock>
   2.650  
   2.651          <WebBrowser x:Name="WebBrowser"
   2.652 -                    Grid.Row="7"
   2.653 +                    DockPanel.Dock="Top"
   2.654                      HorizontalAlignment="Stretch"
   2.655                      VerticalAlignment="Stretch"
   2.656                      Margin="0,10,0,0"
   2.657                      Navigating="WebBrowser_Navigating"
   2.658                      Visibility="{Binding Path='IsNoteModeEnabled', Mode=OneWay, Converter={StaticResource InvertBoolToVisibility}}" />
   2.659 -    </Grid>
   2.660 +
   2.661 +    </DockPanel>
   2.662  </UserControl>
   2.663 \ No newline at end of file
     3.1 --- a/UI/FormControlPreviewMessage.xaml.cs	Fri Aug 09 12:49:04 2019 +0200
     3.2 +++ b/UI/FormControlPreviewMessage.xaml.cs	Fri Aug 09 16:07:35 2019 +0200
     3.3 @@ -4,9 +4,11 @@
     3.4  using System.Diagnostics;
     3.5  using System.IO;
     3.6  using System.Net;
     3.7 +using System.Runtime.CompilerServices;
     3.8  using System.Text.RegularExpressions;
     3.9  using System.Windows;
    3.10  using System.Windows.Controls;
    3.11 +using System.Windows.Media;
    3.12  using Outlook = Microsoft.Office.Interop.Outlook;
    3.13  
    3.14  namespace pEp.UI
    3.15 @@ -116,8 +118,6 @@
    3.16                  this.ButtonReply = null;
    3.17                  this.ButtonReplyAll = null;
    3.18                  this.displayState = null;
    3.19 -                this.displayState = null;
    3.20 -                this.GridLayoutRoot = null;
    3.21                  this.RemoteImagesWarning = null;
    3.22  
    3.23                  this.DeleteTempHtmlFiles();
    3.24 @@ -414,7 +414,6 @@
    3.25              }
    3.26  
    3.27              this.PropertyChanged?.Invoke(this, e);
    3.28 -            return;
    3.29          }
    3.30  
    3.31          /// <summary>
    3.32 @@ -423,7 +422,6 @@
    3.33          private void ButtonForward_Click(object sender, RoutedEventArgs e)
    3.34          {
    3.35              this.Forward?.Invoke(this, new RoutedEventArgs());
    3.36 -            return;
    3.37          }
    3.38  
    3.39          /// <summary>
    3.40 @@ -432,7 +430,6 @@
    3.41          private void ButtonReply_Click(object sender, RoutedEventArgs e)
    3.42          {
    3.43              this.Reply?.Invoke(this, new RoutedEventArgs());
    3.44 -            return;
    3.45          }
    3.46  
    3.47          /// <summary>
    3.48 @@ -455,8 +452,6 @@
    3.49              menu.PlacementTarget = button;
    3.50              menu.Placement = System.Windows.Controls.Primitives.PlacementMode.Bottom;
    3.51              menu.IsOpen = true;
    3.52 -
    3.53 -            return;
    3.54          }
    3.55  
    3.56          /// <summary>
    3.57 @@ -470,9 +465,8 @@
    3.58              {
    3.59                  ((PEPAttachment)contentControl.DataContext).Open();
    3.60              }
    3.61 -            return;
    3.62 +        }
    3.63  
    3.64 -        }
    3.65          /// <summary>
    3.66          /// Event handler for when the Open context menu item is clicked for an attachment.
    3.67          /// </summary>
    3.68 @@ -484,8 +478,6 @@
    3.69              {
    3.70                  ((PEPAttachment)menuItem.Tag).Open();
    3.71              }
    3.72 -
    3.73 -            return;
    3.74          }
    3.75  
    3.76          /// <summary>
    3.77 @@ -580,12 +572,8 @@
    3.78              /// </summary>
    3.79              public event PropertyChangedEventHandler PropertyChanged;
    3.80  
    3.81 -            private string     _CcRecipients;
    3.82 -            private string     _Date;
    3.83 -            private string     _FromRecipient;
    3.84 -            private bool       _IsNoteModeEnabled;
    3.85 +            private bool _IsNoteModeEnabled;
    3.86              private PEPMessage _Message;
    3.87 -            private string     _ToRecipients;
    3.88  
    3.89              /**************************************************************
    3.90               * 
    3.91 @@ -608,30 +596,25 @@
    3.92               *************************************************************/
    3.93  
    3.94              /// <summary>
    3.95 -            /// Gets the formatted Cc recipients string of the message.
    3.96 -            /// This is a dependent property set through Message.
    3.97 +            /// Gets the background color of the Contact icon.
    3.98              /// </summary>
    3.99 -            public string CcRecipients
   3.100 -            {
   3.101 -                get { return this._CcRecipients; }
   3.102 -            }
   3.103 +            public SolidColorBrush ContactIconBackground { get; private set; }
   3.104 +
   3.105 +            /// <summary>
   3.106 +            /// Gets the text to show in the Contact icon.
   3.107 +            /// </summary>
   3.108 +            public string ContactIconText { get; private set; }
   3.109  
   3.110              /// <summary>
   3.111              /// Gets the formatted date string of the message.
   3.112              /// This is a dependent property set through Message.
   3.113              /// </summary>
   3.114 -            public string Date
   3.115 -            {
   3.116 -                get { return (this._Date); }
   3.117 -            }
   3.118 +            public string Date { get; private set; }
   3.119  
   3.120              /// <summary>
   3.121              /// Gets the To recipient
   3.122              /// </summary>
   3.123 -            public string FromRecipient
   3.124 -            {
   3.125 -                get { return (this._FromRecipient); }
   3.126 -            }
   3.127 +            public string FromRecipient { get; private set; }
   3.128  
   3.129              /// <summary>
   3.130              /// Gets or sets whether note mode is enabled.
   3.131 @@ -639,11 +622,11 @@
   3.132              /// </summary>
   3.133              public bool IsNoteModeEnabled
   3.134              {
   3.135 -                get { return (this._IsNoteModeEnabled); }
   3.136 +                get => this._IsNoteModeEnabled;
   3.137                  set
   3.138                  {
   3.139                      this._IsNoteModeEnabled = value;
   3.140 -                    this.RaisePropertyChangedEvent(nameof(this.IsNoteModeEnabled));
   3.141 +                    this.OnPropertyChanged();
   3.142  
   3.143                      this.CalcDependentProperties();
   3.144                  }
   3.145 @@ -654,11 +637,11 @@
   3.146              /// </summary>
   3.147              public PEPMessage Message
   3.148              {
   3.149 -                get { return (this._Message); }
   3.150 +                get => this._Message;
   3.151                  set
   3.152                  {
   3.153                      this._Message = value;
   3.154 -                    this.RaisePropertyChangedEvent(nameof(this.Message));
   3.155 +                    this.OnPropertyChanged();
   3.156  
   3.157                      this.CalcDependentProperties();
   3.158                  }
   3.159 @@ -669,15 +652,6 @@
   3.160              /// </summary>
   3.161              public string OriginalEntryId { get; set; } = null;
   3.162  
   3.163 -            /// <summary>
   3.164 -            /// Gets the formatted To recipients string of the message.
   3.165 -            /// This is a dependent property set through Message.
   3.166 -            /// </summary>
   3.167 -            public string ToRecipients
   3.168 -            {
   3.169 -                get { return (this._ToRecipients); }
   3.170 -            }
   3.171 -
   3.172              /**************************************************************
   3.173               * 
   3.174               * Methods
   3.175 @@ -688,10 +662,9 @@
   3.176              /// Raises the property changed event, if possible, with the given arguments.
   3.177              /// </summary>
   3.178              /// <param name="propertyName">The name of the property that changed.</param>
   3.179 -            private void RaisePropertyChangedEvent(string propertyName)
   3.180 +            protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
   3.181              {
   3.182                  this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
   3.183 -                return;
   3.184              }
   3.185  
   3.186              /// <summary>
   3.187 @@ -700,16 +673,11 @@
   3.188              public void Reset()
   3.189              {
   3.190                  // Set independent properties
   3.191 -                this._IsNoteModeEnabled = true;
   3.192 -                this._Message = null;
   3.193 -
   3.194 -                this.RaisePropertyChangedEvent(nameof(this.IsNoteModeEnabled));
   3.195 -                this.RaisePropertyChangedEvent(nameof(this.Message));
   3.196 +                this.IsNoteModeEnabled = true;
   3.197 +                this.Message = null;
   3.198  
   3.199                  // Set dependent properties -- raises own events
   3.200                  this.CalcDependentProperties();
   3.201 -
   3.202 -                return;
   3.203              }
   3.204  
   3.205              /// <summary>
   3.206 @@ -718,59 +686,37 @@
   3.207              /// </summary>
   3.208              private void CalcDependentProperties()
   3.209              {
   3.210 -                string recipientText = string.Empty;
   3.211 +                // Date
   3.212 +                this.Date = this._Message?.SentOn?.ToString("g", Globals.ThisAddIn.GetActiveUICulture());
   3.213 +                this.OnPropertyChanged(nameof(this.Date));
   3.214  
   3.215 -                // Date
   3.216 -                this._Date = this._Message?.SentOn?.ToString("g", Globals.ThisAddIn.GetActiveUICulture());
   3.217 -                this.RaisePropertyChangedEvent(nameof(this.Date));
   3.218 +                // From recipient
   3.219 +                this.FromRecipient = this._Message?.From?.UserName ?? this.Message?.From?.Address;
   3.220 +                this.OnPropertyChanged(nameof(this.FromRecipient));
   3.221  
   3.222 -                // Recipients
   3.223 -                this._ToRecipients = null;
   3.224 -                this._CcRecipients = null;
   3.225 +                // Contact Icon color
   3.226 +                this.ContactIconBackground = (SolidColorBrush)new BrushConverter().ConvertFromString("#03AA4B");
   3.227 +                this.OnPropertyChanged(nameof(this.ContactIconBackground));
   3.228  
   3.229 -                // To recipients
   3.230 -                for (int i = 0; i < this._Message?.To?.Count; i++)
   3.231 +                // Contact Icon text
   3.232 +                string contactIconText = null;
   3.233 +                try
   3.234                  {
   3.235 -                    if (i == (this._Message.To.Count - 1))
   3.236 +                    string[] initials = this.FromRecipient?.ToUpperInvariant()?.Split(' ');
   3.237 +                    if (initials?.Length > 0)
   3.238                      {
   3.239 -                        recipientText += this._Message.To[i].ToDisplayString();
   3.240 -                    }
   3.241 -                    else
   3.242 -                    {
   3.243 -                        recipientText += this._Message.To[i].ToDisplayString() + "; ";
   3.244 +                        for (int i = 0; i < initials?.Length; i++)
   3.245 +                        {
   3.246 +                            contactIconText += initials[i][0];
   3.247 +                        }
   3.248                      }
   3.249                  }
   3.250 -                this._ToRecipients = recipientText;
   3.251 -                this.RaisePropertyChangedEvent(nameof(this.ToRecipients));
   3.252 -
   3.253 -                // Add any Cc (skip Bcc)
   3.254 -                recipientText = string.Empty;
   3.255 -                for (int i = 0; i < this._Message?.Cc?.Count; i++)
   3.256 +                catch (Exception ex)
   3.257                  {
   3.258 -                    if (i == (this._Message.Cc.Count - 1))
   3.259 -                    {
   3.260 -                        recipientText += this._Message.Cc[i].ToDisplayString();
   3.261 -                    }
   3.262 -                    else
   3.263 -                    {
   3.264 -                        recipientText += this._Message.Cc[i].ToDisplayString() + "; ";
   3.265 -                    }
   3.266 +                    Log.Error("FormControlPreviewMessage.CalcDependentProperties: Error getting initials. " + ex.ToString());
   3.267                  }
   3.268 -
   3.269 -                this._CcRecipients = recipientText;
   3.270 -                this.RaisePropertyChangedEvent(nameof(this.CcRecipients));
   3.271 -
   3.272 -                // From recipient
   3.273 -                this._FromRecipient = this._Message?.From?.UserName;
   3.274 -                if (string.IsNullOrEmpty(this._FromRecipient))
   3.275 -                {
   3.276 -                    this._FromRecipient = this._Message?.From?.Address;
   3.277 -                }
   3.278 -                else
   3.279 -                {
   3.280 -                    this._FromRecipient += string.Concat(" <", this._Message?.From?.Address, ">");
   3.281 -                }
   3.282 -                this.RaisePropertyChangedEvent(nameof(this.FromRecipient));
   3.283 +                this.ContactIconText = contactIconText;
   3.284 +                this.OnPropertyChanged(nameof(this.ContactIconText));
   3.285              }
   3.286  
   3.287              /// <summary>
   3.288 @@ -779,26 +725,10 @@
   3.289              /// </summary>
   3.290              public void SetNote(string note = null)
   3.291              {
   3.292 -                /* Ignore the following which aren't needed
   3.293 -                 *  - ForwardText
   3.294 -                 *  - OpenText
   3.295 -                 *  - PreviewText
   3.296 -                 *  - ReplyAllText
   3.297 -                 *  - ReplyText
   3.298 -                 *  - SaveAsText
   3.299 -                 */
   3.300 -
   3.301 -                this._Date = null;
   3.302 -                this._IsNoteModeEnabled = true;
   3.303 -                this._Message = null;
   3.304 -                this._ToRecipients = note;
   3.305 -
   3.306 -                this.RaisePropertyChangedEvent(nameof(this.Date));
   3.307 -                this.RaisePropertyChangedEvent(nameof(this.IsNoteModeEnabled));
   3.308 -                this.RaisePropertyChangedEvent(nameof(this.Message));
   3.309 -                this.RaisePropertyChangedEvent(nameof(this.ToRecipients));
   3.310 -
   3.311 -                return;
   3.312 +                this.Date = null;
   3.313 +                this.IsNoteModeEnabled = true;
   3.314 +                this.Message = null;
   3.315 +                this.FromRecipient = note;
   3.316              }
   3.317  
   3.318              /// <summary>
   3.319 @@ -808,11 +738,8 @@
   3.320              /// <param name="message">The message to set to the UI.</param>
   3.321              public void SetMessage(PEPMessage message)
   3.322              {
   3.323 -                this._IsNoteModeEnabled = false;
   3.324 -                this._Message = message;
   3.325 -
   3.326 -                this.RaisePropertyChangedEvent(nameof(this.IsNoteModeEnabled));
   3.327 -                this.RaisePropertyChangedEvent(nameof(this.Message));
   3.328 +                this.IsNoteModeEnabled = false;
   3.329 +                this.Message = message;
   3.330  
   3.331                  this.CalcDependentProperties();
   3.332              }