private async void OnFindRoutes() { IsAvailable = false; ShowProgressBar = Visibility.Visible; StatusBarText = "Processing market data ..."; var s = Stopwatch.StartNew(); var list = await Task.Run(() => Prophet.FindTradeRoutes()); s.Stop(); var ts = s.Elapsed; var elapsedTime = $"{ts.Hours:00}:{ts.Minutes:00}:{ts.Seconds:00}.{ts.Milliseconds/10:00}"; Debug.WriteLine("Processed market data in " + elapsedTime); StatusBarText = "Processed market data in " + elapsedTime; //Trips = new ObservableCollection<Trip>(EveMarketData.Instance.Trips); if (list != null) { Trips = new ObservableCollection <Trip>(list); TripView = (CollectionView)CollectionViewSource.GetDefaultView(Trips); //TripView.Filter = new Predicate<object>(x => Trips.IndexOf((Trip)x) < Settings.Default.FilterShowAmount); TripView.Refresh(); } ShowProgressBar = Visibility.Hidden; IsAvailable = true; }
public List <TripView> GetTrips() { string userId = User.Identity.GetUserId(); var AppUser = db.Users.Find(userId); var trips = AppUser.Trips; List <TripView> mytrips = new List <TripView>(); if (trips != null) { foreach (Trip trip in trips) { List <LocationEntryViewModel> levms = mapLocationEntrytoViewModel(trip); TripView tripView = new TripView() { Description = trip.Description, PlannedDuration = trip.PlannedDuration, Destination = trip.Destination, StartDate = trip.StartDate.ToString(), TripMates = trip.TripMates, TripName = trip.TripName, TripEntries = levms, TripID = trip.TripID }; mytrips.Add(tripView); } } return(mytrips); }
private void OnFilterResults(object sender) { var tx = sender as Transaction; FilterSystemStartId = tx.StartSystemId; FilterSystemEndId = tx.EndSystemId; TripView.Filter = FilterSystemPair; TripView.Refresh(); }
public List <TripView> GetUserTrips(string Username) { string userId = User.Identity.GetUserId(); var AppUser = db.Users.Find(userId); if (Username != null && Username != "") { if (!db.Users.Where(x => x.UserName == Username).FirstOrDefault().UserSettings.Safemode) { AppUser = db.Users.Where(x => x.UserName == Username).FirstOrDefault(); } else { return(null); } } var trips = AppUser.Trips; List <TripView> mytrips = new List <TripView>(); if (trips != null) { foreach (Trip trip in trips) { List <LocationEntryViewModel> levms = mapLocationEntrytoViewModel(trip); TripView tripView = new TripView() { Description = trip.Description, PlannedDuration = trip.PlannedDuration, Destination = trip.Destination, StartDate = trip.StartDate.ToString(), TripMates = trip.TripMates, TripName = trip.TripName, TripEntries = levms, TripID = trip.TripID }; mytrips.Add(tripView); } } return(mytrips); }
public IHttpActionResult createTrip(TripView tripView) { try { var userId = User.Identity.GetUserId(); var AppUser = db.Users.Find(userId); Trip trip = new Trip() { Description = tripView.Description, PlannedDuration = tripView.PlannedDuration, Destination = tripView.Destination, StartDate = DateTime.Now, TripName = tripView.TripName, TripMates = tripView.TripMates }; AppUser.Trips.Add(trip); db.SaveChanges(); return(Ok()); } catch (Exception e) { return(BadRequest(e.Message)); } }
private void OnClearFilters() { TripView.Filter = null; TripView.Refresh(); }