public EditEntryViewModel(string listId, string entryId) { UseLocation = true; ListId = listId; EntryId = entryId; if (_entry == null) { _entry = new Entry(); } if (_entryImage == null) { _entryImage = new EntryImage(); } if (string.IsNullOrEmpty(entryId)) { //Load the nearest place name, if possible var geo = this.GetService <IGeolocator>(); if (geo.CurrentPosition != null) { geo.LookupNearbyPlaces(nearestPlaceName => { if (!string.IsNullOrEmpty(nearestPlaceName) && string.IsNullOrEmpty(_entry.Store)) { _entry.Store = nearestPlaceName; RaisePropertyChanged(() => Entry); } }); } } }
protected override void OnElementChanged(ElementChangedEventArgs <Entry> e) { base.OnElementChanged(e); if (e.OldElement != null || e.NewElement == null) { return; } element = (EntryImage)this.Element; var editText = this.Control; if (!string.IsNullOrEmpty(element.Image)) { switch (element.ImageAlignment) { case ImageAlignment.Left: editText.SetCompoundDrawablesWithIntrinsicBounds(GetDrawable(element.Image), null, null, null); break; case ImageAlignment.Right: editText.SetCompoundDrawablesWithIntrinsicBounds(null, null, GetDrawable(element.Image), null); break; } } editText.CompoundDrawablePadding = 25; Control.Background.SetColorFilter(element.LineColor.ToAndroid(), PorterDuff.Mode.SrcAtop); }
public void LoadEntry() { IsLoading = true; App.Azure.GetTable <Entry>().LookupAsync(EntryId).ContinueWith(t => { var ex = t.Exception; if (t.Status == TaskStatus.RanToCompletion) { _entry = t.Result; RaisePropertyChanged(() => Entry); if (!string.IsNullOrEmpty(_entry.ImageGuid)) { App.Azure.GetTable <EntryImage>() .Where(ei => ei.ImageGuid == _entry.ImageGuid) .ToListAsync() .ContinueWith(t2 => { var ex2 = t2.Exception; if (t2.Status == TaskStatus.RanToCompletion && t2.Result.Count > 0) { _entryImage = t2.Result[0]; RaisePropertyChanged(() => EntryImage); RaisePropertyChanged(() => HasImage); } IsLoading = false; }); } else { IsLoading = false; } } else { IsLoading = false; ReportError("Could not load Item!"); } }); }
public void LoadEntry() { if (string.IsNullOrEmpty(EntryId)) { return; } IsLoading = true; App.Azure.GetTable <Entry>().LookupAsync(EntryId).ContinueWith(t => { var ex = t.Exception; if (t.Status == TaskStatus.RanToCompletion) { _entry = t.Result; RaisePropertyChanged("Entry"); App.Azure.GetTable <EntryImage>().Where(ei => ei.ImageGuid == _entry.ImageGuid).ToListAsync().ContinueWith(t2 => { var ex2 = t2.Exception; if (t2.Status == TaskStatus.RanToCompletion && t2.Result.Count > 0) { _entryImage = t2.Result[0]; RaisePropertyChanged("EntryImage"); RaisePropertyChanged("HasImage"); } }); } IsLoading = false; }); if (_entry == null) { _entry = new Entry(); } if (_entryImage == null) { _entryImage = new EntryImage(); } }