fixed some app bar buttons
This commit is contained in:
@@ -3,6 +3,8 @@
|
|||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:accounts="using:Wino.Core.Domain.Models.Accounts"
|
xmlns:accounts="using:Wino.Core.Domain.Models.Accounts"
|
||||||
|
xmlns:controls="using:Wino.Controls"
|
||||||
|
xmlns:controls1="using:CommunityToolkit.WinUI.Controls"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:domain="using:Wino.Core.Domain"
|
xmlns:domain="using:Wino.Core.Domain"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
@@ -52,45 +54,67 @@
|
|||||||
DefaultLabelPosition="Collapsed"
|
DefaultLabelPosition="Collapsed"
|
||||||
IsOpen="False">
|
IsOpen="False">
|
||||||
<AppBarButton
|
<AppBarButton
|
||||||
|
Width="48"
|
||||||
|
Click="InvertComposerThemeClicked"
|
||||||
|
LabelPosition="Collapsed"
|
||||||
|
Visibility="{x:Bind IsComposerDarkMode, Mode=OneWay}">
|
||||||
|
<AppBarButton.Icon>
|
||||||
|
<controls:WinoFontIcon Icon="DarkEditor" />
|
||||||
|
</AppBarButton.Icon>
|
||||||
|
</AppBarButton>
|
||||||
|
|
||||||
|
<AppBarButton
|
||||||
|
Width="48"
|
||||||
|
Click="InvertComposerThemeClicked"
|
||||||
|
LabelPosition="Collapsed"
|
||||||
|
Visibility="{x:Bind IsComposerDarkMode, Mode=OneWay, Converter={StaticResource ReverseBooleanToVisibilityConverter}}">
|
||||||
|
<AppBarButton.Icon>
|
||||||
|
<controls:WinoFontIcon Icon="LightEditor" />
|
||||||
|
</AppBarButton.Icon>
|
||||||
|
</AppBarButton>
|
||||||
|
|
||||||
|
<AppBarSeparator />
|
||||||
|
|
||||||
|
<AppBarToggleButton
|
||||||
x:Name="BoldButton"
|
x:Name="BoldButton"
|
||||||
Width="48"
|
Width="48"
|
||||||
Click="BoldButtonClicked"
|
Click="BoldButtonClicked"
|
||||||
Label="Bold"
|
Label="Bold"
|
||||||
ToolTipService.ToolTip="Bold">
|
ToolTipService.ToolTip="Bold">
|
||||||
<AppBarButton.Icon>
|
<AppBarToggleButton.Icon>
|
||||||
<PathIcon Data="{StaticResource BoldPathIcon}" />
|
<PathIcon Data="{StaticResource BoldPathIcon}" />
|
||||||
</AppBarButton.Icon>
|
</AppBarToggleButton.Icon>
|
||||||
</AppBarButton>
|
</AppBarToggleButton>
|
||||||
<AppBarButton
|
<AppBarToggleButton
|
||||||
x:Name="ItalicButton"
|
x:Name="ItalicButton"
|
||||||
Width="48"
|
Width="48"
|
||||||
Click="ItalicButtonClicked"
|
Click="ItalicButtonClicked"
|
||||||
Label="Italic"
|
Label="Italic"
|
||||||
ToolTipService.ToolTip="Italic">
|
ToolTipService.ToolTip="Italic">
|
||||||
<AppBarButton.Icon>
|
<AppBarToggleButton.Icon>
|
||||||
<PathIcon Data="{StaticResource ItalicPathIcon}" />
|
<PathIcon Data="{StaticResource ItalicPathIcon}" />
|
||||||
</AppBarButton.Icon>
|
</AppBarToggleButton.Icon>
|
||||||
</AppBarButton>
|
</AppBarToggleButton>
|
||||||
<AppBarButton
|
<AppBarToggleButton
|
||||||
x:Name="UnderlineButton"
|
x:Name="UnderlineButton"
|
||||||
Width="48"
|
Width="48"
|
||||||
Click="UnderlineButtonClicked"
|
Click="UnderlineButtonClicked"
|
||||||
Label="Underline"
|
Label="Underline"
|
||||||
ToolTipService.ToolTip="Underline">
|
ToolTipService.ToolTip="Underline">
|
||||||
<AppBarButton.Icon>
|
<AppBarToggleButton.Icon>
|
||||||
<PathIcon Data="{StaticResource UnderlinePathIcon}" />
|
<PathIcon Data="{StaticResource UnderlinePathIcon}" />
|
||||||
</AppBarButton.Icon>
|
</AppBarToggleButton.Icon>
|
||||||
</AppBarButton>
|
</AppBarToggleButton>
|
||||||
<AppBarButton
|
<AppBarToggleButton
|
||||||
x:Name="StrokeButton"
|
x:Name="StrokeButton"
|
||||||
Width="48"
|
Width="48"
|
||||||
Click="StrokeButtonClicked"
|
Click="StrokeButtonClicked"
|
||||||
Label="Stroke"
|
Label="Stroke"
|
||||||
ToolTipService.ToolTip="Stroke">
|
ToolTipService.ToolTip="Stroke">
|
||||||
<AppBarButton.Icon>
|
<AppBarToggleButton.Icon>
|
||||||
<PathIcon Data="{StaticResource StrikePathIcon}" />
|
<PathIcon Data="{StaticResource StrikePathIcon}" />
|
||||||
</AppBarButton.Icon>
|
</AppBarToggleButton.Icon>
|
||||||
</AppBarButton>
|
</AppBarToggleButton>
|
||||||
<AppBarSeparator />
|
<AppBarSeparator />
|
||||||
<AppBarToggleButton
|
<AppBarToggleButton
|
||||||
x:Name="BulletListButton"
|
x:Name="BulletListButton"
|
||||||
@@ -187,7 +211,7 @@
|
|||||||
x:Name="AddImageButton"
|
x:Name="AddImageButton"
|
||||||
Width="48"
|
Width="48"
|
||||||
Click="AddImageClicked"
|
Click="AddImageClicked"
|
||||||
ToolTipService.ToolTip="Add Image">
|
ToolTipService.ToolTip="{x:Bind domain:Translator.Photos}">
|
||||||
<AppBarButton.Icon>
|
<AppBarButton.Icon>
|
||||||
<PathIcon Data="{StaticResource AddPhotoPathIcon}" />
|
<PathIcon Data="{StaticResource AddPhotoPathIcon}" />
|
||||||
</AppBarButton.Icon>
|
</AppBarButton.Icon>
|
||||||
@@ -204,15 +228,7 @@
|
|||||||
x:Name="EmojiButton"
|
x:Name="EmojiButton"
|
||||||
Width="48"
|
Width="48"
|
||||||
Click="EmojiButtonClicked"
|
Click="EmojiButtonClicked"
|
||||||
ToolTipService.ToolTip="Add Emoji">
|
ToolTipService.ToolTip="{x:Bind domain:Translator.Emoji}">
|
||||||
<AppBarButton.Content>
|
|
||||||
<StackPanel Orientation="Horizontal" Spacing="8">
|
|
||||||
<Viewbox Width="16" VerticalAlignment="Center">
|
|
||||||
<PathIcon Data="{StaticResource EmojiPathIcon}" />
|
|
||||||
</Viewbox>
|
|
||||||
<TextBlock Text="{x:Bind domain:Translator.Emoji}" />
|
|
||||||
</StackPanel>
|
|
||||||
</AppBarButton.Content>
|
|
||||||
<AppBarButton.Icon>
|
<AppBarButton.Icon>
|
||||||
<PathIcon Data="{StaticResource EmojiPathIcon}" />
|
<PathIcon Data="{StaticResource EmojiPathIcon}" />
|
||||||
</AppBarButton.Icon>
|
</AppBarButton.Icon>
|
||||||
@@ -222,7 +238,7 @@
|
|||||||
Width="48"
|
Width="48"
|
||||||
Click="HyperlinkAddClicked"
|
Click="HyperlinkAddClicked"
|
||||||
Label="Add Link"
|
Label="Add Link"
|
||||||
ToolTipService.ToolTip="Add Link">
|
ToolTipService.ToolTip="{x:Bind domain:Translator.AddHyperlink}">
|
||||||
<AppBarButton.Flyout>
|
<AppBarButton.Flyout>
|
||||||
<Flyout x:Name="HyperlinkFlyout">
|
<Flyout x:Name="HyperlinkFlyout">
|
||||||
<StackPanel Width="250" Spacing="6">
|
<StackPanel Width="250" Spacing="6">
|
||||||
@@ -240,26 +256,18 @@
|
|||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Flyout>
|
</Flyout>
|
||||||
</AppBarButton.Flyout>
|
</AppBarButton.Flyout>
|
||||||
<AppBarButton.Content>
|
|
||||||
<StackPanel Orientation="Horizontal" Spacing="8">
|
|
||||||
<Viewbox Width="16" VerticalAlignment="Center">
|
|
||||||
<PathIcon Data="{StaticResource AddLinkPathIcon}" />
|
|
||||||
</Viewbox>
|
|
||||||
<TextBlock Text="Link" />
|
|
||||||
</StackPanel>
|
|
||||||
</AppBarButton.Content>
|
|
||||||
<AppBarButton.Icon>
|
<AppBarButton.Icon>
|
||||||
<PathIcon Data="{StaticResource AddLinkPathIcon}" />
|
<PathIcon Data="{StaticResource AddLinkPathIcon}" />
|
||||||
</AppBarButton.Icon>
|
</AppBarButton.Icon>
|
||||||
</AppBarButton>
|
</AppBarButton>
|
||||||
</CommandBar>
|
</CommandBar>
|
||||||
<Grid Grid.Row="1" CornerRadius="10">
|
<Grid
|
||||||
<muxc:WebView2
|
Grid.Row="1"
|
||||||
x:Name="Chromium"
|
Margin="0,6,0,0"
|
||||||
Width="Auto"
|
CornerRadius="3">
|
||||||
Height="Auto"
|
<Grid Background="White" Visibility="{x:Bind IsComposerDarkMode, Converter={StaticResource ReverseBooleanToVisibilityConverter}, Mode=OneWay}" />
|
||||||
BorderBrush="LightGray"
|
|
||||||
BorderThickness="1" />
|
<muxc:WebView2 x:Name="Chromium" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ namespace Wino.Dialogs
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
SignatureNameHeader = Translator.SignatureEditorDialog_SignatureName_TitleNew;
|
SignatureNameHeader = Translator.SignatureEditorDialog_SignatureName_TitleNew;
|
||||||
|
Environment.SetEnvironmentVariable("WEBVIEW2_DEFAULT_BACKGROUND_COLOR", "00FFFFFF");
|
||||||
Environment.SetEnvironmentVariable("WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS", "--enable-features=OverlayScrollbar,OverlayScrollbarWinStyle,OverlayScrollbarWinStyleAnimation");
|
Environment.SetEnvironmentVariable("WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS", "--enable-features=OverlayScrollbar,OverlayScrollbarWinStyle,OverlayScrollbarWinStyleAnimation");
|
||||||
|
|
||||||
// TODO: Should be added additional logic to enable/disable primary button when webview content changed.
|
// TODO: Should be added additional logic to enable/disable primary button when webview content changed.
|
||||||
@@ -56,6 +57,7 @@ namespace Wino.Dialogs
|
|||||||
HtmlBody = signatureModel.HtmlBody
|
HtmlBody = signatureModel.HtmlBody
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Environment.SetEnvironmentVariable("WEBVIEW2_DEFAULT_BACKGROUND_COLOR", "00FFFFFF");
|
||||||
Environment.SetEnvironmentVariable("WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS", "--enable-features=OverlayScrollbar,OverlayScrollbarWinStyle,OverlayScrollbarWinStyleAnimation");
|
Environment.SetEnvironmentVariable("WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS", "--enable-features=OverlayScrollbar,OverlayScrollbarWinStyle,OverlayScrollbarWinStyleAnimation");
|
||||||
|
|
||||||
// TODO: Should be added additional logic to enable/disable primary button when webview content changed.
|
// TODO: Should be added additional logic to enable/disable primary button when webview content changed.
|
||||||
@@ -90,7 +92,7 @@ namespace Wino.Dialogs
|
|||||||
if (Chromium.CoreWebView2 != null)
|
if (Chromium.CoreWebView2 != null)
|
||||||
{
|
{
|
||||||
Chromium.CoreWebView2.DOMContentLoaded -= DOMLoaded;
|
Chromium.CoreWebView2.DOMContentLoaded -= DOMLoaded;
|
||||||
Chromium.CoreWebView2.WebMessageReceived -= ScriptMessageRecieved;
|
Chromium.CoreWebView2.WebMessageReceived -= ScriptMessageReceived;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -303,32 +305,32 @@ namespace Wino.Dialogs
|
|||||||
Chromium.CoreWebView2.DOMContentLoaded -= DOMLoaded;
|
Chromium.CoreWebView2.DOMContentLoaded -= DOMLoaded;
|
||||||
Chromium.CoreWebView2.DOMContentLoaded += DOMLoaded;
|
Chromium.CoreWebView2.DOMContentLoaded += DOMLoaded;
|
||||||
|
|
||||||
Chromium.CoreWebView2.WebMessageReceived -= ScriptMessageRecieved;
|
Chromium.CoreWebView2.WebMessageReceived -= ScriptMessageReceived;
|
||||||
Chromium.CoreWebView2.WebMessageReceived += ScriptMessageRecieved;
|
Chromium.CoreWebView2.WebMessageReceived += ScriptMessageReceived;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static async void OnIsComposerDarkModeChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args)
|
private static async void OnIsComposerDarkModeChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args)
|
||||||
{
|
{
|
||||||
//if (obj is ComposePage page)
|
if (obj is SignatureEditorDialog dialog)
|
||||||
//{
|
{
|
||||||
// await page.UpdateEditorThemeAsync();
|
await dialog.UpdateEditorThemeAsync();
|
||||||
//}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ScriptMessageRecieved(CoreWebView2 sender, CoreWebView2WebMessageReceivedEventArgs args)
|
private void ScriptMessageReceived(CoreWebView2 sender, CoreWebView2WebMessageReceivedEventArgs args)
|
||||||
{
|
{
|
||||||
var change = JsonConvert.DeserializeObject<string>(args.WebMessageAsJson);
|
var change = JsonConvert.DeserializeObject<string>(args.WebMessageAsJson);
|
||||||
|
|
||||||
bool isEnabled = change.EndsWith("ql-active");
|
bool isEnabled = change.EndsWith("ql-active");
|
||||||
|
|
||||||
if (change.StartsWith("ql-bold"))
|
if (change.StartsWith("ql-bold"))
|
||||||
BoldButton.IsFocusEngaged = isEnabled;
|
BoldButton.IsChecked = isEnabled;
|
||||||
else if (change.StartsWith("ql-italic"))
|
else if (change.StartsWith("ql-italic"))
|
||||||
ItalicButton.IsEnabled = isEnabled;
|
ItalicButton.IsChecked = isEnabled;
|
||||||
else if (change.StartsWith("ql-underline"))
|
else if (change.StartsWith("ql-underline"))
|
||||||
UnderlineButton.IsEnabled = isEnabled;
|
UnderlineButton.IsChecked = isEnabled;
|
||||||
else if (change.StartsWith("ql-strike"))
|
else if (change.StartsWith("ql-strike"))
|
||||||
StrokeButton.IsEnabled = isEnabled;
|
StrokeButton.IsChecked = isEnabled;
|
||||||
else if (change.StartsWith("orderedListButton"))
|
else if (change.StartsWith("orderedListButton"))
|
||||||
OrderedListButton.IsChecked = isEnabled;
|
OrderedListButton.IsChecked = isEnabled;
|
||||||
else if (change.StartsWith("bulletListButton"))
|
else if (change.StartsWith("bulletListButton"))
|
||||||
@@ -369,5 +371,10 @@ namespace Wino.Dialogs
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void SignatureNameTextBoxTextChanged(object sender, TextChangedEventArgs e) => IsPrimaryButtonEnabled = !string.IsNullOrWhiteSpace(SignatureNameTextBox.Text);
|
private void SignatureNameTextBoxTextChanged(object sender, TextChangedEventArgs e) => IsPrimaryButtonEnabled = !string.IsNullOrWhiteSpace(SignatureNameTextBox.Text);
|
||||||
|
|
||||||
|
private void InvertComposerThemeClicked(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
IsComposerDarkMode = !IsComposerDarkMode;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user