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:
		@@ -1,12 +1,13 @@
 | 
			
		||||
using CefSharp.Wpf;
 | 
			
		||||
using System.Windows;
 | 
			
		||||
using System.Windows.Interactivity;
 | 
			
		||||
using System;
 | 
			
		||||
 | 
			
		||||
namespace CefSharp.MinimalExample.Wpf.Behaviours
 | 
			
		||||
{
 | 
			
		||||
    public class HoverLinkBehaviour : Behavior<ChromiumWebBrowser>
 | 
			
		||||
    {
 | 
			
		||||
        // Using a DependencyProperty as the backing store for HoverLink.  This enables animation, styling, binding, etc...
 | 
			
		||||
        // Using a DependencyProperty as the backing store for HoverLink. This enables animation, styling, binding, etc...
 | 
			
		||||
        public static readonly DependencyProperty HoverLinkProperty = DependencyProperty.Register("HoverLink", typeof(string), typeof(HoverLinkBehaviour), new PropertyMetadata(string.Empty));
 | 
			
		||||
 | 
			
		||||
        public string HoverLink
 | 
			
		||||
@@ -27,8 +28,8 @@ namespace CefSharp.MinimalExample.Wpf.Behaviours
 | 
			
		||||
        
 | 
			
		||||
        private void OnStatusMessageChanged(object sender, StatusMessageEventArgs e)
 | 
			
		||||
        {
 | 
			
		||||
            var dp = sender as ChromiumWebBrowser;
 | 
			
		||||
            dp.Dispatcher.Invoke(() => HoverLink = e.Value);
 | 
			
		||||
            var chromiumWebBrowser = sender as ChromiumWebBrowser;
 | 
			
		||||
            chromiumWebBrowser.Dispatcher.BeginInvoke((Action)(() => HoverLink = e.Value));
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,9 +1,10 @@
 | 
			
		||||
using System;
 | 
			
		||||
using System.Globalization;
 | 
			
		||||
using System.Windows.Data;
 | 
			
		||||
 | 
			
		||||
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)
 | 
			
		||||
        {
 | 
			
		||||
@@ -12,7 +13,7 @@ namespace CefSharp.MinimalExample.Wpf.Converter
 | 
			
		||||
 | 
			
		||||
        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" 
 | 
			
		||||
        Title="{Binding Path=Title, ElementName=Browser, Converter={StaticResource TitleConverter}}"
 | 
			
		||||
        WindowState="Maximized">
 | 
			
		||||
    <Window.Resources>
 | 
			
		||||
        <cef:Cef x:Key="Cef" />
 | 
			
		||||
    </Window.Resources>
 | 
			
		||||
    <Grid>
 | 
			
		||||
        <Grid.RowDefinitions>
 | 
			
		||||
            <RowDefinition Height="Auto" />
 | 
			
		||||
@@ -74,7 +71,7 @@
 | 
			
		||||
            <Separator Grid.Column="3" />
 | 
			
		||||
            <StatusBarItem Grid.Column="4">
 | 
			
		||||
                <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>
 | 
			
		||||
            </StatusBarItem>
 | 
			
		||||
        </StatusBar>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user