private void DeleteParkingSpot() { Mvx.Resolve <IMvxMessenger>().Publish(new AlertMessage(mParentVM, TextSource.GetText("DeleteASpotText"), TextSource.GetText("MessageText"), TextSource.GetText("NoText"), null, new string[] { TextSource.GetText("YesText") }, () => { //delete parking here mParentVM.DeleteParkingSpot(); })); }
private void ChangeNavigationMode() { if (OverviewResumeTitle == TextSource.GetText("OverviewText")) { OverviewResumeTitle = TextSource.GetText("ResumeText"); } else { OverviewResumeTitle = TextSource.GetText("OverviewText"); } MapVM.ChangeNavigationModeCommand.Execute(); }
public SessionListViewModel() { var grouped = Service.Sessions .Values .GroupBy(slot => slot.Session.When) .OrderBy(slot => slot.Key) .Select(slot => new SessionGroup( slot.Key, slot.OrderBy(session => session.Session.Title), NavigateToSession)); Title = TextSource.GetText("Title"); GroupedList = grouped.ToList(); }
public async void Init(ParkingStatus status, int timeLeft, long startTime) { Status = status; TotalParkingTime = timeLeft; Title = startTime.UnixTimeStampToDateTime().ToString("MM/dd/yyyy"); await Task.Delay(100); OverviewResumeTitle = TextSource.GetText("OverviewText"); if (View != null) { View.ChangeBarButton(); } }
public async void Init(SearchMode mode) { this.SearchMode = mode; await Task.Delay(100); SearchTitle = SearchMode == SearchMode.Now ? TextSource.GetText("SearchingForText") : TextSource.GetText("BookForText"); if (mCacheService.SelectedVehicle == null) { Debug.WriteLine("Selected Vehicle is null. Something has gone wrong @.@ !"); } Vehicle = mCacheService.SelectedVehicle; PlateNumber = Vehicle.PlateNumber; }
private void ChangeNavigationMode() { if (OverviewResumeTitle == TextSource.GetText("OverviewText")) { OverviewResumeTitle = TextSource.GetText("ResumeText"); } else { OverviewResumeTitle = TextSource.GetText("OverviewText"); } IsNavigating = !IsNavigating; if (View != null) { View.ChangeNavigationMode(); } }
public async void Init(ParkingStatus status, bool isReadOnly) { IsReadOnly = isReadOnly; Status = status; SummaryVM = new ParkingSummaryViewModel(this, Status, mPlatformService, mApiService, mCacheService); //if (mCacheService.CurrentReservation != null) SummaryVM.Reservation = mCacheService.CurrentReservation; SummaryVM.IsReadOnly = IsReadOnly; //MapVM = new ParkingMapViewModel(this, mPlatformService, mApiService, mCacheService); SummaryVM.Init(); //MapVM.Init(); await Task.Delay(100); OverviewResumeTitle = TextSource.GetText("OverviewText"); //TotalParkingTime = (int)(long.Parse(SummaryVM.Reservation.EndTimestamp) - long.Parse(SummaryVM.Reservation.StartTimestamp)); CheckTotalParkingTime(); }
private void DoUpdate() { if (_hasStartedRealApp) { Trace.Warn("Can't update after a skip"); return; } var fileService = this.GetService <IMvxSimpleFileStoreService>(); if (!fileService.TryMove(Constants.TempSessionsFileName, Constants.SessionsFileName, true)) { ReportError(new Exception(TextSource.GetText("UnableToCopyFile"))); return; } // update is complete... so now let's update the app settings and start the app this.GetService <IApplicationSettings>().DataLastUpdatedUtc = DateTime.UtcNow; this.GetService <IConferenceStart>().StartApp(); }
private void SendReport() { if (Mode == ReportMode.CallOwner) return; if (Mode == ReportMode.PlateNumber && string.IsNullOrEmpty(PlateNumber)) { Mvx.Resolve<IMvxMessenger>().Publish(new ToastMessage(this, TextSource.GetText("PleaseFillPlateNumberText"))); return; } if ((Mode == ReportMode.PictureLeave || Mode == ReportMode.PictureRefuse) && string.IsNullOrEmpty(Problem)) { Mvx.Resolve<IMvxMessenger>().Publish(new ToastMessage(this, TextSource.GetText("PleaseFillProblemText"))); return; } Mvx.Resolve<IMvxMessenger>().Publish(new AlertMessage(this, SharedTextSource.GetText("WarningText"), SharedTextSource.GetText("ReportThisParkingText"), SharedTextSource.GetText("NoText"), null, new string[] { SharedTextSource.GetText("YesText") }, async () => { LeaveBooking(); } )); }
private void Error(Exception exception) { ReportError(TextSource.GetText("Error.Twitter") + ": " + exception.Message); IsSearching = false; }
public async void Init(bool isEditMode, string parameterObject) { Parking = !string.IsNullOrEmpty(parameterObject) ? Mvx.Resolve <IMvxJsonConverter>().DeserializeObject <OwnerParkingsResponse>(parameterObject) : null; if (mCacheService.CreateParkingRequest != null && mCacheService.CreateParkingRequest.HourlyRate != null && Parking != null) { mCacheService.CreateParkingRequest.HourlyRate = Parking.HourlyRate; mCacheService.ParkingId = Parking.ParkingId; } IsEditMode = isEditMode; if (isEditMode) { mCacheService.CurrentLat = Parking.Latitude; mCacheService.CurrentLng = Parking.Longitude; } await Task.Delay(200); Title = isEditMode ? mCacheService.TextSource.GetText("EditPageTitle") : mCacheService.TextSource.GetText("PageTitle"); ButtonTitle = isEditMode ? "Save" : "Add"; string[] TaskTitles = new string[] { TextSource.GetText("PleaseGoToText"), TextSource.GetText("GPSText"), TextSource.GetText("AccuracyText"), TextSource.GetText("PleaseSetAddressText"), TextSource.GetText("PleaseSetSizeText"), TextSource.GetText("PleaseSetCostText"), TextSource.GetText("PleaseSetCalendarText"), TextSource.GetText("ActivationText") }; for (int i = 0; i < TaskTitles.Length; i++) { var title = TaskTitles[i]; Tasks.Add(new TaskItemViewModel { Title = title, Index = i, Enabled = false, Finished = false }); } //Tasks.FirstOrDefault(x => x.Index == (int)Status).Enabled = true; if (!IsEditMode) { if (mCacheService.NextStatus != AddSpotStatus.Complete) { Tasks.FirstOrDefault(x => x.Index == (int)mCacheService.NextStatus).Enabled = true; } else { Tasks.FirstOrDefault(x => x.Index == (int)Status).Enabled = true; } } else { foreach (var task in Tasks) { task.Enabled = true; } mCacheService.CreateParkingRequest.Latitude = Parking.Latitude; mCacheService.CreateParkingRequest.Location = Parking.Location; mCacheService.CreateParkingRequest.Longitude = Parking.Longitude; //IsAddButtonEnabled = true; } }
private async void AddSpot() { var taskLeft = Tasks.FirstOrDefault(x => x.Finished == false); if (taskLeft == null) { //call api if (BaseView != null && BaseView.CheckInternetConnection()) { if (IsEditMode) { var result = await mApiService.PutParking(Mvx.Resolve <ICacheService>().CurrentUser.UserId, Parking.ParkingId); if (result != null) { //Mvx.Resolve<IMvxMessenger>().Publish(new ToastMessage(this, result.Response.Result.Equals("success") ? "Success" : string.Format("Error {0}", result.Response.ErrorCode))); if (result.Response.Status.Equals("success")) { Mvx.Resolve <IMvxMessenger>().Publish(new ToastMessage(this, result.Response.Status)); } else { Mvx.Resolve <IMvxMessenger>().Publish(new AlertMessage(this, string.Empty, string.Format("Error : {0}", result.Response.ErrorCode), "Ok", null)); } Close(this); } } else { //add new parking spot var result = await mApiService.CreateParking(Mvx.Resolve <ICacheService>().CurrentUser.UserId); if (result.Response != null) { //Mvx.Resolve<IMvxMessenger>().Publish(new ToastMessage(this, result.Response.Result.Equals("success") ? "Success" : string.Format("Error: {0}", result.Response.ErrorCode))); if (result.Response.Status.Equals("success")) { IsEditMode = true; if (Parking == null) { Parking = new OwnerParkingsResponse(); } Parking.ParkingId = result.Response.ParkingId; Mvx.Resolve <IMvxMessenger>().Publish(new ToastMessage(this, result.Response.Status)); } else { Mvx.Resolve <IMvxMessenger>().Publish(new AlertMessage(this, string.Empty, string.Format("{0}: {1}", result.Response.Status, result.Response.ErrorCode), "Ok", null)); } Close(this); } } } else { Mvx.Resolve <IMvxMessenger>().Publish(new ToastMessage(this, SharedTextSource.GetText("TurnOnInternetText"))); } } else { Mvx.Resolve <IMvxMessenger>().Publish(new ToastMessage(this, string.Format("{0} {1}", taskLeft.Title, TextSource.GetText("HasNotBeenDoneText")))); } }
private async void Navigate() { if (IsReadOnly) { return; } var parkingLat = double.Parse(Reservation.Parking.Latitude, CultureInfo.InvariantCulture); var parkingLng = double.Parse(Reservation.Parking.Longitude, CultureInfo.InvariantCulture); if (View != null) { if (mPlatformService.OS == OS.Touch) //iOS { var wazeInstalled = View.GetPreference <bool>(AppConstants.Waze); var ggMapsInstalled = View.GetPreference <bool>(AppConstants.GoogleMaps); var navmiiInstalled = View.GetPreference <bool>(AppConstants.Navmii); var options = new List <string>(); var actions = new List <Action>(); if (wazeInstalled) { options.Add(TextSource.GetText("UsingWazeText")); actions.Add(() => { if (View != null) { View.NavigateUsingWaze(parkingLat, parkingLng); } }); } if (ggMapsInstalled) { options.Add(TextSource.GetText("UsingGoogleMapsText")); actions.Add(() => { if (View != null) { View.NavigateUsingGoogleMaps(parkingLat, parkingLng); } }); } if (navmiiInstalled) { options.Add(TextSource.GetText("UsingNavmiiText")); actions.Add(() => { if (View != null) { View.NavigateUsingNavmii(parkingLat, parkingLng); } }); } options.Add(TextSource.GetText("UsingNativeMapText")); actions.Add(async() => { //mParentViewModel.ShowMapTab(); ShowViewModel <ParkingMapViewModel>(new { status = mParentViewModel.Status, timeLeft = mParentViewModel.TotalParkingTime, startTime = (Reservation != null) ? Convert.ToInt64(Reservation.StartTimestamp, CultureInfo.InvariantCulture) : 0 }); await Task.Delay(200); if (Reservation != null && Reservation.Parking != null) { Mvx.Resolve <IMvxMessenger>().Publish(new NavigateMapMessage(this, Convert.ToDouble(Reservation.Parking.Latitude, CultureInfo.InvariantCulture), Convert.ToDouble(Reservation.Parking.Longitude, CultureInfo.InvariantCulture))); } else { Mvx.Resolve <IMvxMessenger>().Publish(new NavigateMapMessage(this, 50.673859, 4.615169)); } }); if (options.Count == 1 && options.Contains(TextSource.GetText("UsingNativeMapText"))) { //mParentViewModel.ShowMapTab(); ShowViewModel <ParkingMapViewModel>(new { status = mParentViewModel.Status, timeLeft = mParentViewModel.TotalParkingTime, startTime = (Reservation != null) ? Convert.ToInt64(Reservation.StartTimestamp, CultureInfo.InvariantCulture) : 0 }); await Task.Delay(200); if (Reservation != null && Reservation.Parking != null) { Mvx.Resolve <IMvxMessenger>().Publish(new NavigateMapMessage(this, Convert.ToDouble(Reservation.Parking.Latitude, CultureInfo.InvariantCulture), Convert.ToDouble(Reservation.Parking.Longitude, CultureInfo.InvariantCulture))); } else { Mvx.Resolve <IMvxMessenger>().Publish(new NavigateMapMessage(this, 50.673859, 4.615169)); } return; } if (options.Count > 1) { Mvx.Resolve <IMvxMessenger>().Publish(new AlertMessage(this, TextSource.GetText("PleaseSelectText"), TextSource.GetText("WhichNavigationTypeText"), TextSource.GetText("CancelText"), null, options.ToArray(), actions.ToArray() )); } } else if (mPlatformService.OS == OS.Droid) //Android { if (View.GetPreference <bool>(AppConstants.Waze)) { Mvx.Resolve <IMvxMessenger>().Publish(new AlertMessage(this, TextSource.GetText("PleaseSelectText"), TextSource.GetText("WhichNavigationTypeText"), TextSource.GetText("CancelText"), null, new string[] { TextSource.GetText("UsingWazeText"), TextSource.GetText("UsingNativeMapText") }, () => { if (View != null) { View.NavigateUsingWaze(parkingLat, parkingLng); } }, async() => { ShowViewModel <ParkingMapViewModel>(new { status = mParentViewModel.Status, timeLeft = mParentViewModel.TotalParkingTime, startTime = (Reservation != null) ? Convert.ToInt64(Reservation.StartTimestamp, CultureInfo.InvariantCulture) : 0 }); await Task.Delay(200); if (Reservation != null && Reservation.Parking != null) { Mvx.Resolve <IMvxMessenger>().Publish(new NavigateMapMessage(this, Convert.ToDouble(Reservation.Parking.Latitude, CultureInfo.InvariantCulture), Convert.ToDouble(Reservation.Parking.Longitude, CultureInfo.InvariantCulture))); } else { Mvx.Resolve <IMvxMessenger>().Publish(new NavigateMapMessage(this, parkingLng, 4.615169)); } })); } else { ShowViewModel <ParkingMapViewModel>(new { status = mParentViewModel.Status, timeLeft = mParentViewModel.TotalParkingTime, startTime = (Reservation != null) ? Convert.ToInt64(Reservation.StartTimestamp, CultureInfo.InvariantCulture) : 0 }); await Task.Delay(200); if (Reservation != null && Reservation.Parking != null) { Mvx.Resolve <IMvxMessenger>().Publish(new NavigateMapMessage(this, Convert.ToDouble(Reservation.Parking.Latitude, CultureInfo.InvariantCulture), Convert.ToDouble(Reservation.Parking.Longitude, CultureInfo.InvariantCulture))); } else { Mvx.Resolve <IMvxMessenger>().Publish(new NavigateMapMessage(this, 50.673859, 4.615169)); } } } } }