private void UpdateMap(Coworking coworking) { var lat = 55.77; var lng = 49.19; if (coworking.Lat != null) { lat = coworking.Lat.Value; } if (coworking.Lng != null) { lng = coworking.Lng.Value; } var map = new Map( MapSpan.FromCenterAndRadius( new Position(lat, lng), Distance.FromMiles(2))) { HeightRequest = 100, WidthRequest = 960, VerticalOptions = LayoutOptions.FillAndExpand }; var pin = new Pin(); pin.Label = ""; pin.Position = new Position(lat, lng); map.Pins.Add(pin); MapLayout.Children.Add(map, Constraint.Constant(0), Constraint.Constant(0), Constraint.RelativeToParent((parent) => { return(parent.Width); }), Constraint.RelativeToParent((parent) => { return(parent.Height); })); }
public void SaveCoworking(Coworking coworking) { database.InsertOrReplace(coworking); }
public void Start() { BookingCard.IsVisible = false; BookingStartedCard.IsVisible = false; BookingFinishedCard.IsVisible = false; Empty.IsVisible = true; PayCard.IsVisible = false; BeforeStart.IsVisible = false; AfterStart.IsVisible = false; //add retrieve from server /* * Booking currentBooking = new Booking(); * currentBooking.BeginDate = new DateTime(2017, 11, 18, 15, 25, 00); * currentBooking.EndDate = new DateTime(2017, 11, 18, 16, 29, 00); * currentBooking.VisitTime = new DateTime(2017, 11, 18, 15, 11, 00); * currentBooking.IsVisitConfirmed = true; * currentBooking.IsClosed = false; * Booking futureBooking = null;*/ if (DBHelper.Instance.GetToken() == null) { return; } var futureBooking = new UsersHelper().GetFutureBooking(DateTime.Now); var currentBooking = new UsersHelper().GetCurrentBooking(DateTime.Now); if (currentBooking.Status == System.Net.HttpStatusCode.Forbidden) { DBHelper.Instance.DeleteToken(); Navigation.PopAsync(); } if (currentBooking.Status == System.Net.HttpStatusCode.OK && currentBooking.Price != null && currentBooking.IsPayed == false && currentBooking.IsClosed == true && currentBooking.IsVisitConfirmed == true) { booking = currentBooking; PayCard.IsVisible = true; Empty.IsVisible = false; Price.Text = booking.Price; return; } if (currentBooking.Status == System.Net.HttpStatusCode.OK && CheckBooking(currentBooking)) { if (currentBooking.IsVisitConfirmed == true && currentBooking.IsExtendPending == false) { booking = currentBooking; coworking = new CoworkingsHelper().Get(booking.CoworkingId); UpdateContainer(coworking); StartWorkTimer(); UpdateMap(coworking); futureBooking.Status = System.Net.HttpStatusCode.NotFound; } else { futureBooking = currentBooking; } } if (futureBooking.Status == System.Net.HttpStatusCode.OK && CheckBooking(futureBooking)) { booking = futureBooking; coworking = new CoworkingsHelper().Get(booking.CoworkingId); UpdateContainer(coworking); if (futureBooking.IsVisitConfirmed == true && currentBooking.IsExtendPending == false) { StartWorkTimer(); } else { StartWaitTimer(); } UpdateMap(coworking); } }
private void LoadImage(Coworking coworking) { var image = localStorage.GetImage(coworking.Images[0].Id); coworking.UpdateDisplayImage(image); }