mirror of https://github.com/AMT-Cheif/Stylet.git
Merge branch 'release/1.1.13'
This commit is contained in:
commit
a243366687
|
@ -1,6 +1,12 @@
|
|||
Stylet Changelog
|
||||
================
|
||||
|
||||
v1.1.13
|
||||
-------
|
||||
|
||||
- Catch possible failure inside IconToBitmapSourceConverter
|
||||
- Fix access modifier on BootstrapperBase.Launch
|
||||
|
||||
v1.1.12
|
||||
-------
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ namespace Stylet
|
|||
/// <summary>
|
||||
/// Called when the application is launched. Displays the root view.
|
||||
/// </summary>
|
||||
public override void Launch()
|
||||
protected override void Launch()
|
||||
{
|
||||
this.DisplayRootView(this.RootViewModel);
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ namespace Stylet
|
|||
/// <summary>
|
||||
/// Called when the application is launched. Should display the root view using <see cref="DisplayRootView(object)"/>
|
||||
/// </summary>
|
||||
public abstract void Launch();
|
||||
protected abstract void Launch();
|
||||
|
||||
/// <summary>
|
||||
/// Launch the root view
|
||||
|
|
|
@ -5,6 +5,7 @@ using System.Windows;
|
|||
using System.Windows.Data;
|
||||
using System.Windows.Interop;
|
||||
using System.Windows.Media.Imaging;
|
||||
using Stylet.Logging;
|
||||
|
||||
namespace Stylet.Xaml
|
||||
{
|
||||
|
@ -14,6 +15,8 @@ namespace Stylet.Xaml
|
|||
[SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1126:PrefixCallsCorrectly", Justification = "Don't agree with prefixing static method calls with the class name")]
|
||||
public class IconToBitmapSourceConverter : IValueConverter
|
||||
{
|
||||
private static readonly ILogger logger = LogManager.GetLogger(typeof(IconToBitmapSourceConverter));
|
||||
|
||||
/// <summary>
|
||||
/// Singleton instance of this converter. Usage e.g. Converter="{x:Static s:IconToBitmapSourceConverter.Instance}"
|
||||
/// </summary>
|
||||
|
@ -32,13 +35,22 @@ namespace Stylet.Xaml
|
|||
var icon = value as Icon;
|
||||
if (icon == null)
|
||||
return null;
|
||||
var bs = Imaging.CreateBitmapSourceFromHIcon(icon.Handle, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
|
||||
bs.Freeze();
|
||||
return bs;
|
||||
|
||||
try
|
||||
{
|
||||
var bs = Imaging.CreateBitmapSourceFromHIcon(icon.Handle, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
|
||||
bs.Freeze();
|
||||
return bs;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
logger.Error(e, String.Format("Error trying to call CreateBitmapSourceFromHIcon: {0}", e.Message));
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a value back. Not implemented.
|
||||
/// Converts a value back. Not supported.
|
||||
/// </summary>
|
||||
/// <param name="value">value, as produced by target</param>
|
||||
/// <param name="targetType">target type</param>
|
||||
|
@ -47,7 +59,7 @@ namespace Stylet.Xaml
|
|||
/// <returns>Converted back value</returns>
|
||||
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ namespace StyletUnitTests
|
|||
}
|
||||
|
||||
public bool LaunchCalled;
|
||||
public override void Launch()
|
||||
protected override void Launch()
|
||||
{
|
||||
this.LaunchCalled = true;
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ namespace StyletUnitTests
|
|||
[Test]
|
||||
public void ConvertBackThrows()
|
||||
{
|
||||
Assert.Throws<NotImplementedException>(() => this.converter.ConvertBack(null, null, null, null));
|
||||
Assert.Throws<NotSupportedException>(() => this.converter.ConvertBack(null, null, null, null));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue