public void IntepretEvent(TimelineChange changeEvent) { switch (changeEvent.ChangeType) { case TypeOfChange.ADD: ExtractADDevent(changeEvent); break; case TypeOfChange.DELETE: ExtractREMOVEevent(changeEvent); break; case TypeOfChange.RESTORE: ExtractRESTOREevent(changeEvent); break; case TypeOfChange.UPDATE: ExtractUPDATEevent(changeEvent); break; case TypeOfChange.COLOR: ExtractCOLORChangeEvent(changeEvent); break; } }
static TimelineChange extractUPDATECommandFromXmlNode(XmlElement node) { try { TimelineChange UPDATEchange = new TimelineChange(); UPDATEchange.ChangeType = TypeOfChange.UPDATE; UPDATEchange.ChangedIdeaID = Int32.Parse(node.Attributes["NoteID"].Value, CultureInfo.InvariantCulture); string updateType = node.Attributes["UpdateType"].Value; if (updateType.CompareTo("POS") == 0) { float X = float.Parse(node.Attributes["X"].Value, CultureInfo.InvariantCulture); float Y = float.Parse(node.Attributes["Y"].Value, CultureInfo.InvariantCulture); System.Windows.Point p = new System.Windows.Point(X, Y); UPDATEchange.MetaData = p; } else if (updateType.CompareTo("CONTENT") == 0) { string contentStr = node.Attributes["Content"].Value; byte[] contentBytes = Convert.FromBase64String(contentStr); UPDATEchange.MetaData = Utilities.UtilitiesLib.BytesToBitmap(contentBytes); } return(UPDATEchange); } catch (Exception ex) { Utilities.UtilitiesLib.LogError(ex); } return(null); }
void ExtractCOLORChangeEvent(TimelineChange change) { if (COLORChangeEventExtractedHandler != null) { COLORChangeEventExtractedHandler(change.ChangedIdeaID, (string)change.MetaData); } }
void ExtractRESTOREevent(TimelineChange changeEvent) { GenericIdeationObjects.IdeationUnit idea = new PostItObjects.PostItNote(); idea.Id = changeEvent.ChangedIdeaID; if (REMOVEeventExtractedHandler != null) { RESTOREeventExtractedHandler(idea); } }
public void AddDUPLICATEChange(int refFrameID) { TimelineChange change = new TimelineChange(TypeOfChange.DUPLICATE, refFrameID, null); TimelineFrame frame = new TimelineFrame(); frame.Id = getNextFrameID(); frame.Change = change; AddFrame(frame); }
public static TimelineFrame extractTimelineFrameFromXmlNode(XmlElement node) { TimelineFrame frame = new TimelineFrame(); frame.Id = Int32.Parse(node.Attributes["ID"].Value, CultureInfo.InvariantCulture); TimelineChange change = TimelineChange.extractTimelineChangeFromXmlNode((XmlElement)node.FirstChild); frame.Change = change; return(frame); }
public void AddUPDATEContentChange(int updatedNoteID, object newContent) { if (shouldAddDUPLICATEframe()) { AddDUPLICATEChange(_currentFrame.Id); } TimelineChange change = new TimelineChange(TypeOfChange.UPDATE, updatedNoteID, newContent); TimelineFrame frame = new TimelineFrame(); frame.Id = getNextFrameID(); frame.Change = change; AddFrame(frame); }
public void AddCOLORChange(int noteID, string colorCode) { if (shouldAddDUPLICATEframe()) { AddDUPLICATEChange(_currentFrame.Id); } TimelineChange change = new TimelineChange(TypeOfChange.COLOR, noteID, colorCode); TimelineFrame frame = new TimelineFrame(); frame.Id = getNextFrameID(); frame.Change = change; AddFrame(frame); }
public void AddADDChange(GenericIdeationObjects.IdeationUnit addedIdea) { if (shouldAddDUPLICATEframe()) { AddDUPLICATEChange(_currentFrame.Id); } TimelineChange change = new TimelineChange(TypeOfChange.ADD, addedIdea.Id, addedIdea.Content); TimelineFrame frame = new TimelineFrame(); frame.Id = getNextFrameID(); frame.Change = change; AddFrame(frame); }
public void AddDELETEChange(int deletedIdeaID) { if (shouldAddDUPLICATEframe()) { AddDUPLICATEChange(_currentFrame.Id); } TimelineChange change = new TimelineChange(TypeOfChange.DELETE, deletedIdeaID, null); TimelineFrame frame = new TimelineFrame(); frame.Id = getNextFrameID(); frame.Change = change; AddFrame(frame); }
public void AddRESTOREChange(int restoredIdeaID) { if (shouldAddDUPLICATEframe()) { AddDUPLICATEChange(_currentFrame.Id); } TimelineChange change = new TimelineChange(TypeOfChange.RESTORE, restoredIdeaID, null); TimelineFrame frame = new TimelineFrame(); frame.Id = getNextFrameID(); frame.Change = change; AddFrame(frame); }
public void AddUPDATEPositionChange(int updaptedNoteID, double newX, double newY) { if (shouldAddDUPLICATEframe()) { AddDUPLICATEChange(_currentFrame.Id); } System.Windows.Point newCenter = new System.Windows.Point(newX, newY); TimelineChange change = new TimelineChange(TypeOfChange.UPDATE, updaptedNoteID, newCenter); TimelineFrame frame = new TimelineFrame(); frame.Id = getNextFrameID(); frame.Change = change; AddFrame(frame); }
static TimelineChange extractDUPLICATECommandFromXmlNode(XmlElement node) { try { TimelineChange DUPLchange = new TimelineChange(); DUPLchange.ChangeType = TypeOfChange.DUPLICATE; DUPLchange.ChangedIdeaID = Int32.Parse(node.Attributes["RefID"].Value, CultureInfo.InvariantCulture); return(DUPLchange); } catch (Exception ex) { Utilities.UtilitiesLib.LogError(ex); } return(null); }
static TimelineChange extractCOLORCommandFromXmlNode(XmlElement node) { try { TimelineChange COLORchange = new TimelineChange(); COLORchange.ChangeType = TypeOfChange.DELETE; COLORchange.ChangedIdeaID = Int32.Parse(node.Attributes["NoteID"].Value, CultureInfo.InvariantCulture); COLORchange.MetaData = node.Attributes["Color"].Value; return(COLORchange); } catch (Exception ex) { Utilities.UtilitiesLib.LogError(ex); } return(null); }
void ExtractADDevent(TimelineChange changeEvent) { GenericIdeationObjects.IdeationUnit idea = new PostItObjects.PostItNote(); //this is a short-term solution, in the future need to re-implemented more sustainably if (changeEvent.MetaData is StrokeData)//this is the addition of a stroke { idea = new PostItObjects.StrokeBasedIdea(); } idea.Id = changeEvent.ChangedIdeaID; idea.CenterX = 0; idea.CenterY = 0; idea.Content = changeEvent.MetaData; if (ADDeventExtractedHandler != null) { ADDeventExtractedHandler(idea); } }
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); }
void ExtractUPDATEevent(TimelineChange changeEvent) { if (changeEvent.MetaData is Point) { if (UPDATEPosEventExtractedHandler != null) { Point newPos = (Point)changeEvent.MetaData; UPDATEPosEventExtractedHandler(changeEvent.ChangedIdeaID, (float)newPos.X, (float)newPos.Y); } } else { if (UPDATEContentEventExtractedHandler != null) { GenericIdeationObjects.IdeationUnit idea = new PostItObjects.PostItNote(); idea.Id = changeEvent.ChangedIdeaID; idea.Content = changeEvent.MetaData; UPDATEContentEventExtractedHandler(idea); } } }
static TimelineChange extractADDCommandFromXmlNode(XmlElement node) { try { TimelineChange ADDchange = new TimelineChange(); ADDchange.ChangeType = TypeOfChange.ADD; ADDchange.ChangedIdeaID = Int32.Parse(node.Attributes["NoteID"].Value, CultureInfo.InvariantCulture); string contentType = node.Attributes["ContentType"].Value; string contentStr = node.Attributes["Content"].Value; if (contentStr.CompareTo("BITMAP") == 0) { byte[] contentBytes = Convert.FromBase64String(contentStr); ADDchange.MetaData = Utilities.UtilitiesLib.BytesToBitmap(contentBytes); } else if (contentStr.CompareTo("STROKE") == 0) { //ADDchange.MetaData = PostItObjects.StrokeBasedIdea.ParseContentFromString(contentStr); StrokeData strokeData = new StrokeData(); strokeData.ParseStrokePointsFromString(contentStr); if (node.HasAttribute("IsErasing")) { strokeData.ParseIsErasingFromString(node.Attributes["IsErasing"].Value); } if (node.HasAttribute("Color")) { strokeData.StrokeColorCode = node.Attributes["Color"].Value; } ADDchange.MetaData = strokeData; } else if (contentStr.CompareTo("GROUP") == 0) { } return(ADDchange); } 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 TimelineChange extractADDCommandFromXmlNode(XmlElement node) { try { TimelineChange ADDchange = new TimelineChange(); ADDchange.ChangeType = TypeOfChange.ADD; ADDchange.ChangedIdeaID = Int32.Parse(node.Attributes["NoteID"].Value, CultureInfo.InvariantCulture); string contentType = node.Attributes["ContentType"].Value; string contentStr = node.Attributes["Content"].Value; if (contentStr.CompareTo("BITMAP") == 0) { byte[] contentBytes = Convert.FromBase64String(contentStr); ADDchange.MetaData = Utilities.UtilitiesLib.BytesToBitmap(contentBytes); } else if (contentStr.CompareTo("STROKE") == 0) { //ADDchange.MetaData = PostItObjects.StrokeBasedIdea.ParseContentFromString(contentStr); StrokeData strokeData = new StrokeData(); strokeData.ParseStrokePointsFromString(contentStr); if (node.HasAttribute("IsErasing")) { strokeData.ParseIsErasingFromString(node.Attributes["IsErasing"].Value); } if (node.HasAttribute("Color")) { strokeData.StrokeColorCode = node.Attributes["Color"].Value; } ADDchange.MetaData = strokeData; } else if (contentStr.CompareTo("GROUP") == 0) { } return ADDchange; } catch (Exception ex) { Utilities.UtilitiesLib.LogError(ex); } return null; }
static TimelineChange extractCOLORCommandFromXmlNode(XmlElement node) { try { TimelineChange COLORchange = new TimelineChange(); COLORchange.ChangeType = TypeOfChange.DELETE; COLORchange.ChangedIdeaID = Int32.Parse(node.Attributes["NoteID"].Value, CultureInfo.InvariantCulture); COLORchange.MetaData = node.Attributes["Color"].Value; return COLORchange; } 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; }
static TimelineChange extractUPDATECommandFromXmlNode(XmlElement node) { try { TimelineChange UPDATEchange = new TimelineChange(); UPDATEchange.ChangeType = TypeOfChange.UPDATE; UPDATEchange.ChangedIdeaID = Int32.Parse(node.Attributes["NoteID"].Value, CultureInfo.InvariantCulture); string updateType = node.Attributes["UpdateType"].Value; if (updateType.CompareTo("POS") == 0) { float X = float.Parse(node.Attributes["X"].Value, CultureInfo.InvariantCulture); float Y = float.Parse(node.Attributes["Y"].Value, CultureInfo.InvariantCulture); System.Windows.Point p = new System.Windows.Point(X, Y); UPDATEchange.MetaData = p; } else if (updateType.CompareTo("CONTENT") == 0) { string contentStr = node.Attributes["Content"].Value; byte[] contentBytes = Convert.FromBase64String(contentStr); UPDATEchange.MetaData = Utilities.UtilitiesLib.BytesToBitmap(contentBytes); } return UPDATEchange; } catch (Exception ex) { Utilities.UtilitiesLib.LogError(ex); } return null; }
static TimelineChange extractRESTORECommandFromXmlNode(XmlElement node) { try { TimelineChange DELchange = new TimelineChange(); DELchange.ChangeType = TypeOfChange.RESTORE; DELchange.ChangedIdeaID = Int32.Parse(node.Attributes["NoteID"].Value, CultureInfo.InvariantCulture); return DELchange; } catch (Exception ex) { Utilities.UtilitiesLib.LogError(ex); } return null; }