private void UpdateUI() { Log.Debug("UpdateUI"); Application.Invoke(delegate { UpdateSelectionButtons(); var selectedPhotosetLabelColor = CurrentPhotoset.Type == PhotosetType.Album ? "red" : "gray"; labelSelectedPhotoset.LabelProp = string.Format("<span color=\"{0}\"><b>{1}</b></span>", selectedPhotosetLabelColor, CurrentPhotoset.HtmlEncodedTitle); labelPhotos.Markup = string.Format("<small>{0} - {1} of {2} Photos</small>", FirstPhoto, LastPhoto, Total); labelPages.Markup = string.Format("<small>{0} of {1} Pages</small>", Page, Pages); var pages = new ListStore(typeof(string)); comboboxPage.Model = pages; Enumerable.Range(1, int.Parse(Pages)).ToList().ForEach(p => pages.AppendValues(p.ToString())); comboboxPage.Active = int.Parse(Page) - 1; buttonPreviousPage.Sensitive = buttonFirstPage.Sensitive = Page != "1"; buttonNextPage.Sensitive = buttonLastPage.Sensitive = Page != Pages; buttonDownloadAllPages.Sensitive = Pages != "1"; scrolledwindowPhotos.Vadjustment.Value = 0; var hasPhotos = Photos.Any(); hbox5.Sensitive = hasPhotos; hboxCenter.Sensitive = hasPhotos; hboxRight.Sensitive = hasPhotos; }); photosGrid.Items = Photos; }
public async Task <bool> SaveProductAsync() { var product = new RealEstateEstateDto { Estate_TypeId = SelectedListingType?.Id, Town = new RealEstateTownDto { TownId = SelectedTown?.Id }, EstateCode = ProductName, IsHot = IsHot, Account = new RealEstateAccountDto { AccountId = App.AccountInfo.Id }, Area = Area, HouseNumber = HouseNumber, SalePrice = SalePrice, SaleUnit = new RealEstateSaleUnitDto { SaleUnitId = SelectedSaleUnit?.Id }, RentPrice = RentPrice, RentUnit = new RealEstateRentUnitDto { RentUnitId = SelectedRentUnit?.Id }, Lat = SelectedPlace?.Lat, Long = SelectedPlace?.Long, MainPinText = SelectedPlace?.StructuredFormatting?.MainText, Address = SelectedPlace?.Description, Phone = Mobile, OwnerName = OwnerName, Note = Notes }; if (ProductItemViewModel == null) { if (Photos.Any()) { foreach (var item in Photos.Where(x => x.Id == 0)) { var returnId = await ProductService.UploadMedias(item.ImageName, await item.ImageSource.GetStreamFromImageSource()); if (returnId.HasValue) { product.EstateImageIds.Add(returnId.Value); } else { await DialogService.ShowAlertAsync("Can't upload medias to server. Please retry later", "Warning", "Ok"); return(false); } } } return(await ProductService.CreateProduct(product)); } else { product.Id = ProductItemViewModel.Id; return(await ProductService.UpdateProduct(product)); } }
public void ApplyChange(Information information) { CustomApplyChange(information); information.Title = Title; information.ShortDescription = ShortDescription; information.IsCommented = IsCommented; information.IsPublished = IsPublished; information.Photos = information.Photos ?? new List <Photo>(); if (Photos != null && Photos.Any()) { foreach (var photoModel in Photos) { var photo = photoModel.Id == 0 ? null : information.Photos.FirstOrDefault(i => i.Id == photoModel.Id); if (photo == null) { photo = new Photo(); information.Photos.Add(photo); } photoModel.ApplyChange(photo); } } // TODO: допилить удаление information.Photos.Where(i => !Photos.Select(e => e.Id).Contains(i.Id)).ForEach(i => i.Published = false); }
private void UpdateUI() { Log.Debug("UpdateUI"); Application.Invoke(delegate { UpdateSelectionButtons(); this.labelPhotos.Markup = string.Format("<small>{0} - {1} of {2} Photos</small>", FirstPhoto, LastPhoto, Total); this.labelPages.Markup = string.Format("<small>{0} of {1} Pages</small>", Page, Pages); var pages = new ListStore(typeof(string)); this.comboboxPage.Model = pages; Enumerable.Range(1, int.Parse(Pages)).ToList().ForEach(p => pages.AppendValues(p.ToString())); this.comboboxPage.Active = int.Parse(Page) - 1; this.buttonPreviousPage.Sensitive = this.buttonFirstPage.Sensitive = Page != "1"; this.buttonNextPage.Sensitive = this.buttonLastPage.Sensitive = Page != Pages; this.scrolledwindowPhotos.Vadjustment.Value = 0; var hasPhotos = Photos.Any(); hbox5.Sensitive = hasPhotos; hboxCenter.Sensitive = hasPhotos; hboxRight.Sensitive = hasPhotos; }); SetupTheImageGrid(Photos); }
public PhotoRepository() { if (!Photos.Any() || !Users.Any()) { SetupTemporaryData(); SetUserDataLogin(); } }
private void CheckIfSatelliteDown() { if (Photos.Any() && Photos[0].ParsedDate.Date != DateTime.Now.Date && _alertAllowed) { DisplayAlert("Information", $"Please note that latest images were captured on: {Photos[0].ParsedDate.Date:d}. It is possible that the satellite is down.", "OK"); _alertAllowed = false; } }
private void RemovePhoto(string photo) { Photos.Remove(photo); if (!Photos.Any()) { IsImageAdded = false; } }
private async void OnDateSelected(object sender, DateChangedEventArgs e) { var newDate = e.NewDate.ToString("yyyy-MM-dd"); var newUrl = Url.DateUrl + newDate; await LoadPhotos(newUrl); Visibility = !Photos.Any(); }
private void DeletePhotoCommandExecute(int position) { IsLoading = true; if (Photos.Any()) { Photos.RemoveAt(position); PhotosCollectionChanged?.Invoke(this, EventArgs.Empty); } IsLoading = false; }
protected async override void OnAppearing() { if (!Photos.Any()) { await LoadPhotos(); } CheckIfSatelliteDown(); base.OnAppearing(); }
public Photo GetOriginalPhotoFromPhotoId(int photoId) { if (Photos != null && Photos.Any()) { var groupId = Photos.Find(p => p.Id == photoId).GroupId; return(GetOriginalPhotoFromGroupId(groupId)); } else { return(null); } }
public Photo GetBestFitPhotoFromPhotoId(int photoId, int requiredDimension) { if (Photos != null && Photos.Any()) { var groupId = Photos.Find(p => p.Id == photoId).GroupId; return(GetBestFitPhotoFromGroupId(groupId, requiredDimension)); } else { return(null); } }
public Photo GetOriginalPhotoFromGroupId(Guid groupId) { if (Photos != null && Photos.Any()) { var group = GetPhotoGroupFromGroupId(groupId); var maxDimension = group.Max(p => p.HigherDimension.Value); return(group.Find(p => p.HigherDimension.Value == maxDimension)); } else { return(null); } }
public Photo GetBestFitPhotoFromGroupId(Guid groupId, int requiredDimension) { if (Photos != null && Photos.Any()) { var group = GetPhotoGroupFromGroupId(groupId); var smallestDimensionDifference = group.Min(p => Math.Abs(p.HigherDimension.Value - requiredDimension)); return(group.Find(p => Math.Abs(p.HigherDimension.Value - requiredDimension) == smallestDimensionDifference)); } else { return(null); } }
public List <Photo> GetPhotoGroupFromGroupId(Guid groupId) { if (Photos != null && Photos.Any()) { return(Photos.GroupBy(p => p.GroupId.ToString()) .Select(g => new { Id = g.Key, Photos = g.Select(p => p).ToList() }) .Where(g => g.Id == groupId.ToString()) .FirstOrDefault() .Photos); } else { return(new List <Photo>()); } }
private async Task Refresh() { var photos = await azureService.GetAllPhotoMetadata(); if (!Photos.Any()) { foreach (var photo in photos.OrderByDescending(p => p.Timestamp)) { Photos.Add(new PhotoViewModel(photo)); } } else { var latest = Photos[0].Timestamp; foreach (var photo in photos.Where(p => p.Timestamp > latest).OrderBy(p => p.Timestamp)) { Photos.Insert(0, new PhotoViewModel(photo)); } } }
private void Save() { var photosTaken = Photos != null && Photos.Any(); if (photosTaken) { Apartment.FirstPictureUrl = Photos.First().PhotoUrl; Apartment.FirstPictureImageSource = Photos.First().Source; } HomeRankerService.InsertApartment(Apartment, Criterias); if (photosTaken && Apartment.Id != 0) { HomeRankerService.PersistPhotos(Apartment.Id, Photos.Where(n => n.PhotoId == 0), PhotosToDelete); } MessagingCenter.Send(this, "AddItem", Apartment); }
private bool IsEntriesVslid() { if (!Photos.Any()) { HandleInputError("At least one photo"); return(false); } if (string.IsNullOrEmpty(Comments)) { HandleInputError("A Comment"); return(false); } if (string.IsNullOrEmpty(SelectedArea)) { HandleInputError("An Area"); return(false); } if (string.IsNullOrEmpty(SelectedCategory)) { HandleInputError("A Category"); return(false); } if (string.IsNullOrEmpty(SelectedEvent)) { HandleInputError("An Event"); return(false); } if (string.IsNullOrEmpty(Tags)) { HandleInputError("A Tag"); return(false); } return(true); }
private void PhotosCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { ArePhotosEmpty = !Photos.Any(); }
private void OnPhotosLoadingFinished() { ArePhotosEmpty = !Photos.Any(); }