public async Task<bool> TryUploadPosition(Position position) { HaventUploaded = true; bool result = await Services.TryUploadPosition(position); HaventUploaded = false; return result; }
void lstPositions_Tap(object sender, System.Windows.Input.GestureEventArgs e) { if (lstPositions.SelectedItem != null) { selectedPosition = lstPositions.SelectedItem as Position; GeoCoordinate coordinates = new GeoCoordinate(selectedPosition.Latitude, selectedPosition.Longitude); coordinates.Latitude -= 0.0002; coordinates.Longitude += 0.0002; mapPositions.Center = coordinates; mapPositions.ZoomLevel = 18; } }
public BroadcastView() { InitializeComponent(); LoadPosition(); LoadAppBar(); lstPositions.ItemContainerGenerator.ItemsChanged += ItemContainerGenerator_ItemsChanged; lstPositions.Tap += lstPositions_Tap; mapPositions.ZoomLevel = 18; image = new BitmapImage(); image.UriSource = (new Uri(App.fbProfilePicture, UriKind.Absolute)); selectedPosition = new Position(); }
private static void SetSharingContent(Position selectedPosition, string friendName) { Share.Title = "SmartGuard - " + friendName; Share.Description = "Comparte la posicion de tus amigos"; DateTime date = selectedPosition.RegisteredAt; Share.Message = String.Format(AppResources.FacebookMessageFriendPost, friendName, selectedPosition.Address, date.Date.ToString(), date.TimeOfDay.ToString(), "http://bing.com/maps/default.aspx" + "?cp=" + selectedPosition.Latitude + "~" + selectedPosition.Longitude + "&lvl=18" + "&style=r"); }
public static async Task<bool> TryUploadPosition(Position position) { return await Queries.TryInsertEntityAsync("Position", position); }
public static async void TryUploadPosition(bool intenseMode) { if (staticObjects.Address != null) { Position position = new Position(); position.Address = staticObjects.Address; position.FacebookID = SmartGuard.Store.App.fbUserID; position.Latitude = staticObjects.CurrentLatitude; position.Country = staticObjects.Country; position.City = staticObjects.City; position.Longitude = staticObjects.CurrentLongitude; position.RegisteredAt = DateTime.UtcNow; position.PartitionKey = position.FacebookID; position.RowKey = string.Format("{0:d10}", DateTime.MaxValue.Ticks - position.RegisteredAt.Ticks); bool insertSucceeded = await Services.TryUploadPosition(position); string message = string.Empty; if (insertSucceeded) message = AppResources.BroadcastView_BroadcastSucceeded; else message = AppResources.BroadcastView_BroadcastError; if (!intenseMode) await MessageBox.ShowAsync(message, AppResources.BroadcastView_Title); } else await MessageBox.ShowAsync(AppResources.LocationService_NoService, AppResources.LocationService_Title); }