fixed #777
This commit is contained in:
1 parent
e86f101103
commit
6ce9130b07
1 file changed
+13
-7
@@ -160,6 +160,8 @@ namespace HandyControl.Controls
|
|||||||
|
|
||||||
private DispatcherTimer _dispatcher;
|
private DispatcherTimer _dispatcher;
|
||||||
|
|
||||||
|
private bool _isLoaded;
|
||||||
|
|
||||||
#endregion Data
|
#endregion Data
|
||||||
|
|
||||||
#region ctor
|
#region ctor
|
||||||
@@ -174,7 +176,11 @@ namespace HandyControl.Controls
|
|||||||
CommandBindings.Add(new CommandBinding(ControlCommands.RotateLeft, ButtonRotateLeft_OnClick));
|
CommandBindings.Add(new CommandBinding(ControlCommands.RotateLeft, ButtonRotateLeft_OnClick));
|
||||||
CommandBindings.Add(new CommandBinding(ControlCommands.RotateRight, ButtonRotateRight_OnClick));
|
CommandBindings.Add(new CommandBinding(ControlCommands.RotateRight, ButtonRotateRight_OnClick));
|
||||||
|
|
||||||
Loaded += (s, e) => Init();
|
Loaded += (s, e) =>
|
||||||
|
{
|
||||||
|
_isLoaded = true;
|
||||||
|
Init();
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -445,7 +451,7 @@ namespace HandyControl.Controls
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void Init()
|
private void Init()
|
||||||
{
|
{
|
||||||
if (ImageSource == null || !IsLoaded) return;
|
if (ImageSource == null || !_isLoaded) return;
|
||||||
|
|
||||||
if (ImageSource.IsDownloading)
|
if (ImageSource.IsDownloading)
|
||||||
{
|
{
|
||||||
@@ -464,13 +470,13 @@ namespace HandyControl.Controls
|
|||||||
|
|
||||||
if (!_isOblique)
|
if (!_isOblique)
|
||||||
{
|
{
|
||||||
width = ImageSource.Width;
|
width = ImageSource.PixelWidth;
|
||||||
height = ImageSource.Height;
|
height = ImageSource.PixelHeight;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
width = ImageSource.Height;
|
width = ImageSource.PixelHeight;
|
||||||
height = ImageSource.Width;
|
height = ImageSource.PixelWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageWidth = width;
|
ImageWidth = width;
|
||||||
@@ -514,7 +520,7 @@ namespace HandyControl.Controls
|
|||||||
{
|
{
|
||||||
if (_dispatcher == null) return;
|
if (_dispatcher == null) return;
|
||||||
|
|
||||||
if (ImageSource == null || !IsLoaded)
|
if (ImageSource == null || !_isLoaded)
|
||||||
{
|
{
|
||||||
_dispatcher.Stop();
|
_dispatcher.Stop();
|
||||||
_dispatcher.Tick -= Dispatcher_Tick;
|
_dispatcher.Tick -= Dispatcher_Tick;
|
||||||
|
|||||||
Reference in new issue
Block a user