예제 #1
0
        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;
        }
예제 #2
0
        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);
        }
예제 #3
0
        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();
        }
예제 #4
0
        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();
        }