Пример #1
0
        public void Execute()
        {
#if DEBUG
            Console.WriteLine("CommandChangePsaiEntityProperty::Execute() _changedEntity=" + _changedEntity.Name + "   _originalEntityRef=" + _originalEntityReference + "  _originalEntitiyRef.GetHashCode()=" + _originalEntityReference.GetHashCode());
#endif
            PnxHelperz.CopyTo(_changedEntity, _originalEntityReference);

            // special case: upon change of theme id, set internal themeId of each snippet
            if (_changedEntity is Theme && ((Theme)_changedEntity).Id != ((Theme)_originalEntityCopy).Id)
            {
                foreach (Segment snippet in ((Theme)_originalEntityReference).GetSegmentsOfAllGroups())
                {
                    snippet.ThemeId = ((Theme)_changedEntity).Id;
                }
            }

            EventArgs_PsaiEntityPropertiesChanged e = new EventArgs_PsaiEntityPropertiesChanged(_originalEntityReference, _changeAffectsCompatibilites);
            e.DescriptionOfChange = _descriptionOfChange;

            EditorModel.Instance.RaiseEvent_PsaiEntityPropertyChanged(e);
        }
Пример #2
0
        public void Undo()
        {
            PnxHelperz.CopyTo(_originalEntityCopy, _originalEntityReference);

            // special case: upon change of theme id, set internal themeId of each snippet
            if (_changedEntity is Theme)
            {
                Theme changedTheme      = _changedEntity as Theme;
                Theme originalThemeCopy = _originalEntityCopy as Theme;
                if (changedTheme.Id != originalThemeCopy.Id)
                {
                    foreach (Segment snippet in ((Theme)_originalEntityReference).GetSegmentsOfAllGroups())
                    {
                        snippet.ThemeId = originalThemeCopy.Id;
                    }
                }
            }

            EventArgs_PsaiEntityPropertiesChanged e = new EventArgs_PsaiEntityPropertiesChanged(_originalEntityReference, _changeAffectsCompatibilites);

            e.DescriptionOfChange = " Undo " + this._descriptionOfChange;
            EditorModel.Instance.RaiseEvent_PsaiEntityPropertyChanged(e);
        }