static XmlElement getADDCommandXml(TimelineChange change, XmlElement parentNode) { /* * Xml node structure * <ADD NoteID=" " ContentType="[BITMAP/STROKE/GROUP]" Content=" "/> */ try { XmlElement node = parentNode.OwnerDocument.CreateElement(change.getChangeTypeString()); XmlAttribute ideaIDAttr = parentNode.OwnerDocument.CreateAttribute("NoteID"); ideaIDAttr.Value = change.ChangedIdeaID.ToString(); node.Attributes.Append(ideaIDAttr); XmlAttribute ideaContentTypeAttr = parentNode.OwnerDocument.CreateAttribute("ContentType"); XmlAttribute ideaContentAttr = parentNode.OwnerDocument.CreateAttribute("Content"); if (change.MetaData is Bitmap) { ideaContentTypeAttr.Value = "BITMAP"; ideaContentAttr.Value = PostItObjects.PostItNote.getDatatStringOfIdeaContent(change.MetaData); } else if (change.MetaData is List <int> ) { ideaContentAttr.Value = "GROUP"; } else if (change.MetaData is StrokeData) { ideaContentTypeAttr.Value = "STROKE"; ideaContentAttr.Value = (change.MetaData as StrokeData).getStringFromStrokePoints(); XmlAttribute isErasingAttr = parentNode.OwnerDocument.CreateAttribute("IsErasing"); isErasingAttr.Value = (change.MetaData as StrokeData).getStringOfIsErasingAttribute(); node.Attributes.Append(isErasingAttr); XmlAttribute strokeColorAttr = parentNode.OwnerDocument.CreateAttribute("Color"); strokeColorAttr.Value = (change.MetaData as StrokeData).StrokeColorCode; node.Attributes.Append(strokeColorAttr); } node.Attributes.Append(ideaContentTypeAttr); node.Attributes.Append(ideaContentAttr); return(node); } catch (Exception ex) { Utilities.UtilitiesLib.LogError(ex); } return(null); }
static XmlElement getUPDATECommandXml(TimelineChange change, XmlElement parentNode) { /* * Xml structure * if update position * <UPDATE NoteID=" " UpdateType="POS" X=" " Y=" " /> * if update content * <UPDATE NoteID=" " UpdateType="CONTENT" Content=" " /> */ try { XmlElement node = parentNode.OwnerDocument.CreateElement(change.getChangeTypeString()); XmlAttribute ideaIDAttr = parentNode.OwnerDocument.CreateAttribute("NoteID"); ideaIDAttr.Value = change.ChangedIdeaID.ToString(); node.Attributes.Append(ideaIDAttr); XmlAttribute updateTypeAttr = parentNode.OwnerDocument.CreateAttribute("UpdateType"); updateTypeAttr.Value = getUpdateTypeString(change.MetaData); node.Attributes.Append(updateTypeAttr); if (updateTypeAttr.Value.CompareTo("POS") == 0) { System.Windows.Point newPos = (System.Windows.Point)change.MetaData; XmlAttribute posXAttr = parentNode.OwnerDocument.CreateAttribute("X"); posXAttr.Value = newPos.X.ToString(); node.Attributes.Append(posXAttr); XmlAttribute posYAttr = parentNode.OwnerDocument.CreateAttribute("Y"); posYAttr.Value = newPos.Y.ToString(); node.Attributes.Append(posYAttr); } else if (updateTypeAttr.Value.CompareTo("CONTENT") == 0) { XmlAttribute contentAttr = parentNode.OwnerDocument.CreateAttribute("Content"); contentAttr.Value = PostItObjects.PostItNote.getDatatStringOfIdeaContent(change.MetaData); node.Attributes.Append(contentAttr); } return(node); } catch (Exception ex) { Utilities.UtilitiesLib.LogError(ex); } return(null); }
static XmlElement getDUPLICATECommandXml(TimelineChange change, XmlElement parentNode) { /* * Xml structure * <DUPLICATE RefID=" "/> */ try { XmlElement node = parentNode.OwnerDocument.CreateElement(change.getChangeTypeString()); XmlAttribute refIDAttr = parentNode.OwnerDocument.CreateAttribute("RefID"); refIDAttr.Value = change.ChangedIdeaID.ToString(); node.Attributes.Append(refIDAttr); return(node); } catch (Exception ex) { Utilities.UtilitiesLib.LogError(ex); } return(null); }
static XmlElement getCOLORCommandXml(TimelineChange change, XmlElement parentNode) { /* * Xml node structure * <COLOR NoteID=" " Color=" "/> */ try { XmlElement node = parentNode.OwnerDocument.CreateElement(change.getChangeTypeString()); XmlAttribute ideaIDAttr = parentNode.OwnerDocument.CreateAttribute("NoteID"); ideaIDAttr.Value = change.ChangedIdeaID.ToString(); node.Attributes.Append(ideaIDAttr); XmlAttribute colorAttr = parentNode.OwnerDocument.CreateAttribute("Color"); colorAttr.Value = (string)change.MetaData; node.Attributes.Append(colorAttr); return(node); } catch (Exception ex) { Utilities.UtilitiesLib.LogError(ex); } return(null); }
static XmlElement getUPDATECommandXml(TimelineChange change, XmlElement parentNode) { /* * Xml structure * if update position * <UPDATE NoteID=" " UpdateType="POS" X=" " Y=" " /> * if update content * <UPDATE NoteID=" " UpdateType="CONTENT" Content=" " /> */ try { XmlElement node = parentNode.OwnerDocument.CreateElement(change.getChangeTypeString()); XmlAttribute ideaIDAttr = parentNode.OwnerDocument.CreateAttribute("NoteID"); ideaIDAttr.Value = change.ChangedIdeaID.ToString(); node.Attributes.Append(ideaIDAttr); XmlAttribute updateTypeAttr = parentNode.OwnerDocument.CreateAttribute("UpdateType"); updateTypeAttr.Value = getUpdateTypeString(change.MetaData); node.Attributes.Append(updateTypeAttr); if (updateTypeAttr.Value.CompareTo("POS") == 0) { System.Windows.Point newPos = (System.Windows.Point)change.MetaData; XmlAttribute posXAttr = parentNode.OwnerDocument.CreateAttribute("X"); posXAttr.Value = newPos.X.ToString(); node.Attributes.Append(posXAttr); XmlAttribute posYAttr = parentNode.OwnerDocument.CreateAttribute("Y"); posYAttr.Value = newPos.Y.ToString(); node.Attributes.Append(posYAttr); } else if (updateTypeAttr.Value.CompareTo("CONTENT") == 0) { XmlAttribute contentAttr = parentNode.OwnerDocument.CreateAttribute("Content"); contentAttr.Value = PostItObjects.PostItNote.getDatatStringOfIdeaContent(change.MetaData); node.Attributes.Append(contentAttr); } return node; } catch (Exception ex) { Utilities.UtilitiesLib.LogError(ex); } return null; }
static XmlElement getRESTORECommandXml(TimelineChange change, XmlElement parentNode) { /* * Xml node structure * <RESTORE NoteID=" "/> */ try { XmlElement node = parentNode.OwnerDocument.CreateElement(change.getChangeTypeString()); XmlAttribute ideaIDAttr = parentNode.OwnerDocument.CreateAttribute("NoteID"); ideaIDAttr.Value = change.ChangedIdeaID.ToString(); node.Attributes.Append(ideaIDAttr); return node; } catch (Exception ex) { Utilities.UtilitiesLib.LogError(ex); } return null; }
static XmlElement getADDCommandXml(TimelineChange change, XmlElement parentNode) { /* * Xml node structure * <ADD NoteID=" " ContentType="[BITMAP/STROKE/GROUP]" Content=" "/> */ try { XmlElement node = parentNode.OwnerDocument.CreateElement(change.getChangeTypeString()); XmlAttribute ideaIDAttr = parentNode.OwnerDocument.CreateAttribute("NoteID"); ideaIDAttr.Value = change.ChangedIdeaID.ToString(); node.Attributes.Append(ideaIDAttr); XmlAttribute ideaContentTypeAttr = parentNode.OwnerDocument.CreateAttribute("ContentType"); XmlAttribute ideaContentAttr = parentNode.OwnerDocument.CreateAttribute("Content"); if (change.MetaData is Bitmap) { ideaContentTypeAttr.Value = "BITMAP"; ideaContentAttr.Value = PostItObjects.PostItNote.getDatatStringOfIdeaContent(change.MetaData); } else if (change.MetaData is List<int>) { ideaContentAttr.Value = "GROUP"; } else if (change.MetaData is StrokeData) { ideaContentTypeAttr.Value = "STROKE"; ideaContentAttr.Value = (change.MetaData as StrokeData).getStringFromStrokePoints(); XmlAttribute isErasingAttr = parentNode.OwnerDocument.CreateAttribute("IsErasing"); isErasingAttr.Value = (change.MetaData as StrokeData).getStringOfIsErasingAttribute(); node.Attributes.Append(isErasingAttr); XmlAttribute strokeColorAttr = parentNode.OwnerDocument.CreateAttribute("Color"); strokeColorAttr.Value = (change.MetaData as StrokeData).StrokeColorCode; node.Attributes.Append(strokeColorAttr); } node.Attributes.Append(ideaContentTypeAttr); node.Attributes.Append(ideaContentAttr); return node; } catch (Exception ex) { Utilities.UtilitiesLib.LogError(ex); } return null; }