View message source (#541)
* Added view message source * Change condition to when button available
This commit is contained in:
28
Wino.Mail/Dialogs/MessageSourceDialog.xaml
Normal file
28
Wino.Mail/Dialogs/MessageSourceDialog.xaml
Normal 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>
|
||||
24
Wino.Mail/Dialogs/MessageSourceDialog.xaml.cs
Normal file
24
Wino.Mail/Dialogs/MessageSourceDialog.xaml.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,7 @@ using Wino.Core.Domain.Models.Synchronization;
|
||||
using Wino.Core.UWP.Extensions;
|
||||
using Wino.Core.UWP.Services;
|
||||
using Wino.Dialogs;
|
||||
using Wino.Mail.Dialogs;
|
||||
using Wino.Messaging.Server;
|
||||
using Wino.Messaging.UI;
|
||||
|
||||
@@ -169,6 +170,20 @@ namespace Wino.Services
|
||||
return result == ContentDialogResult.Primary ? signatureEditorDialog.Result : null;
|
||||
}
|
||||
|
||||
public async Task ShowMessageSourceDialogAsync(string messageSource)
|
||||
{
|
||||
var dialog = new MessageSourceDialog()
|
||||
{
|
||||
MessageSource = messageSource,
|
||||
RequestedTheme = ThemeService.RootTheme.ToWindowsElementTheme()
|
||||
};
|
||||
|
||||
await HandleDialogPresentationAsync(dialog);
|
||||
|
||||
if(dialog.Copied)
|
||||
InfoBarMessage(Translator.ClipboardTextCopied_Title, string.Format(Translator.ClipboardTextCopied_Message, Translator.MessageSourceDialog_Title), InfoBarMessageType.Information);
|
||||
}
|
||||
|
||||
public async Task ShowAccountReorderDialogAsync(ObservableCollection<IAccountProviderDetailViewModel> availableAccounts)
|
||||
{
|
||||
var accountReorderDialog = new AccountReorderDialog(availableAccounts)
|
||||
|
||||
@@ -223,6 +223,9 @@
|
||||
<Compile Include="Dialogs\AccountReorderDialog.xaml.cs">
|
||||
<DependentUpon>AccountReorderDialog.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Dialogs\MessageSourceDialog.xaml.cs">
|
||||
<DependentUpon>MessageSourceDialog.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Dialogs\MoveMailDialog.xaml.cs">
|
||||
<DependentUpon>MoveMailDialog.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@@ -364,6 +367,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Dialogs\MessageSourceDialog.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Dialogs\MoveMailDialog.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
||||
Reference in New Issue
Block a user