View message source (#541)

* Added view message source

* Change condition to when button available
This commit is contained in:
Aleh Khantsevich
2025-02-01 18:13:36 +01:00
committed by GitHub
parent 7cfa5a57f5
commit fcaf62ecf7
13 changed files with 95 additions and 1 deletions

View File

@@ -0,0 +1,28 @@
<ContentDialog
x:Class="Wino.Mail.Dialogs.MessageSourceDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:domain="using:Wino.Core.Domain"
xmlns:local="using:Wino.Mail.Dialogs"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="{x:Bind domain:Translator.MessageSourceDialog_Title}"
DefaultButton="Primary"
PrimaryButtonClick="ContentDialog_PrimaryButtonClick"
PrimaryButtonText="{x:Bind domain:Translator.Buttons_Copy}"
SecondaryButtonText="{x:Bind domain:Translator.Buttons_Close}"
Style="{StaticResource WinoDialogStyle}"
mc:Ignorable="d">
<ContentDialog.Resources>
<x:Double x:Key="ContentDialogMaxWidth">1200</x:Double>
</ContentDialog.Resources>
<ScrollViewer HorizontalScrollBarVisibility="Disabled" HorizontalScrollMode="Disabled">
<TextBlock
MaxWidth="1000"
IsTextSelectionEnabled="True"
Text="{x:Bind MessageSource, Mode=OneWay}"
TextWrapping="Wrap" />
</ScrollViewer>
</ContentDialog>

View File

@@ -0,0 +1,24 @@
using Microsoft.Extensions.DependencyInjection;
using Windows.UI.Xaml.Controls;
using Wino.Core.Domain.Interfaces;
namespace Wino.Mail.Dialogs
{
public sealed partial class MessageSourceDialog : ContentDialog
{
private readonly IClipboardService _clipboardService = App.Current.Services.GetService<IClipboardService>();
public string MessageSource { get; set; }
public bool Copied { get; set; }
public MessageSourceDialog()
{
this.InitializeComponent();
}
private void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
{
_clipboardService.CopyClipboardAsync(MessageSource);
Copied = true;
}
}
}