示例#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);
        }
 public void AddCheckin(Checkin checkin)
 {
     Checkins.Add(checkin);
     IsСhanges = true;
 }