public HttpResponseMessage Get(double latitude, double longitude, int index = 0) { var boundingBox = geometryService.GetBoundingBox(new Location(latitude, longitude), 2); var clock = new Stopwatch(); clock.Start(); var average = placeQuery.GetAvegarePukesPoints(); clock.Stop(); Trace.WriteLine("********Tempo AVG: " + clock.ElapsedMilliseconds); clock.Reset(); clock.Start(); var placeList = placeQuery.GetByBoundingBox(_pageSize * index, _pageSize, boundingBox) .Select(x => new PlaceRepresentation(average) { Id = x.Id, Latitude = x.Location.Latitude, Longitude = x.Location.Longitude, Name = x.Name, Vicinity = x.Vicinity, PukePoints = x.GetPukePoints() }); var result = new CollectionRepresentation <PlaceRepresentation>(placeList.ToList(), "api/Step/0", "api/Step/2"); clock.Stop(); Trace.WriteLine("********Tempo Places Found: " + clock.ElapsedMilliseconds); return(Request.CreateResponse(HttpStatusCode.OK, placeList)); }
public void ListView_DragItemsStarting(object sender, DragItemsStartingEventArgs e) { var item = e.Items[0]; Note it = item as Note; movedObject = it; objectWasMoved = false; var destinationListView = sender as ListView; var listViewItemsSource = destinationListView?.ItemsSource as ObservableCollection <Note>; source = listViewItemsSource; //Debug.WriteLine(it.header); e.Data.RequestedOperation = DataPackageOperation.Move; //CHECK IF IT'S LAST NOTE //SO YOU CAN DISPLAY X FOR REMOVING if (listViewItemsSource.Last() == movedObject) { isRemoveVisible = Visibility.Visible; } //CREATE EMPTY LISTVIEW IF SOURCE.COUNT > 1 if (listViewItemsSource.Count > 1) { if (listViewItemsSource[0] != movedObject) { var empty = new CollectionRepresentation { NoteCollection = new ObservableCollection <Note>() }; NotesCollection.Add(empty); } } }
public void SubmitNewTask() { String head = taskHeader; String cont = taskContent; DateTime output = taskDate; String valid = Validate(head, cont, output); if (valid.Equals("true")) { //UKRYJ TWORZENIE KARTECZKi isNewTaskVisible = Visibility.Collapsed; taskHeader = ""; taskContent = ""; //taskDate = ""; //STWORZ DATE ZE STRINGA //DateTime output; //DateTime.TryParseExact(dat, "dd.MM.yyyy", System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None, out output); //UTWORZ KARTECZKE int lastId = GetLastID(); Note custom = new Note { id = lastId, parentid = 0, header = head, content = cont, date = output }; //ADD #1 custom.header = custom.header + " #1"; //UTWÓRZ NOW¥ LISTE var empty = new CollectionRepresentation { NoteCollection = new ObservableCollection <Note>() }; //DODAJ KARTECZKE DO LISTY empty.NoteCollection.Add(custom); //DODAJ LISTE DO GRIDVIEW NotesCollection.Add(empty); //WYSWIETL KOMUNIKAT SUKCESU IToastText02 notification = ToastContentFactory.CreateToastText02(); notification.TextHeading.Text = "Sukces"; notification.TextBodyWrap.Text = "Utworzono now¹ karteczkê!"; notification.Duration = ToastDuration.Short; ToastNotification not = new ToastNotification(notification.GetXml()); ToastNotificationManager.CreateToastNotifier().Show(not); } else { //WYSWIETL KOMUNIKAT BLEDU IToastText02 notification = ToastContentFactory.CreateToastText02(); notification.TextHeading.Text = "B³¹d"; notification.TextBodyWrap.Text = valid; notification.Duration = ToastDuration.Short; ToastNotification not = new ToastNotification(notification.GetXml()); ToastNotificationManager.CreateToastNotifier().Show(not); } }
//LOAD DB NOTES public void ReadDatabase() { int i = 0; NotesCollection.Clear(); var query = conn.Table <Note>(); foreach (Note n in query) { if (n.parentid == 0) { var collect = new CollectionRepresentation { NoteCollection = new ObservableCollection <Note>() }; n.header = n.header + " #1"; collect.NoteCollection.Add(n); Debug.WriteLine("READ: " + n.header + " DATE: " + n.date.ToString()); int j = 2; int parentID = n.id; foreach (Note child in query) { if (child.parentid == parentID) { child.header = child.header + " #" + j++; Debug.WriteLine("READ: " + child.header + " DATE: " + child.date.ToString()); collect.NoteCollection.Add(child); } } NotesCollection.Add(collect); } i++; } Debug.WriteLine("[DB] Readed " + i + " objects!"); }