MainWindow.xaml - simplify static bindings
HoverLinkBehaviour - Always use BeginInvoke unless there's an explicit reason for using a sync action EnvironmentConverter - Minor inconsistencies
This commit is contained in:
parent
63d6b44f35
commit
866e3de796
@ -1,6 +1,7 @@
|
|||||||
using CefSharp.Wpf;
|
using CefSharp.Wpf;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Interactivity;
|
using System.Windows.Interactivity;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace CefSharp.MinimalExample.Wpf.Behaviours
|
namespace CefSharp.MinimalExample.Wpf.Behaviours
|
||||||
{
|
{
|
||||||
@ -27,8 +28,8 @@ namespace CefSharp.MinimalExample.Wpf.Behaviours
|
|||||||
|
|
||||||
private void OnStatusMessageChanged(object sender, StatusMessageEventArgs e)
|
private void OnStatusMessageChanged(object sender, StatusMessageEventArgs e)
|
||||||
{
|
{
|
||||||
var dp = sender as ChromiumWebBrowser;
|
var chromiumWebBrowser = sender as ChromiumWebBrowser;
|
||||||
dp.Dispatcher.Invoke(() => HoverLink = e.Value);
|
chromiumWebBrowser.Dispatcher.BeginInvoke((Action)(() => HoverLink = e.Value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
using System.Windows.Data;
|
||||||
|
|
||||||
namespace CefSharp.MinimalExample.Wpf.Converter
|
namespace CefSharp.MinimalExample.Wpf.Converter
|
||||||
{
|
{
|
||||||
class EnvironmentConverter : System.Windows.Data.IValueConverter
|
public class EnvironmentConverter : IValueConverter
|
||||||
{
|
{
|
||||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
{
|
{
|
||||||
@ -12,7 +13,7 @@ namespace CefSharp.MinimalExample.Wpf.Converter
|
|||||||
|
|
||||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
{
|
{
|
||||||
return System.Windows.Data.Binding.DoNothing;
|
return Binding.DoNothing;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,9 +7,6 @@
|
|||||||
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
|
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
|
||||||
Title="{Binding Path=Title, ElementName=Browser, Converter={StaticResource TitleConverter}}"
|
Title="{Binding Path=Title, ElementName=Browser, Converter={StaticResource TitleConverter}}"
|
||||||
WindowState="Maximized">
|
WindowState="Maximized">
|
||||||
<Window.Resources>
|
|
||||||
<cef:Cef x:Key="Cef" />
|
|
||||||
</Window.Resources>
|
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
@ -74,7 +71,7 @@
|
|||||||
<Separator Grid.Column="3" />
|
<Separator Grid.Column="3" />
|
||||||
<StatusBarItem Grid.Column="4">
|
<StatusBarItem Grid.Column="4">
|
||||||
<TextBlock HorizontalAlignment="Right" TextAlignment="Right" Grid.Column="3" VerticalAlignment="Center">
|
<TextBlock HorizontalAlignment="Right" TextAlignment="Right" Grid.Column="3" VerticalAlignment="Center">
|
||||||
Chromium: <Run Text="{Binding ChromiumVersion, Source={StaticResource Cef}, Mode=OneTime}" />, CEF: <Run Text="{Binding CefVersion, Source={StaticResource Cef}, Mode=OneTime}" />, CefSharp: <Run Text="{Binding CefSharpVersion, Source={StaticResource Cef}, Mode=OneTime}"/>, Environment: <Run Text="{Binding Converter={StaticResource EnvironmentConverter}, Mode=OneTime}"/>
|
Chromium: <Run Text="{Binding Source={x:Static cef:Cef.ChromiumVersion}, Mode=OneTime}" />, CEF: <Run Text="{Binding Source={x:Static cef:Cef.CefVersion}, Mode=OneTime}" />, CefSharp: <Run Text="{Binding Source={x:Static cef:Cef.CefSharpVersion}, Mode=OneTime}"/>, Environment: <Run Text="{Binding Converter={StaticResource EnvironmentConverter}, Mode=OneTime}"/>
|
||||||
</TextBlock>
|
</TextBlock>
|
||||||
</StatusBarItem>
|
</StatusBarItem>
|
||||||
</StatusBar>
|
</StatusBar>
|
||||||
|
Loading…
Reference in New Issue
Block a user