Ejemplo n.º 1
0
 private void DeleteStrokes(IEnumerable <Stroq> stroqs)
 {
     foreach (Stroq sq in stroqs)
     {
         sq.PointChanged   -= StroqChanged;
         sq.PointsCleared  -= StroqChanged;
         sq.PointsModified -= StroqChanged;
         _map2.Remove(_map[sq].Id);
         _ink.DeleteStroke(_map[sq]);
         _map.Remove(sq);
     }
 }
Ejemplo n.º 2
0
        private void OnObjectReceived(object o, ObjectReceivedEventArgs orea)
        {
            try
            {
                // Don't receive your own data
                if (orea.Participant != Conference.LocalParticipant)
                {
                    if (orea.Data is SerializedInk)
                    {
                        Strokes strokes = ((SerializedInk)orea.Data).Strokes;

                        // This call fails, claiming the strokes are in 2 ink objects
                        // inkOverlay.Ink.Strokes.Add(strokes);

                        // But this call works
                        inkOverlay.Ink.AddStrokesAtRectangle(strokes, strokes.GetBoundingBox());
                    }
                    else if (orea.Data is DeletedStrokes)
                    {
                        string[] identifiers = ((DeletedStrokes)orea.Data).Identifiers;
                        Ink      ink         = inkOverlay.Ink;

                        for (int i = 0; i < identifiers.Length; i++)
                        {
                            for (int j = ink.Strokes.Count - 1; j >= 0; j--)
                            {
                                Stroke stroke = ink.Strokes[j];

                                if ((string)stroke.ExtendedProperties[StrokeIdentifier].Data == identifiers[i])
                                {
                                    ink.DeleteStroke(stroke);
                                    break;
                                }
                            }
                        }
                    }
                    else if (orea.Data is EraseAllInk)
                    {
                        inkOverlay.Ink.DeleteStrokes();
                    }

                    // Update the screen when data arrives
                    pbInk.Refresh();
                }
            }
            catch (Exception e)
            {
                Log(string.Format(CultureInfo.CurrentCulture, "Exception: {0}", e.ToString()));
            }
        }