//단건 폰사진 추가 완료 이벤트 핸들러 void photoChooserTask_Completed(object sender, PhotoResult e) { if (e.TaskResult == TaskResult.OK) { if (LockscreenSelector.ItemsSource.Count < Constants.LOCKSCREEN_MAX_COUNT) { using (Stream stream = e.ChosenPhoto) { JpegHelper.Save(FileHelper.GetUniqueFileName(Constants.LOCKSCREEN_IMAGE_POSTFIX), stream); } } else { MessageBox.Show(string.Format(AppResources.MsgFailAddMaxCount, Constants.LOCKSCREEN_MAX_COUNT)); } } }
void appBarIconBtnAdd_Click(object sender, EventArgs e) { if (Constants.LOCKSCREEN_MAX_COUNT - LockscreenHelper.CurrentListCount == 0) { MessageBox.Show(string.Format(AppResources.MsgFailAddMaxCount, Constants.LOCKSCREEN_MAX_COUNT)); return; } try { WriteableBitmap bitmap = new WriteableBitmap(ImgDetail.Source as BitmapImage); JpegHelper.Save(FileHelper.GetUniqueFileName(Constants.LOCKSCREEN_IMAGE_POSTFIX), bitmap); MessageBox.Show(AppResources.MsgSuccessAddLockscreen); NavigationService.GoBack(); } catch (Exception ex) { MessageBox.Show(string.Format(AppResources.MsgFailAddLockscreen, ex.Message)); } }
private void imageDownloader_ImageOpened(object sender, RoutedEventArgs e) { try { WriteableBitmap wb = new WriteableBitmap(sender as BitmapImage); JpegHelper.Save(FileHelper.GetUniqueFileName(Constants.LOCKSCREEN_IMAGE_POSTFIX), wb); downloadingItem.DownloadStatus = AppResources.ImageStatusAdded; downloadingItem.DownloadStatusCode = DownloadStatus.Completed; //다운로드 완료된 파일을 숨김 처리 AsyncCollapseDownloadItem(); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message); downloadingItem.DownloadStatus = AppResources.ImageStatusFailAdd; downloadingItem.DownloadStatusCode = DownloadStatus.SaveFailed; } finally { downloadingItem.DownloadNetwork = string.Empty; DelayStartDownload(); } }