Exemple #1
0
        private void StopUpdateButton_Click(object sender, RoutedEventArgs e)
        {
            Stop stop = _vmStops.SelectedItem as Stop;

            if (stop == null)
            {
                return;
            }

            // Update the field with the value
            _skipUpdates = true;

            //RefreshStopsFeatureLayer();

            // find the corresponding feature
            Graphic feature = _flStops.FindFeatureByOID(stop.Graphic);

            if (feature == null)
            {
                _skipUpdates = false;
                return;
            }

            // Set the status
            foreach (ItemAttribute itemAttribute in stop.UpdatableAttributes)
            {
                string alias = itemAttribute.Name;
                if (alias == null || !stop.ContainsPropertyAlias(alias))
                {
                    continue;
                }

                SetItemAttribute(stop, feature, alias, itemAttribute.Value);

                // clear the value after the update operation
                itemAttribute.Value = "";
            }

            _flStopsPending.AddFeature(feature, true);
            _flStopsPending.SaveEdits();
            //_flStopsPending.Update();

            _flStops.SaveEdits();
            _flStops.Update();

            _skipUpdates = false;
        }