Пример #1
0
        /// <summary></summary>
        /// <param name="datasetDefinition"></param>
        public PpsDataSet(PpsDataSetDefinition datasetDefinition)
        {
            this.datasetDefinition = datasetDefinition;
            this.undoSink          = new PpsUndoManagerBase();
            this.tables            = new PpsDataTable[datasetDefinition.TableDefinitions.Count];

            for (var i = 0; i < tables.Length; i++)
            {
                tables[i] = datasetDefinition.TableDefinitions[i].CreateDataTable(this);
            }

            this.tableCollection = new TableCollection(tables);
            this.properties      = new DynamicRuntimeTable(this);
            this.eventSinks      = new List <LuaTable>();
        }         // ctor
Пример #2
0
        }         // proc ClearInternal

        /// <summary>This functions starts a section without any constraint and foreign key check.</summary>
        /// <param name="disableUndoStack">Do not add to use undo stack. The undo-stack will be cut.</param>
        /// <returns></returns>
        public IDisposable BeginData(bool disableUndoStack = true)
        {
            if (deferredConstraintChecks != null)
            {
                throw new InvalidOperationException();
            }

            // detach undo sink
            var tmp = disableUndoStack && undoSink != null ? undoSink : null;

            if (tmp != null)
            {
                undoSink.ResetUndoStack();
                undoSink = null;
            }

            // start deferred contraints
            deferredConstraintChecks = new PpsDeferedConstraintCheck();
            var events = DeferedEvents();

            return(new DisposableScope(
                       () =>
            {
                // executes constaint checks
                deferredConstraintChecks.ExecuteAll();
                deferredConstraintChecks = null;

                // run events
                events?.Dispose();

                // attach undo sink
                if (tmp != null)
                {
                    undoSink = tmp;
                }
            }));
        }         // func BeginData
Пример #3
0
        }         // proc InvokeEventHandler

        #endregion

        /// <summary>Registers an undo-manager.</summary>
        /// <param name="undoSink"></param>
        public void RegisterUndoSink(IPpsUndoSink undoSink)
        {
            this.undoSink = undoSink ?? new PpsUndoManagerBase();
        }         // proc RegisterUndoSink