개정판 adce8360
issue #932: Sync 페이지가 제대로 로딩되지 않는 부분 개선
Change-Id: Idc3764695ed1183f350e8f0358a5c36b6e0fac78
KCOM/Common/ImageSourceHelper.cs | ||
---|---|---|
55 | 55 |
} |
56 | 56 |
} |
57 | 57 |
|
58 |
public static BitmapImage GetDownloadImage(string uri) |
|
59 |
{ |
|
60 |
return GetDownloadImage(new Uri(uri)); |
|
61 |
} |
|
62 |
|
|
63 |
public static BitmapImage GetDownloadImage(Uri uri) |
|
64 |
{ |
|
65 |
BitmapImage resultImage = new BitmapImage(); |
|
66 |
|
|
67 |
resultImage.BeginInit(); |
|
68 |
resultImage.CacheOption = BitmapCacheOption.OnLoad; |
|
69 |
resultImage.UriCachePolicy = new System.Net.Cache.RequestCachePolicy(System.Net.Cache.RequestCacheLevel.Default); |
|
70 |
resultImage.UriSource = uri; |
|
71 |
resultImage.EndInit(); |
|
72 |
|
|
73 |
resultImage.DownloadProgress += (ex, arg) => |
|
74 |
{ |
|
75 |
System.Diagnostics.Debug.WriteLine($"download Image : {arg.Progress}%"); |
|
76 |
}; |
|
77 |
|
|
78 |
while (resultImage.IsDownloading) |
|
79 |
{ |
|
80 |
System.Windows.Forms.Application.DoEvents(); //Method from thread linked above |
|
81 |
System.Diagnostics.Debug.WriteLine("doEvent"); |
|
82 |
} |
|
83 |
|
|
84 |
resultImage.Freeze(); |
|
85 |
return resultImage; |
|
86 |
} |
|
87 |
|
|
58 | 88 |
public static byte[] CopyPixels(BitmapSource image) |
59 | 89 |
{ |
60 | 90 |
byte[] result = new byte[image.PixelWidth * image.PixelHeight * 4]; |
KCOM/Views/MainMenu.xaml.cs | ||
---|---|---|
4125 | 4125 |
|
4126 | 4126 |
private void SyncCompare_Click(object sender, RoutedEventArgs e) |
4127 | 4127 |
{ |
4128 |
if (CompareMode.IsChecked) |
|
4129 |
{ |
|
4130 |
if (ViewerDataModel.Instance.PageBalanceMode && ViewerDataModel.Instance.PageBalanceNumber == 0) |
|
4131 |
{ |
|
4132 |
ViewerDataModel.Instance.PageBalanceNumber = 1; |
|
4133 |
} |
|
4134 |
if (ViewerDataModel.Instance.PageNumber == 0) |
|
4135 |
{ |
|
4136 |
ViewerDataModel.Instance.PageNumber = 1; |
|
4137 |
} |
|
4138 |
|
|
4139 |
Logger.sendReqLog("GetCompareRectAsync", _ViewInfo.ProjectNO + "," + _ViewInfo.DocumentItemID + "," + CurrentRev.DOCUMENT_ID + |
|
4140 |
"," + pageNavigator.CurrentPage.PageNumber.ToString() + "," + ViewerDataModel.Instance.PageNumber.ToString() + "," + |
|
4141 |
userData.COMPANY != "EXT" ? "true" : "false", 1); |
|
4142 |
|
|
4143 |
BaseClient.GetCompareRectAsync(_ViewInfo.ProjectNO, _ViewInfo.DocumentItemID, CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber.ToString(), ViewerDataModel.Instance.PageNumber.ToString(), userData.COMPANY != "EXT" ? "true" : "false"); |
|
4144 |
} |
|
4145 |
else |
|
4146 |
{ |
|
4147 |
da.From = 1; |
|
4148 |
da.To = 1; |
|
4149 |
da.Duration = new Duration(TimeSpan.FromSeconds(9999)); |
|
4150 |
da.AutoReverse = false; |
|
4151 |
canvas_compareBorder.Children.Clear(); |
|
4152 |
canvas_compareBorder.BeginAnimation(OpacityProperty, da); |
|
4153 |
} |
|
4128 |
SetCompareRect(); |
|
4154 | 4129 |
} |
4155 | 4130 |
|
4156 | 4131 |
private void Sync_Click(object sender, RoutedEventArgs e) |
... | ... | |
4380 | 4355 |
} |
4381 | 4356 |
} |
4382 | 4357 |
|
4358 |
/// <summary> |
|
4359 |
/// Compare된 영역을 초기화 |
|
4360 |
/// </summary> |
|
4361 |
private void ClearCompareRect() |
|
4362 |
{ |
|
4363 |
da.From = 1; |
|
4364 |
da.To = 1; |
|
4365 |
da.Duration = new Duration(TimeSpan.FromSeconds(9999)); |
|
4366 |
da.AutoReverse = false; |
|
4367 |
canvas_compareBorder.Children.Clear(); |
|
4368 |
canvas_compareBorder.BeginAnimation(OpacityProperty, da); |
|
4369 |
} |
|
4370 |
|
|
4371 |
/// <summary> |
|
4372 |
/// 문서 Comprare |
|
4373 |
/// </summary> |
|
4374 |
private void SetCompareRect() |
|
4375 |
{ |
|
4376 |
if (CompareMode.IsChecked) |
|
4377 |
{ |
|
4378 |
if (ViewerDataModel.Instance.PageBalanceMode && ViewerDataModel.Instance.PageBalanceNumber == 0) |
|
4379 |
{ |
|
4380 |
ViewerDataModel.Instance.PageBalanceNumber = 1; |
|
4381 |
} |
|
4382 |
if (ViewerDataModel.Instance.PageNumber == 0) |
|
4383 |
{ |
|
4384 |
ViewerDataModel.Instance.PageNumber = 1; |
|
4385 |
} |
|
4386 |
|
|
4387 |
Logger.sendReqLog("GetCompareRectAsync", _ViewInfo.ProjectNO + "," + _ViewInfo.DocumentItemID + "," + CurrentRev.DOCUMENT_ID + |
|
4388 |
"," + pageNavigator.CurrentPage.PageNumber.ToString() + "," + ViewerDataModel.Instance.PageNumber.ToString() + "," + |
|
4389 |
userData.COMPANY != "EXT" ? "true" : "false", 1); |
|
4390 |
|
|
4391 |
BaseClient.GetCompareRectAsync(_ViewInfo.ProjectNO, _ViewInfo.DocumentItemID, CurrentRev.DOCUMENT_ID, pageNavigator.CurrentPage.PageNumber.ToString(), ViewerDataModel.Instance.PageNumber.ToString(), userData.COMPANY != "EXT" ? "true" : "false"); |
|
4392 |
} |
|
4393 |
else |
|
4394 |
{ |
|
4395 |
ClearCompareRect(); |
|
4396 |
} |
|
4397 |
} |
|
4398 |
|
|
4383 | 4399 |
private void RadButton_Click(object sender, RoutedEventArgs e) |
4384 | 4400 |
{ |
4385 | 4401 |
gridViewHistory_Busy.IsBusy = true; |
... | ... | |
4388 | 4404 |
if (instance.CommandParameter != null) |
4389 | 4405 |
{ |
4390 | 4406 |
CurrentRev = instance.CommandParameter as VPRevision; |
4391 |
BaseClient.GetSyncMarkupInfoItemsCompleted += (sen, ea) => |
|
4407 |
System.EventHandler<ServiceDeepView.GetSyncMarkupInfoItemsCompletedEventArgs> GetSyncMarkupInfoItemshandler = null; |
|
4408 |
|
|
4409 |
GetSyncMarkupInfoItemshandler = (sen, ea) => |
|
4392 | 4410 |
{ |
4393 | 4411 |
if (ea.Error == null && ea.Result != null) |
4394 | 4412 |
{ |
... | ... | |
4414 | 4432 |
|
4415 | 4433 |
Sync_Offset_Point = new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY); |
4416 | 4434 |
|
4417 |
var defaultBitmapImage_Compare = new BitmapImage(); |
|
4418 |
defaultBitmapImage_Compare.BeginInit(); |
|
4419 |
defaultBitmapImage_Compare.CacheOption = BitmapCacheOption.OnLoad; |
|
4420 |
defaultBitmapImage_Compare.UriSource = new Uri(uri); |
|
4421 |
defaultBitmapImage_Compare.EndInit(); |
|
4435 |
var defaultBitmapImage_Compare = ImageSourceHelper.GetDownloadImage(uri); |
|
4436 |
ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare; |
|
4437 |
ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth; |
|
4438 |
ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight; |
|
4439 |
zoomAndPanCanvas2.Width = defaultBitmapImage_Compare.PixelWidth; |
|
4440 |
zoomAndPanCanvas2.Height = defaultBitmapImage_Compare.PixelHeight; |
|
4422 | 4441 |
|
4423 |
if (defaultBitmapImage_Compare.IsDownloading) |
|
4424 |
{ |
|
4425 |
defaultBitmapImage_Compare.DownloadCompleted += (ex, arg) => |
|
4426 |
{ |
|
4427 |
defaultBitmapImage_Compare.Freeze(); |
|
4428 |
ViewerDataModel.Instance.ImageViewPath_C = defaultBitmapImage_Compare; |
|
4429 |
ViewerDataModel.Instance.ImageViewWidth_C = defaultBitmapImage_Compare.PixelWidth; |
|
4430 |
ViewerDataModel.Instance.ImageViewHeight_C = defaultBitmapImage_Compare.PixelHeight; |
|
4431 |
zoomAndPanCanvas2.Width = defaultBitmapImage_Compare.PixelWidth; |
|
4432 |
zoomAndPanCanvas2.Height = defaultBitmapImage_Compare.PixelHeight; |
|
4433 |
}; |
|
4434 |
} |
|
4435 | 4442 |
zoomAndPanControl2.ApplyTemplate(); |
4436 | 4443 |
zoomAndPanControl2.UpdateLayout(); |
4437 |
//syncPannelRotate(zoomAndPanControl.RotationAngle); |
|
4438 | 4444 |
if (Sync_Offset_Point != new Point(zoomAndPanControl.ContentOffsetX, zoomAndPanControl.ContentOffsetY)) |
4439 | 4445 |
{ |
4440 | 4446 |
zoomAndPanControl.ContentOffsetX = Sync_Offset_Point.X; |
... | ... | |
4451 | 4457 |
} |
4452 | 4458 |
|
4453 | 4459 |
Logger.sendResLog("GetSyncMarkupInfoItemsCompleted", "UserState : " + ea.UserState + "\r Result :" + ea.Result + "\r Cancelled :" + ea.Cancelled + "\r Error :" + ea.Error, 1); |
4460 |
|
|
4461 |
if (GetSyncMarkupInfoItemshandler != null) |
|
4462 |
{ |
|
4463 |
BaseClient.GetSyncMarkupInfoItemsCompleted -= GetSyncMarkupInfoItemshandler; |
|
4464 |
} |
|
4465 |
|
|
4466 |
ClearCompareRect(); |
|
4467 |
SetCompareRect(); |
|
4454 | 4468 |
}; |
4469 |
|
|
4470 |
/// 중복 실행이 발생하여 수정함. |
|
4471 |
BaseClient.GetSyncMarkupInfoItemsCompleted += GetSyncMarkupInfoItemshandler; |
|
4455 | 4472 |
BaseClient.GetSyncMarkupInfoItemsAsync(_ViewInfo.ProjectNO, CurrentRev.DOCUMENT_ID, _ViewInfo.UserID); |
4473 |
|
|
4456 | 4474 |
Logger.sendReqLog("GetSyncMarkupInfoItemsAsync", _ViewInfo.ProjectNO + "," + CurrentRev.DOCUMENT_ID + "," + _ViewInfo.UserID, 1); |
4457 | 4475 |
} |
4458 | 4476 |
} |
내보내기 Unified diff