Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 22 additions & 7 deletions PhoneAssistant.WPF/Features/Phones/EmailView.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,20 +1,35 @@
using System.Windows.Controls;
using System.ComponentModel;
using System.Windows.Controls;

namespace PhoneAssistant.WPF.Features.Phones;

public partial class EmailView : UserControl
{
{
public EmailView()
{
InitializeComponent();
InitializeAsync();

// Don't run the WebView2 initialization when the XAML designer is active
if (DesignerProperties.GetIsInDesignMode(this))
return;

_ = InitializeAsync();
}
async void InitializeAsync()
async Task InitializeAsync()
{
try
{
if (WebView2 is null)
return;

await WebView2.EnsureCoreWebView2Async(null);
//WebView2.CoreWebView2.Profile.PreferredColorScheme = Microsoft.Web.WebView2.Core.CoreWebView2PreferredColorScheme.Light;
WebView2.DefaultBackgroundColor = System.Drawing.Color.LightGray;
await WebView2.EnsureCoreWebView2Async(null);
WebView2.CoreWebView2?.Profile.PreferredColorScheme = Microsoft.Web.WebView2.Core.CoreWebView2PreferredColorScheme.Light;
WebView2.DefaultBackgroundColor = System.Drawing.Color.LightGray;
}
catch (Exception)
{
// Swallow exceptions during initialization to avoid crashing the XAML designer
}
}
private void DeliveryAddress_TextChanged(object sender, TextChangedEventArgs e)
{
Expand Down
Loading