/// <summary>
        //  Revert all pending changes for this System.ServiceModel.DomainServices.Client.DomainContext.
        /// </summary>
        public new void RejectChanges()
        {
            var changes = GetChangeSet();

            var changesRejectedArgs = new ChangedRejectedEventArgs(this, changes.AddedEntities.ToArray(), changes.ModifiedEntities.ToArray());

            base.RejectChanges();

            //find all OptionFields with rejected changes, then reset their options
            foreach(var optionsField in changes.Where(c => c as OptionsField != null))
                ((OptionsField)optionsField).SetOptions();

            _changesRejectedSubject.OnNext(changesRejectedArgs);

            if (ChangesRejected != null)
                ChangesRejected(changesRejectedArgs);
        }
Exemplo n.º 2
0
        /// <summary>
        /// If this is a generated service, when changes are rejected reload the details.
        /// TODO Optimize
        /// </summary>
        private void OnRejectChangedReloadDetails(ChangedRejectedEventArgs e)
        {
            if (!ServiceIsGenerated || !IsSelected)
                return;

            //Reset OccurDate to originalOccurDate
            OccurDate = _originalOccurDate;

            //Regenerate the Service on RejectChanges in case the generated service was part of the DomainContext 
            //and had its info cleared as part of the RejectChanges

            if (_cancelLastReloadDetails == null)
                _cancelLastReloadDetails = new Subject<bool>();
            _cancelLastReloadDetails.OnNext(true);

            LoadDetails(_cancelLastReloadDetails);
        }