Example #1
0
        public void SetSelectedStation(BikeStation bs)
        {
            var oldStationData = selectedStation.BindingContext as BikeStation;

            CheckForChanges(oldStationData, bs);
            selectedStation.BindingContext = bs;
        }
Example #2
0
        public void MakeNotification(BikeStation bs, bool isPriority)
        {
            string title, msg = "";

            if (bs == null)
            {
                title = "Station Watcher expired";
                msg   = "Disabled after " + DBikesSettings.disablePollingAfter + " seconds";
            }
            else
            {
                title = bs.stationName;
                msg   = bs.available + " bikes, " + bs.free + " stations remaining";
            }
            DependencyService.Get <INotification>().Notify(title, msg, isPriority);
        }
Example #3
0
        public void CheckForChanges(BikeStation old, BikeStation stn)
        {
            if (old == null || stn == null || old.stationNumber != stn.stationNumber)
            {
                return;                 // ignore changes where station cleared, initially set, or target station changed
            }

            // if (old.available != stn.available || old.free != stn.free)       // simple "if changed"
            var isPriority = false;

            if ((stn.available <= 3 && stn.available < old.available) ||
                (stn.free <= 3 && stn.free < old.free))              // If full or almost-full, AND spots have been taken
            {
                isPriority = true;
                //Vibration.Vibrate(200);
            }
            MakeNotification(stn, isPriority);
        }
Example #4
0
 private void StationsListView_ItemSelected(object sender, SelectedItemChangedEventArgs e)
 // similar to itemtapped; but doesnt fire if this item was previously selected
 {
     BikeStation stn2 = (BikeStation)e.SelectedItem; //test
 }
Example #5
0
 private void StationsListView_ItemTapped(object sender, ItemTappedEventArgs e)
 {
     BikeStation stn2 = (BikeStation)e.Item;     //test
 }