예제 #1
0
        /// <summary>
        /// Set an alarm/reminder for the given bus stop
        /// </summary>
        /// <param name="bs"></param>
        public void PrepareAlarm(BusStop bs)
        {
            this.ClearAlarms();

            if (bs == null) return;

            Alarm alarm = new Alarm(bs.Id)
            {
                BeginTime = DateTime.Now.AddHours(2),
                Content = "Your stop is nearing!",
                RecurrenceType = RecurrenceInterval.None,
                Sound = new Uri("/Sounds/clockring.mp3", UriKind.Relative)
            };

            ScheduledActionService.Add(alarm);
            this.Notif = alarm;
        }
예제 #2
0
        public TrackingVM(BusStop bs)
        {
            this.Context = bs;
            //this.HeaderTitle = "Bus alarm";
            //this.HeaderTitle = "bus alarm - " + this.Context.Name;
            this.HeaderTitle = this.Context.Name;
            //this.Title = this.Context.Name;
            this.Title = "stop alarm";
            this.StopName = this.Context.Name;

            TrackingVM.CurrentInstance = this;

            // Start speed tracker
            this.SpeedTracker = new SpeedTracker(TrackingPage.CurrentInstance.ThresholdSlider);
            if (LocationTracker.HasLocation)
            {
                this.SpeedTracker.AddPosition(LocationTracker.Location);
            }
        }
예제 #3
0
        /// <summary>
        /// Change the alarm's BeginTime to now
        /// </summary>
        /// <param name="bs"></param>
        public void TriggerAlarm(BusStop bs)
        {
            if (bs == null) return;

            var alarm = ScheduledActionService.Find(bs.Id) as Alarm;
            if (alarm == null) return;

            alarm.BeginTime = DateTime.Now.AddSeconds(30);
            try
            {
                ScheduledActionService.Replace(alarm);
            }
            catch
            {
                ShellToast toast = new ShellToast()
                {
                    Content = "Your stop is nearing",
                    NavigationUri = new Uri("/Pages/PanoPage.xaml", UriKind.Relative),
                    Title = "Stop Alarm"
                };
                toast.Show();
            }

            this.Notif = null;
        }
예제 #4
0
파일: BusStop.cs 프로젝트: pdz8/ms13apphack
        /// <summary>
        /// Pin the stop to the start screen. TODO: make pretty
        /// </summary>
        /// <param name="stop"></param>
        public static void PinToStart(BusStop stop)
        {
            if (stop == null) return;
            if (stop.IsPinned)
            {
                MessageBox.Show("This stop is already pinned to start.", "Whoa there", MessageBoxButton.OK);
                return;
            }

            Uri tileUri = new Uri(string.Format("/Pages/TrackingPage.xaml?{1}={0}", stop.Id, BusStop.IdQueryKey), UriKind.Relative);
            StandardTileData tileData = new StandardTileData()
            {
                Title = stop.Name,
                BackgroundImage = new Uri("/Assets/Tiles/336x336.png", UriKind.Relative)
            };

            ShellTile.Create(tileUri, tileData, false);
        }
예제 #5
0
파일: PanoVM.cs 프로젝트: pdz8/ms13apphack
 /// <summary>
 /// Add stop to recent stops
 /// </summary>
 /// <param name="stop"></param>
 public static void Push(BusStop stop)
 {
     if (stop == null) return;
     string id = stop.Id;
     if (AppSettings.RecentIds.Value.Contains(id))
     {
         AppSettings.RecentIds.Value.Remove(id);
     }
     if (AppSettings.RecentIds.Value.Count == MAX_NUM_STOPS)
     {
         AppSettings.RecentIds.Value.RemoveLast();
     }
     AppSettings.RecentIds.Value.AddFirst(id);
     AppSettings.RecentIds.Save();
     Refresh();
 }