private void AddSingleStrokeBasedNote(IdeationUnit strokeBasedIdea) { try { StrokeData ideaData = (StrokeData)(strokeBasedIdea.Content); List <System.Windows.Point> strokePoints = ideaData.StrokePoints; StylusPointCollection stylusPoints = new StylusPointCollection(); foreach (System.Windows.Point p in strokePoints) { StylusPoint stylusP = new StylusPoint(p.X, p.Y); stylusPoints.Add(stylusP); } Stroke newStroke = new Stroke(stylusPoints); if (!ideaData.IsErasingStroke) { newStroke.DrawingAttributes = DrawingCanvasModeSwitcher.normalDrawingAttribute.Clone(); newStroke.DrawingAttributes.Color = (System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString(ideaData.StrokeColorCode); } else { newStroke.DrawingAttributes = new DrawingAttributes(); newStroke.DrawingAttributes.Color = System.Windows.Media.Color.FromRgb(0, 0, 0); newStroke.DrawingAttributes.Width = newStroke.DrawingAttributes.Height = 30; } drawingCanvas.Strokes.Add(newStroke); } catch (Exception ex) { Utilities.UtilitiesLib.LogError(ex); } }
public void AddIdeaInBackground(IdeationUnit idea) { if (idea != null) { _ideas.Add(idea); } }
private void AddSingleIdeaGroup(IdeationUnit ideaGroup) { try { IdeaGroupUI groupUI = new IdeaGroupUI(); groupUI.setNoteID(ideaGroup.Id); groupUI.Tag = ideaGroup; groupUI.update(ideaGroup); ScatterViewItem container = new ScatterViewItem(); container.Content = groupUI; container.Background = new SolidColorBrush(System.Windows.Media.Color.FromArgb(0, 0, 0, 0)); container.Width = groupUI.Width; container.Height = groupUI.Height; container.Orientation = 0; container.CanScale = false; container.CanRotate = false; container.Center = new System.Windows.Point(ideaGroup.CenterX, ideaGroup.CenterY); groupUI.InitContainer(container); sv_MainCanvas.Items.Add(container); } catch (Exception ex) { Utilities.UtilitiesLib.LogError(ex); } }
private void AddSinglePostItNote(IdeationUnit idea, int initAngle, bool init) { try { IPostItUI addedIdeaUI = null; ScatterViewItem container = new ScatterViewItem(); PostItNote castNote = (PostItNote)idea; if (castNote.Content is Bitmap) { ImageBasedPostItUI noteUI = new ImageBasedPostItUI(); noteUI.Tag = idea; noteUI.setNoteID(castNote.Id); noteUI.update(idea); noteUI.Width = noteUI.InitWidth; noteUI.Height = noteUI.InitHeight; if (castNote.MetaData.UiBackgroundColor.Length > 0) { noteUI.setBackgroundPostItColor(castNote.MetaData.UiBackgroundColor); noteUI.approvedNewBackgroundColor(castNote.MetaData.UiBackgroundColor); } container.Content = noteUI; container.Width = noteUI.Width; container.Height = noteUI.Height; if (idea.CenterX == 0 && idea.CenterY == 0) { int centerX = (int)(container.Width / 2); int centerY = (int)(sv_MainCanvas.Height - container.Height / 2); idea.CenterX = centerX; idea.CenterY = centerY; } sv_MainCanvas.Items.Add(container); container.Center = new System.Windows.Point(idea.CenterX, idea.CenterY); container.Orientation = initAngle; container.ZIndex = 1; container.CanScale = false; addedIdeaUI = noteUI; addedIdeaUI.InitContainer(container); } if (addedIdeaUI != null) { if (init) { addedIdeaUI.startJustAddedAnimation(container.Orientation); } addedIdeaUI.noteUITranslatedEventHandler += new NoteUITranslatedEvent(noteUIManipluatedEventHandler); addedIdeaUI.noteUIDeletedEventHandler += new NoteUIDeletedEvent(noteUIDeletedEventHandler); addedIdeaUI.noteUISizeChangedListener += new NoteUISizeChangedEvent(addedIdeaUI_noteUISizeChangedListener); addedIdeaUI.colorPaletteLaunchedEventHandler += new ColorPaletteLaunchedEvent(addedIdeaUI_colorPaletteLaunchedEventHandler); } Utilities.BrainstormingEventLogger.GetInstance(dropboxGeneralNoteDownloader.Storage).UploadLogString(Utilities.BrainstormingEventLogger.getLogStr_NoteAdded(idea)); } catch (Exception ex) { Utilities.UtilitiesLib.LogError(ex); } }
public void UpdateIdeaContentInBackground(IdeationUnit idea) { if (ideaUpdatedHandler != null) { IdeationUnit existingIdea = getIdeaWithId(idea.Id); existingIdea.Content = idea.Content; } }
public void ChangeIdeaUIColor(int ideaID, string colorCode) { if (ideaUIColorChangeHandler != null) { IdeationUnit existingIdea = getIdeaWithId(ideaID); ideaUIColorChangeHandler(existingIdea, colorCode); } }
public void RestoreIdeaInBackground(IdeationUnit idea) { if (ContainIdea(idea)) { IdeationUnit existingIdea = getIdeaWithId(idea.Id); existingIdea.IsAvailable = true; _trashManager.RestoreIdeaInBackground(idea); } }
public void UpdateIdeaPositionInBackground(int ideaID, float newX, float newY) { if (ideaUpdatedHandler != null) { IdeationUnit existingIdea = getIdeaWithId(ideaID); double distance = Utilities.UtilitiesLib.distanceBetweenTwoPoints(existingIdea.CenterX, existingIdea.CenterY, newX, newY); existingIdea.CenterX = newX; existingIdea.CenterY = newY; } }
bool ContainIdea(IdeationUnit idea) { for (int i = 0; i < _ideas.Count; i++) { if (_ideas[i].Id == idea.Id) { return(true); } } return(false); }
private void noteUIManipluatedEventHandler(object sender, IdeationUnit underlyingIdea, float newX, float newY) { //auto adjust to align postit note vertically ScatterViewItem container = findNoteContainerOfIdea(underlyingIdea); if (Math.Abs(container.Orientation) <= 20) { container.Orientation = 0; } TakeASnapshot(); brainstormManager.UpdateIdeaPosition(underlyingIdea.Id, newX, newY); }
public void RemoveIdeaInBackground(IdeationUnit idea) { if (idea != null) { if (ContainIdea(idea)) { IdeationUnit existingIdea = getIdeaWithId(idea.Id); existingIdea.IsAvailable = false; _trashManager.ReceiveDiscardedIdeaInBackground(idea); } } }
private void brainstormManager_ideaRestoredHandler(IdeationUnit restoredIdea) { // lock (sync) { List <IdeationUnit> oneItemList = new List <IdeationUnit>(); oneItemList.Add(restoredIdea); addNewIdeaUIs(oneItemList, false); TakeASnapshot(); timelineManager.AddRESTOREChange(restoredIdea.Id); Utilities.BrainstormingEventLogger.GetInstance(dropboxGeneralNoteDownloader.Storage).UploadLogString(Utilities.BrainstormingEventLogger.getLogStr_NoteRestored(restoredIdea)); } }
public void UpdateIdeaContent(IdeationUnit idea) { if (ideaUpdatedHandler != null) { IdeationUnit existingIdea = getIdeaWithId(idea.Id); existingIdea.Content = idea.Content; if (ideaUpdatedHandler != null) { ideaUpdatedHandler(existingIdea, IdeationUnit.IdeaUpdateType.Content); } } }
public void HandleComingIdea(IdeationUnit idea) { if (!ContainIdea(idea)) { AddIdea(idea); } else { RestoreIdea(idea); UpdateIdeaContent(idea); } }
private ScatterViewItem findNoteContainerOfIdea(IdeationUnit idea) { ScatterViewItem matchedItem = null; foreach (ScatterViewItem item in sv_MainCanvas.Items) { IPostItUI noteUI = (IPostItUI)item.Content; if (noteUI.getNoteID() == idea.Id) { matchedItem = item; } } return(matchedItem); }
public void RestoreIdea(IdeationUnit idea) { if (ContainIdea(idea)) { IdeationUnit existingIdea = getIdeaWithId(idea.Id); if (!existingIdea.IsAvailable) { existingIdea.IsAvailable = true; if (ideaRestoredHandler != null) { ideaRestoredHandler(existingIdea); } } } }
private void removeNoteUI(IdeationUnit associatedIdea) { this.Dispatcher.Invoke(new Action <IdeationUnit>((ideaToDel) => { try { ScatterViewItem ideaContainer = findNoteContainerOfIdea(ideaToDel); sv_MainCanvas.Items.Remove(ideaContainer); Utilities.BrainstormingEventLogger.GetInstance(dropboxGeneralNoteDownloader.Storage).UploadLogString(Utilities.BrainstormingEventLogger.getLogStr_NoteDeleted(associatedIdea)); } catch (Exception ex) { Utilities.UtilitiesLib.LogError(ex); } }), new object[] { associatedIdea }); }
public void AddIdea(IdeationUnit idea) { if (idea != null) { _ideas.Add(idea); if (ideaAddedEventHandler != null) { ideaAddedEventHandler(idea); } } if (__prevIdea == idea) { Debugger.Break(); } __prevIdea = idea; }
public void RemoveIdea(IdeationUnit idea) { if (idea != null) { if (ContainIdea(idea)) { IdeationUnit existingIdea = getIdeaWithId(idea.Id); existingIdea.IsAvailable = false; if (ideaRemovedHandler != null) { ideaRemovedHandler(existingIdea); } _trashManager.ReceiveDiscardedIdea(idea); } } }
public void UpdateIdeaPosition(int ideaID, float newX, float newY) { if (ideaUpdatedHandler != null) { IdeationUnit existingIdea = getIdeaWithId(ideaID); double distance = Utilities.UtilitiesLib.distanceBetweenTwoPoints(existingIdea.CenterX, existingIdea.CenterY, newX, newY); if (distance >= Properties.Settings.Default.MinDistanceForTranslationEvent) { existingIdea.CenterX = newX; existingIdea.CenterY = newY; if (ideaUpdatedHandler != null) { ideaUpdatedHandler(existingIdea, IdeationUnit.IdeaUpdateType.Position); } } } }
void brainstormManager_ideaUIColorChangeHandler(IdeationUnit updatedIdea, string colorCode) { TakeASnapshot(); timelineManager.AddCOLORChange(updatedIdea.Id, colorCode); }
private void noteUIDeletedEventHandler(object sender, IdeationUnit associatedIdea) { brainstormManager.RemoveIdea(associatedIdea); }
void addedIdeaUI_noteUISizeChangedListener(object sender, IdeationUnit associatedIdea, float scaleX, float scaleY) { TakeASnapshot(); Utilities.BrainstormingEventLogger.GetInstance(dropboxGeneralNoteDownloader.Storage).UploadLogString(Utilities.BrainstormingEventLogger.getLogStr_NoteSizeChanged(associatedIdea, scaleX, scaleY)); }