Esempio n. 1
0
 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);
     }
 }
Esempio n. 2
0
 public void AddIdeaInBackground(IdeationUnit idea)
 {
     if (idea != null)
     {
         _ideas.Add(idea);
     }
 }
Esempio n. 3
0
 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);
     }
 }
Esempio n. 4
0
        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);
            }
        }
Esempio n. 5
0
 public void UpdateIdeaContentInBackground(IdeationUnit idea)
 {
     if (ideaUpdatedHandler != null)
     {
         IdeationUnit existingIdea = getIdeaWithId(idea.Id);
         existingIdea.Content = idea.Content;
     }
 }
Esempio n. 6
0
 public void ChangeIdeaUIColor(int ideaID, string colorCode)
 {
     if (ideaUIColorChangeHandler != null)
     {
         IdeationUnit existingIdea = getIdeaWithId(ideaID);
         ideaUIColorChangeHandler(existingIdea, colorCode);
     }
 }
Esempio n. 7
0
 public void RestoreIdeaInBackground(IdeationUnit idea)
 {
     if (ContainIdea(idea))
     {
         IdeationUnit existingIdea = getIdeaWithId(idea.Id);
         existingIdea.IsAvailable = true;
         _trashManager.RestoreIdeaInBackground(idea);
     }
 }
Esempio n. 8
0
 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;
     }
 }
Esempio n. 9
0
 bool ContainIdea(IdeationUnit idea)
 {
     for (int i = 0; i < _ideas.Count; i++)
     {
         if (_ideas[i].Id == idea.Id)
         {
             return(true);
         }
     }
     return(false);
 }
Esempio n. 10
0
        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);
        }
Esempio n. 11
0
 public void RemoveIdeaInBackground(IdeationUnit idea)
 {
     if (idea != null)
     {
         if (ContainIdea(idea))
         {
             IdeationUnit existingIdea = getIdeaWithId(idea.Id);
             existingIdea.IsAvailable = false;
             _trashManager.ReceiveDiscardedIdeaInBackground(idea);
         }
     }
 }
Esempio n. 12
0
 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));
     }
 }
Esempio n. 13
0
 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);
         }
     }
 }
Esempio n. 14
0
 public void HandleComingIdea(IdeationUnit idea)
 {
     if (!ContainIdea(idea))
     {
         AddIdea(idea);
     }
     else
     {
         RestoreIdea(idea);
         UpdateIdeaContent(idea);
     }
 }
Esempio n. 15
0
        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);
        }
Esempio n. 16
0
 public void RestoreIdea(IdeationUnit idea)
 {
     if (ContainIdea(idea))
     {
         IdeationUnit existingIdea = getIdeaWithId(idea.Id);
         if (!existingIdea.IsAvailable)
         {
             existingIdea.IsAvailable = true;
             if (ideaRestoredHandler != null)
             {
                 ideaRestoredHandler(existingIdea);
             }
         }
     }
 }
Esempio n. 17
0
 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 });
 }
Esempio n. 18
0
 public void AddIdea(IdeationUnit idea)
 {
     if (idea != null)
     {
         _ideas.Add(idea);
         if (ideaAddedEventHandler != null)
         {
             ideaAddedEventHandler(idea);
         }
     }
     if (__prevIdea == idea)
     {
         Debugger.Break();
     }
     __prevIdea = idea;
 }
Esempio n. 19
0
 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);
         }
     }
 }
Esempio n. 20
0
 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);
             }
         }
     }
 }
Esempio n. 21
0
 void brainstormManager_ideaUIColorChangeHandler(IdeationUnit updatedIdea, string colorCode)
 {
     TakeASnapshot();
     timelineManager.AddCOLORChange(updatedIdea.Id, colorCode);
 }
Esempio n. 22
0
 private void noteUIDeletedEventHandler(object sender, IdeationUnit associatedIdea)
 {
     brainstormManager.RemoveIdea(associatedIdea);
 }
Esempio n. 23
0
 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));
 }