예제 #1
0
        private void SavePhoto(string soursePath, string targetPath, Checkin checkin)
        {
            Image        image        = Image.FromFile(soursePath);
            PropertyItem propertyItem = image.PropertyItems[0];

            FileHelper.SetProperty(propertyItem, FileHelper.ExifImageDateTimeOriginal, checkin.CreatedDate.ToString("yyyy/MM/dd"));
            image.SetPropertyItem(propertyItem);
            image.Save(targetPath);
        }
예제 #2
0
 private void DownloadFiles(Checkin checkin)
 {
     DownloadFile(checkin.UrlPhoto, untappdService.GetCheckinPhotoFilePath(checkin));
     DownloadFile(checkin.Beer.LabelUrl, untappdService.GetBeerLabelFilePath(checkin.Beer));
     DownloadFile(checkin.Beer.Brewery.LabelUrl, untappdService.GetBreweryLabelFilePath(checkin.Beer.Brewery));
     foreach (Badge badge in checkin.Badges)
     {
         DownloadFile(badge.ImageUrl, untappdService.GetBadgeImageFilePath(badge));
     }
 }
예제 #3
0
        private async void UploadProjectPhotosAsync(List <long> checkinIds, string uploadDirectory)
        {
            for (int i = 0; i < checkinIds.Count; i++)
            {
                Checkin checkin = untappdService.GetCheckin(checkinIds[i]);
                if (checkin == null || String.IsNullOrEmpty(checkin.UrlPhoto))
                {
                    continue;
                }

                string message = $"{Properties.Resources.Loading} {i + 1}/{checkinIds.Count}: {checkin.UrlPhoto}";
                interactionRequestService.ShowMessageOnStatusBar(message);
                await Task.Run(() => UploadCheckinPhoto(checkin, uploadDirectory));
            }
            interactionRequestService.ShowMessageOnStatusBar(CommunicationHelper.GetLoadingMessage(untappdService.FilePath));
        }
예제 #4
0
        private void UploadCheckinPhoto(Checkin checkin, string uploadDirectory)
        {
            string photoPath = untappdService.GetCheckinPhotoFilePath(checkin);

            if (!File.Exists(photoPath))
            {
                webDownloader.DownloadFile(checkin.UrlPhoto, photoPath);
            }

            string targetPath = Path.Combine(uploadDirectory, untappdService.GetUploadSavePhotoFileName(checkin));

            if (File.Exists(targetPath))
            {
                return;
            }

            SavePhoto(photoPath, targetPath, checkin);
        }
예제 #5
0
 public void AddCheckin(Checkin checkin)
 {
     Checkins.Add(checkin);
     IsСhanges = true;
 }