0
私は多くのページを含むプロジェクトを持っています。自分のアプリケーションの状況が何であれ、定期的にデータベースに情報をインポートしたいのです。アプリケーション実行中のwp7バックグラウンドプロセス
私はApp.xaml.cs内の私のコードを入れてみましたが、それは唯一である(私は起動中に置くと、コンストラクタでみました。私の方法は
void watcher_PositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e)
{
Location loc = new GeoCoordinate(e.Position.Location.Latitude, e.Position.Location.Longitude);
//Send Data to Database
dclient.CreateUserLocationCompleted += new EventHandler<System.ComponentModel.AsyncCompletedEventArgs>(dclient_CreateUserLocationCompleted);
dclient.CreateUserLocationAsync(1, loc.Latitude, loc.Longitude);
}
のようなものであるデバイスIDの位置を取得しているに一度のためにデータを保存します
と私のウォッチャーの位置が変更され、コンストラクタ内である。
if (watcher == null)
{
watcher = new GeoCoordinateWatcher(GeoPositionAccuracy.High)
}
MovementThreshold = getSelectedDeviceLocationFrequencyFromInternalFolder();
watcher.PositionChanged += new EventHandler<GeoPositionChangedEventArgs<GeoCoordinate>>(watcher_PositionChanged);
watcher.Start();
とApp.xaml.cs
内でグローバルに定義されたどのように私は定期的にすべて目にこれを実行することができますプログラム実行中の時間?その他の方法で ?ありがとうございます(要約すると、データベースに定期的に位置情報を挿入します)。