예제 #1
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);
            }
        }
예제 #2
0
 IPostItUI getIdeaUIWithId(int id)
 {
     for (int i = 0; i < discardedItemsContainer.Children.Count; i++)
     {
         IPostItUI currentUI = (IPostItUI)discardedItemsContainer.Children[i];
         if (currentUI.getNoteID() == id)
         {
             return(currentUI);
         }
     }
     return(null);
 }
예제 #3
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);
        }
예제 #4
0
 private void updateNoteUIContent(GenericIdeationObjects.IdeationUnit updatedIdea)
 {
     this.Dispatcher.Invoke(new Action <IdeationUnit>((ideaToUpdate) =>
     {
         try
         {
             ScatterViewItem noteContainer = findNoteContainerOfIdea(ideaToUpdate);
             IPostItUI noteUI = (IPostItUI)noteContainer.Content;
             noteUI.update(ideaToUpdate);
             noteContainer.Content = noteUI;
         }
         catch (Exception ex)
         {
             Utilities.UtilitiesLib.LogError(ex);
         }
     }), new object[] { updatedIdea.Clone() });
 }
예제 #5
0
 void ideaUI_noteUIDeletedEventHandler(object sender, GenericIdeationObjects.IdeationUnit associatedIdea)
 {
     try
     {
         IPostItUI noteToRestore = getIdeaUIWithId(associatedIdea.Id);
         if (noteToRestore != null)
         {
             discardedItemsContainer.Children.Remove((Control)noteToRestore);
             if (noteRestoredEventHandler != null)
             {
                 noteRestoredEventHandler(associatedIdea);
             }
         }
     }
     catch (Exception ex)
     {
         Utilities.UtilitiesLib.LogError(ex);
     }
 }