private async Task SyncGeodatabase() { // Return if not ready. if (_readyForEdits != EditState.Ready) { return; } // Disable the sync button. SyncButton.IsEnabled = false; // Create parameters for the sync task. SyncGeodatabaseParameters parameters = new SyncGeodatabaseParameters() { GeodatabaseSyncDirection = SyncDirection.Bidirectional, RollbackOnFailure = false }; // Get the layer ID for each feature table in the geodatabase, then add to the sync job. foreach (GeodatabaseFeatureTable table in _resultGdb.GeodatabaseFeatureTables) { // Get the ID for the layer. long id = table.ServiceLayerId; // Create the SyncLayerOption. SyncLayerOption option = new SyncLayerOption(id); // Add the option. parameters.LayerOptions.Add(option); } // Create job. SyncGeodatabaseJob job = _gdbSyncTask.SyncGeodatabase(parameters, _resultGdb); // Subscribe to progress updates. job.ProgressChanged += (o, e) => { // Update the progress bar. UpdateProgressBar(job.Progress); }; // Show the progress bar. GenerateSyncProgressBar.Visibility = Visibility.Visible; // Start the sync. job.Start(); // Wait for the result. await job.GetResultAsync(); // Hide the progress bar. GenerateSyncProgressBar.Visibility = Visibility.Collapsed; // Do the remainder of the work. HandleSyncCompleted(job); // Re-enable the sync button. SyncButton.IsEnabled = true; }
private async Task SyncGeodatabase() { // Return if not ready. if (_readyForEdits != EditState.Ready) { return; } // Disable the sync button. _syncButton.Enabled = false; // Disable editing. _myMapView.GeoViewTapped -= GeoViewTapped; // Show the progress bar. _progressBar.Hidden = false; // Create parameters for the sync task. SyncGeodatabaseParameters parameters = new SyncGeodatabaseParameters { GeodatabaseSyncDirection = SyncDirection.Bidirectional, RollbackOnFailure = false }; // Get the layer Id for each feature table in the geodatabase, then add to the sync job. foreach (GeodatabaseFeatureTable table in _resultGdb.GeodatabaseFeatureTables) { // Get the ID for the layer. long id = table.ServiceLayerId; // Create the SyncLayerOption. SyncLayerOption option = new SyncLayerOption(id); // Add the option. parameters.LayerOptions.Add(option); } // Create job. _gdbSyncJob = _gdbSyncTask.SyncGeodatabase(parameters, _resultGdb); // Subscribe to progress updates. _gdbSyncJob.ProgressChanged += Job_ProgressChanged; // Start the sync. _gdbSyncJob.Start(); // Get the result. await _gdbSyncJob.GetResultAsync(); // Do the rest of the work. HandleSyncCompleted(_gdbSyncJob); }
private void syncGeodatabase() { // 同期ジョブオブヘジェクトを作成する syncJob = geodatabaseSyncTask.SyncGeodatabase(syncParams, geodatabase); syncJob.JobChanged += (s, e) => { // 同期ジョブが終了したときのステータスを検査する if (syncJob.Status == JobStatus.Succeeded) { // 同期完了から返された値を取得する var result = syncJob.GetResultAsync(); if (result != null) { // 同期結果を確認して、例えばユーザに通知する処理を作成します ShowStatusMessage(result.Status.ToString()); } } else if (syncJob.Status == JobStatus.Failed) { // エラーの場合 ShowStatusMessage(syncJob.Error.Message); } else { var statusMessage = ""; var m = from msg in syncJob.Messages select msg.Message; statusMessage += ": " + string.Join <string>("\n", m); Console.WriteLine(statusMessage); } }; syncJob.ProgressChanged += ((object sender, EventArgs e) => { this.Dispatcher.Invoke(() => { MyProgressBar.Value = syncJob.Progress / 1.0; }); }); // geodatabase 同期のジョブを開始します syncJob.Start(); }
private void SyncGeodatabase() { // Return if not ready if (_readyForEdits != EditState.Ready) { return; } // Create parameters for the sync task SyncGeodatabaseParameters parameters = new SyncGeodatabaseParameters() { GeodatabaseSyncDirection = SyncDirection.Bidirectional, RollbackOnFailure = false }; // Get the layer Id for each feature table in the geodatabase, then add to the sync job foreach (GeodatabaseFeatureTable table in _resultGdb.GeodatabaseFeatureTables) { // Get the ID for the layer long id = table.ServiceLayerId; // Create the SyncLayerOption SyncLayerOption option = new SyncLayerOption(id); // Add the option parameters.LayerOptions.Add(option); } // Create job SyncGeodatabaseJob job = _gdbSyncTask.SyncGeodatabase(parameters, _resultGdb); // Subscribe to status updates job.JobChanged += Job_JobChanged; // Subscribe to progress updates job.ProgressChanged += Job_ProgressChanged; // Start the sync job.Start(); }
private void SyncGeodatabase() { // Return if not ready if (_readyForEdits != EditState.Ready) { return; } // 同期タスクのパラメータを作成する SyncGeodatabaseParameters parameters = new SyncGeodatabaseParameters() { GeodatabaseSyncDirection = SyncDirection.Bidirectional, RollbackOnFailure = false }; // ジオデータベース内の各フィーチャテーブルのレイヤー ID を取得してから、同期ジョブに追加する foreach (GeodatabaseFeatureTable table in _resultGdb.GeodatabaseFeatureTables) { // レイヤーのIDを取得する long id = table.ServiceLayerId; // CSyncLayerOption を作成する SyncLayerOption option = new SyncLayerOption(id); // オプションを追加する parameters.LayerOptions.Add(option); } // ジョブを作成する SyncGeodatabaseJob job = _gdbSyncTask.SyncGeodatabase(parameters, _resultGdb); // ステータス更新 job.JobChanged += Job_JobChanged; // プログレスバーの更新 job.ProgressChanged += Job_ProgressChanged; // 同期を開始する job.Start(); }