예제 #1
0
        private void OnPositionChanged(Geolocator geolocator, PositionChangedEventArgs args)
        {
            if (App.RunningInBackground)
            {
                var toast = new Microsoft.Phone.Shell.ShellToast
                {
                    Content       = args.Position.Coordinate.Latitude.ToString("0.00"),
                    Title         = "Standort: ",
                    NavigationUri = new Uri("/MainPage.xaml", UriKind.Relative)
                };

                toast.Show();
            }
            else
            {
                Dispatcher.BeginInvoke(() =>
                {
                    Latitude.Text  = args.Position.Coordinate.Latitude.ToString("F5");
                    Longitude.Text = args.Position.Coordinate.Longitude.ToString("F5");

                    _polyline.Path.Add(args.Position.ToGeoCoodinate());

                    Map.SetView(args.Position.ToGeoCoodinate(), 16);
                });
            }
        }
예제 #2
0
    private void OnPositionChanged(Geolocator geolocator, PositionChangedEventArgs args)
    {
      if(App.RunningInBackground)
      {
        var toast = new Microsoft.Phone.Shell.ShellToast
        {
          Content = args.Position.Coordinate.Latitude.ToString("0.00"),
          Title = "Standort: ",
          NavigationUri = new Uri("/MainPage.xaml", UriKind.Relative)
        };

        toast.Show();
      }
      else
      {
        Dispatcher.BeginInvoke(() =>
        {
          Latitude.Text = args.Position.Coordinate.Latitude.ToString("F5");
          Longitude.Text = args.Position.Coordinate.Longitude.ToString("F5");

          _polyline.Path.Add(args.Position.ToGeoCoodinate());

          Map.SetView(args.Position.ToGeoCoodinate(), 16);
        });
      }
    }
예제 #3
0
        /// <summary>
        /// Agent that runs a scheduled task
        /// </summary>
        /// <param name="task">
        /// The invoked task
        /// </param>
        /// <remarks>
        /// This method is called when a periodic or resource intensive task is invoked
        /// </remarks>
        protected async override void OnInvoke(ScheduledTask task)
        {
            string message = "Time to Sunlight!";

            await System.Threading.Tasks.Task.Delay(1);


            count += 1;
            Microsoft.Phone.Shell.ShellToast toast = new Microsoft.Phone.Shell.ShellToast();
            toast.Content = message + count.ToString();
            toast.Title   = "vitaminD";
            //toast.NavigationUri = new System.Uri("/Views/SourceView.xaml?name=sun&home=Main", System.UriKind.Relative);
            toast.Show();

            ////option tile lockscreen
            Microsoft.Phone.Shell.ShellTile tile = Microsoft.Phone.Shell.ShellTile.ActiveTiles.FirstOrDefault();
            var data = new Microsoft.Phone.Shell.StandardTileData();

            data.Count       = count;
            data.BackContent = string.Format("TIME'S UP! Go out there and take a bit of sunlight");
            tile.Update(data);


#if (DEBUG_AGENT)
            ScheduledActionService.LaunchForTest(task.Name, System.TimeSpan.FromSeconds(10));
#endif
            NotifyComplete();
        }
예제 #4
0
 protected override void OnInvoke(ScheduledTask task)
 {
     Microsoft.Phone.Shell.ShellToast toast = new Microsoft.Phone.Shell.ShellToast();
     toast.Content       = "TIME'S UP! GO AROUND";
     toast.Title         = "VITAMIND";
     toast.NavigationUri = new System.Uri("MainPage.xaml", System.UriKind.Relative);
     toast.Show();
     NotifyComplete();
 }
예제 #5
0
        /// <summary>
        /// Agent that runs a scheduled task
        /// </summary>
        /// <param name="task">
        /// The invoked task
        /// </param>
        /// <remarks>
        /// This method is called when a periodic or resource intensive task is invoked
        /// </remarks>
        protected override void OnInvoke(ScheduledTask task)
        {
            //TODO: Add code to perform your task in background

            var searcher = new Searcher();

            searcher.Search(task.Description, (tweets) =>
                {
                    Microsoft.Phone.Shell.ShellToast toast = new Microsoft.Phone.Shell.ShellToast();
                    toast.Title = "New Tweets";
                    toast.Content = string.Format("{0} new tweets for {1}", tweets.Count(), task.Description);

                    toast.Show();

                    NotifyComplete();
                });
        }
예제 #6
0
        void geolocator_PositionChanged(Geolocator sender, PositionChangedEventArgs args)
        {
            var model = SetLocationCoordinates(args);

            if (App.RunningInBackground)
            {
                var toast = new Microsoft.Phone.Shell.ShellToast
                {
                    Content = model.coords.latitude + " " + model.coords.longitude,
                    Title = "Location: "
                };

                toast.Show();
            }
            if (OnPositionChanged != null)
                OnPositionChanged(this, model);
        }