Пример #1
0
        private async Task OnEditCompleted(EditCompletedEventArgs args)
        {
            switch (args.CompletedType)
            {
            case EditCompletedType.Save:
                break;

            case EditCompletedType.Discard:
                await QueuedTask.Run(() => { _rowCache.Invalidate(); });

                break;

            case EditCompletedType.Operation:
                ProcessChanges(args);
                break;

            case EditCompletedType.Undo:
            case EditCompletedType.Redo:
                await QueuedTask.Run(() => { ProcessChanges(args); });

                break;

            case EditCompletedType.Reconcile:
                break;

            case EditCompletedType.Post:
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            // todo: revise
            await Task.FromResult(0);
        }
 protected Task onEditCompleted(EditCompletedEventArgs args)
 {
     //show the type and number of edits
     MessageBox.Show("Creates: " + args.Creates.Values.Sum(list => list.Count).ToString() + "\n" +
                     "Modifies: " + args.Modifies.Values.Sum(list => list.Count).ToString() + "\n" +
                     "Deletes: " + args.Deletes.Values.Sum(list => list.Count).ToString(), "Edit Completed Event");
     return(Task.FromResult(0));
 }
Пример #3
0
 protected Task onEce(EditCompletedEventArgs args)
 {
     //show number of edits
     Console.WriteLine("Creates: " + args.Creates.Values.Sum(list => list.Count).ToString());
     Console.WriteLine("Modifies: " + args.Modifies.Values.Sum(list => list.Count).ToString());
     Console.WriteLine("Deletes: " + args.Deletes.Values.Sum(list => list.Count).ToString());
     return(Task.FromResult(0));
 }
Пример #4
0
 protected Task onEditComplete(EditCompletedEventArgs args)
 {
     //show the count of features changed
     Console.WriteLine("Creates: " + args.Creates.Values.Sum(list => list.Count).ToString());
     Console.WriteLine("Modifies: " + args.Modifies.Values.Sum(list => list.Count).ToString());
     Console.WriteLine("Deletes: " + args.Deletes.Values.Sum(list => list.Count).ToString());
     return(Task.FromResult(0));
 }
        private Task <bool> OnEditCompleted(EditCompletedEventArgs arg)
        {
            //foreach (var m in arg.Creates.Keys.OfType<FeatureLayer>().Distinct())

            var results =
                $"Creates: {arg.Creates.Keys.OfType<FeatureLayer>().Distinct().Count()} \r\n" +
                $"Updates: {arg.Modifies.Keys.OfType<FeatureLayer>().Distinct().Count()}";

            MessageBox.Show(results, "Results");
            return(Task.FromResult(true));
        }
        private void HandleEditCompletedEvent(EditCompletedEventArgs args)
        {
            RecordEvent("EditCompletedEvent", args.CompletedType.ToString());
            StringBuilder adds = new StringBuilder();
            StringBuilder mods = new StringBuilder();
            StringBuilder dels = new StringBuilder();

            adds.AppendLine("Adds");
            mods.AppendLine("Modifies");
            dels.AppendLine("Deletes");

            if (args.Creates != null)
            {
                foreach (var kvp in args.Creates)
                {
                    var oids = string.Join(",", kvp.Value.Select(n => n.ToString()).ToArray());
                    adds.AppendLine($" {kvp.Key.Name} {oids}");
                }
            }
            else
            {
                adds.AppendLine("  No Adds");
            }
            if (args.Modifies != null)
            {
                foreach (var kvp in args.Modifies)
                {
                    var oids = string.Join(",", kvp.Value.Select(n => n.ToString()).ToArray());
                    mods.AppendLine($" {kvp.Key.Name} {oids}");
                }
            }
            else
            {
                mods.AppendLine("  No Modifies");
            }
            if (args.Deletes != null)
            {
                foreach (var kvp in args.Deletes)
                {
                    var oids = string.Join(",", kvp.Value.Select(n => n.ToString()).ToArray());
                    dels.AppendLine($" {kvp.Key.Name} {oids}");
                }
            }
            else
            {
                dels.AppendLine("  No Deletes");
            }
            AddEntry(adds.ToString());
            AddEntry(mods.ToString());
            AddEntry(dels.ToString());
            AddEntry("---------------------------------");
        }
Пример #7
0
        private Task OnEditCompleted(EditCompletedEventArgs args)
        {
            _msg.VerboseDebug("OnEditCompleted");

            try
            {
                return(OnEditCompletedCore(args));
            }
            catch (Exception e)
            {
                HandleError($"Error OnEditCompleted: {e.Message}", e, true);

                return(Task.FromResult(false));
            }
        }
        protected Task OnEditCompleted(EditCompletedEventArgs args)
        {
            Measurement  measurement      = _measurementList?.Sketch;
            VectorLayer  vectorLayer      = measurement?.VectorLayer;
            FeatureLayer measurementLayer = vectorLayer?.Layer;
            bool         completed        = args.Members.Select(mapMember => mapMember as FeatureLayer).Aggregate
                                                (false, (current, featureLayer)
                                                => ((featureLayer != null) && (featureLayer == measurementLayer)) || current);

            if (completed)
            {
                SketchFinished();
            }

            return(Task.FromResult(0));
        }
/// <summary>
/// Method containing actions as the result of the EditCompleted (the operation) event.
/// This method reports the total number of changed rows/features.
/// </summary>
/// <param name="editArgs">Argument containing the layers where edits occurred and what types of
/// changes.</param>
/// <returns></returns>
        private Task <bool> ReportNumberOfRowsChanged(EditCompletedEventArgs editArgs)
        {
            // get the dictionary containing the modifies on the current feature
            // operation
            var editChanges = editArgs.Modifies;

            // use this variable to store the total number of modifies
            int countOfModifies = editChanges.Values.Sum(list => list.Count);

            if (countOfModifies > 0)
            {
                MessageBox.Show($"{countOfModifies.ToString()} features changed");
            }
            else
            {
                MessageBox.Show("The current edit operation did not contain any row/feature modification.");
            }

            return(Task.FromResult(true));
        }
Пример #10
0
        protected override Task OnEditCompletedCore(EditCompletedEventArgs args)
        {
            bool requiresRecalculate = args.CompletedType == EditCompletedType.Discard ||
                                       args.CompletedType == EditCompletedType.Reconcile ||
                                       args.CompletedType == EditCompletedType.Redo ||
                                       args.CompletedType == EditCompletedType.Undo;

            if (requiresRecalculate)
            {
                QueuedTask.Run(
                    () =>
                {
                    var selectedFeatures =
                        GetApplicableSelectedFeatures(ActiveMapView).ToList();

                    CalculateDerivedGeometries(selectedFeatures, GetCancelableProgressor());

                    return(true);
                });
            }

            return(base.OnEditCompletedCore(args));
        }
Пример #11
0
        private void ProcessChanges(EditCompletedEventArgs args)
        {
            // On Undo and Redo args.Members is not empty
            //if (! args.Members.Any(member => _rowCache.CanContain(member)))
            //{
            //	return;
            //}

            // todo daro: Use GdbTableIdentity and dispose tables immediately?
            Dictionary <Table, List <long> > creates  = GetOidsByTable(args.Creates);
            Dictionary <Table, List <long> > deletes  = GetOidsByTable(args.Deletes);
            Dictionary <Table, List <long> > modifies = GetOidsByTable(args.Modifies);

            try
            {
                _rowCache.ProcessChanges(creates, deletes, modifies);
            }
            finally
            {
                Dispose(creates.Keys);
                Dispose(deletes.Keys);
                Dispose(modifies.Keys);
            }
        }
Пример #12
0
 private void Playlist_EditCompleted(object sender, EditCompletedEventArgs e)
 {
     //this.StartTime = this.Playlist.GetStartTime();
     //this.StopTime = this.Playlist.GetStopTime();
 }
 protected Task onEditCompleted(EditCompletedEventArgs args)
 {
   //show the type and number of edits
   MessageBox.Show("Creates: " + args.Creates.Values.Sum(list => list.Count).ToString() + "\n" +
                   "Modifies: " + args.Modifies.Values.Sum(list => list.Count).ToString() + "\n" +
                   "Deletes: " + args.Deletes.Values.Sum(list => list.Count).ToString(), "Edit Completed Event");
   return Task.FromResult(0);
 }
Пример #14
0
 protected virtual Task OnEditCompletedCore(EditCompletedEventArgs args)
 {
     return(Task.FromResult(true));
 }
/// <summary>
/// Method containing actions as the result of the EditCompleted (the operation) event.
/// This method reports the total number of changed rows/features.
/// </summary>
/// <param name="editArgs">Argument containing the layers where edits occurred and what types of
/// changes.</param>
/// <returns></returns>
private Task<bool> ReportNumberOfRowsChanged(EditCompletedEventArgs editArgs)
{
    // get the dictionary containing the modifies on the current feature 
    // operation 
    var editChanges = editArgs.Modifies;

    // use this variable to store the total number of modifies
    int countOfModifies = editChanges.Values.Sum(list => list.Count);

    if (countOfModifies > 0)
        MessageBox.Show($"{countOfModifies.ToString()} features changed");
    else
        MessageBox.Show("The current edit operation did not contain any row/feature modification.");

    return Task.FromResult(true);
}