/// <summary> /// Pushes a <see cref="Command"/> into the undo stack or appends it to the currently active transaction, /// if one such exists /// </summary> /// <param name="command">The command</param> /// <exception cref="exception.IrreversibleCommandDuringActiveUndoRedoTransactionException"> /// When trying to push a irreversible <see cref="Command"/> during an active transaction /// </exception> private void pushCommand(Command command) { if (IsTransactionActive) { if (!command.CanUnExecute) { throw new exception.IrreversibleCommandDuringActiveUndoRedoTransactionException( "Can not execute an irreversible command when a transaction is active"); } CompositeCommand compo = mActiveTransactions.Peek(); ObjectListProvider <Command> list = compo.ChildCommands; list.Insert(list.Count, command); command.ParentComposite = compo; } else { if (command.CanUnExecute) { mUndoStack.Push(command); if (mRedoStack.Contains(m_DirtyMarkerCommand)) { m_DirtyMarkerCommand = null; } mRedoStack.Clear(); } else { FlushCommands(); } } }
/// <summary> /// Default constructor - for system use only, /// <see cref="Property"/>s should only be created via. the <see cref="PropertyFactory"/> /// </summary> public XmlProperty() { mAttributes = new ObjectListProvider <XmlAttribute>(this, false); QNameChanged += new EventHandler <urakawa.events.property.xml.QNameChangedEventArgs>(this_qNameChanged); XmlAttributeSet += new EventHandler <urakawa.events.property.xml.XmlAttributeSetEventArgs>(this_xmlAttributeSet); }
public override bool ValueEquals(WithPresentation other) { if (!base.ValueEquals(other)) { return(false); } XmlProperty otherz = other as XmlProperty; if (otherz == null) { return(false); } if (LocalName != otherz.LocalName) { //System.Diagnostics.Debug.Fail("! ValueEquals !"); return(false); } string nsUri = GetNamespaceUri(); string nsUriOther = otherz.GetNamespaceUri(); if (nsUri != nsUriOther) { //System.Diagnostics.Debug.Fail("! ValueEquals !"); return(false); } ObjectListProvider <XmlAttribute> thisAttrs = Attributes; ObjectListProvider <XmlAttribute> otherAttrs = otherz.Attributes; if (thisAttrs.Count != otherAttrs.Count) { //System.Diagnostics.Debug.Fail("! ValueEquals !"); return(false); } foreach (XmlAttribute thisAttr in thisAttrs.ContentsAs_Enumerable) { XmlAttribute otherAttr = otherz.GetAttribute(thisAttr.LocalName, thisAttr.GetNamespaceUri()); if (otherAttr == null) { //System.Diagnostics.Debug.Fail("! ValueEquals !"); return(false); } if (otherAttr.Value != thisAttr.Value) { //System.Diagnostics.Debug.Fail("! ValueEquals !"); return(false); } } return(true); }
public void AppendMetadataTest() { //First remove any metadata with the test name mProject.Presentations.Get(0).DeleteMetadata("testAppendName"); Metadata newMeta = mProject.Presentations.Get(0).MetadataFactory.CreateMetadata(); newMeta.NameContentAttribute = new MetadataAttribute(); newMeta.NameContentAttribute.Name = "testAppendName"; ObjectListProvider <Metadata> list = mProject.Presentations.Get(0).Metadatas; list.Insert(list.Count, newMeta); System.Collections.Generic.IList <Metadata> retrMetas = mProject.Presentations.Get(0).GetMetadata("testAppendName"); Assert.AreEqual(1, retrMetas.Count, "Retrieved metadata list has wrong count"); Assert.AreEqual(retrMetas[0], newMeta, "The retrieved metadata is not the same as the added"); }
/// <summary> /// Write the child elements of a XmlProperty element. /// </summary> /// <param name="destination">The destination <see cref="XmlWriter"/></param> /// <param name="baseUri"> /// The base <see cref="Uri"/> used to make written <see cref="Uri"/>s relative, /// if <c>null</c> absolute <see cref="Uri"/>s are written /// </param> /// <param name="handler">The handler for progress</param> protected override void XukOutChildren(XmlWriter destination, Uri baseUri, IProgressHandler handler) { base.XukOutChildren(destination, baseUri, handler); ObjectListProvider <XmlAttribute> attrs = Attributes; if (attrs.Count > 0) { if (PrettyFormat) { destination.WriteStartElement(XukStrings.XmlAttributes, XukAble.XUK_NS); } foreach (XmlAttribute a in attrs.ContentsAs_Enumerable) { a.XukOut(destination, baseUri, handler); } if (PrettyFormat) { destination.WriteEndElement(); } } }
/// <summary> /// Create an empty composite command. /// </summary> public CompositeCommand() { mCommands = new ObjectListProvider <Command>(this, true); }
public AlternateContent() { m_Metadata = new ObjectListProvider <Metadata>(this, true); }
public AlternateContentProperty() { m_AlternateContents = new ObjectListProvider <AlternateContent>(this, true); m_Metadata = new ObjectListProvider <Metadata>(this, true); }
/// <summary> /// Constructor setting the associated <see cref="MediaFactory"/> /// </summary> /// <exception cref="exception.MethodParameterIsNullException"> /// Thrown when <paramref localName="fact"/> is <c>null</c> /// </exception> public SequenceMedia() { mSequence = new ObjectListProvider <Media>(this, true); Reset(); }