Exemplo n.º 1
0
        private void drawingCanvas_StrokeCollected(object sender, InkCanvasStrokeCollectedEventArgs e)
        {
            try
            {
                sv_MainCanvas.IsHitTestVisible = true;
                Stroke latestStroke = e.Stroke;
                StylusPointCollection strokePoints = latestStroke.StylusPoints;
                if (!DrawingCanvasModeSwitcher.IsInErasingMode() && strokePoints.Count < 10)
                {
                    return;
                }
                List <System.Windows.Point> pathPoints = new List <System.Windows.Point>();
                foreach (StylusPoint stylusP in strokePoints)
                {
                    System.Windows.Point p = new System.Windows.Point();
                    p.X = stylusP.X;
                    p.Y = stylusP.Y;
                    pathPoints.Add(p);
                }

                /*if (Utilities.UtilitiesLib.CheckClosedPath(pathPoints))
                 * {
                 *  System.Windows.Point orginTopleft, orginBottomRight, orginCenter;
                 *  Utilities.UtilitiesLib.extractAnchorPointsOfPath(pathPoints,out orginTopleft,out orginBottomRight,out orginCenter);
                 *
                 *  IdeationUnitGroup idea = new IdeationUnitGroup();
                 *  IdeaGroupContentType ideaGroupContent = new IdeaGroupContentType();
                 *  ideaGroupContent.DisplayBoundaries = pathPoints;
                 *  idea.Content = ideaGroupContent;
                 *  idea.Id = IdeaIDGenerator.generateID();
                 *  idea.CenterX = (float)orginCenter.X;
                 *  idea.CenterY = (float)orginCenter.Y;
                 *
                 *  AddSingleIdeaGroup(idea);
                 * }*/
                //add corresponding idea object for this stroke
                IdeationUnit strokeIdea = new StrokeBasedIdea();
                strokeIdea.Id = IdeaIDGenerator.generateID();
                StrokeData strokeData = new StrokeData();
                strokeData.IsErasingStroke = DrawingCanvasModeSwitcher.IsInErasingMode();
                strokeData.StrokeColorCode = new System.Windows.Media.ColorConverter().ConvertToString(latestStroke.DrawingAttributes.Color);
                strokeData.StrokePoints    = pathPoints;
                strokeIdea.Content         = strokeData;
                brainstormManager.AddIdeaInBackground(strokeIdea);
                //get the current screenshot
                TakeASnapshot();
                timelineManager.AddADDChange(strokeIdea);
            }
            catch (Exception ex)
            {
                Utilities.UtilitiesLib.LogError(ex);
            }
        }
Exemplo n.º 2
0
 private void menuItem_DrawingSwitch_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         DrawingCanvasModeSwitcher.Flip();
         if (DrawingCanvasModeSwitcher.IsInErasingMode())
         {
             drawingCanvas.UsesTouchShape = false;
             drawingCanvas.DefaultDrawingAttributes.Color = System.Windows.Media.Color.FromRgb(0, 0, 0);
             drawingCanvas.DefaultDrawingAttributes.Width = drawingCanvas.DefaultDrawingAttributes.Height = 30;
             menuItem_DrawingSwitch.Header = MainWindow.Resources["PencilIcon"];
         }
         else
         {
             drawingCanvas.UsesTouchShape           = true;
             drawingCanvas.DefaultDrawingAttributes = DrawingCanvasModeSwitcher.normalDrawingAttribute.Clone();
             menuItem_DrawingSwitch.Header          = MainWindow.Resources["EraserIcon"];
         }
     }
     catch (Exception ex)
     {
         Utilities.UtilitiesLib.LogError(ex);
     }
 }