private void inkOverlay_StrokesDeleting(object sender, InkOverlayStrokesDeletingEventArgs e)
        {
            string[] identifiers = new string[e.StrokesToDelete.Count];

            for (int i = 0; i < e.StrokesToDelete.Count; i++)
            {
                identifiers[i] = (string)e.StrokesToDelete[i].ExtendedProperties[StrokeIdentifier].Data;
            }

            wb.SendObject(new DeletedStrokes(identifiers));
        }
Пример #2
0
        private void inkOverlay_StrokesDeleting(object sender, InkOverlayStrokesDeletingEventArgs e)
        {
            if (this.InvokeRequired)
            {
                return;
            }
            Strokes strokes = e.StrokesToDelete;

            //Remove the corresponding nodes and edges for each stroke
            for (int i = 0; i < strokes.Count; i++)
            {
                if (StrokeManager.isClosed(strokes[i], 0))
                {
                    graph.Remove(graph.Nodes.getNode(strokes[i]));
                }
                else
                {
                    graph.Remove(graph.Edges.getEdge(strokes[i]));
                }
            }
            Invalidate();
        }
Пример #3
0
 /// <summary>
 /// Event Handler for Ink Overlay's StrokeDeleting event. 
 /// This event is fired when a set of stroke is about to be deleted.
 /// The stroke should also be removed from the ink divider's
 /// stroke collection as well
 /// </summary>
 /// <param name="sender">The control that raised the event</param>
 /// <param name="e">The event arguments</param>
 void myInkOverlay_StrokeDeleting(object sender, InkOverlayStrokesDeletingEventArgs e)
 {
     // Remove the strokes to be deleted from the ink divider's stroke collection
     myInkDivider.Strokes.Remove(e.StrokesToDelete);
 }
Пример #4
0
        private void inkOverlay_StrokesDeleting(object sender, InkOverlayStrokesDeletingEventArgs e)
        {
            string[] identifiers = new string[e.StrokesToDelete.Count];

            for(int i = 0; i < e.StrokesToDelete.Count; i++)
            {
                identifiers[i] = (string)e.StrokesToDelete[i].ExtendedProperties[StrokeIdentifier].Data;
            }

            wb.SendObject(new DeletedStrokes(identifiers));
        }
Пример #5
0
 private void inkOverlay_StrokesDeleting(object sender, InkOverlayStrokesDeletingEventArgs e)
 {
     if(this.InvokeRequired) return;
     Strokes strokes = e.StrokesToDelete;
     //Remove the corresponding nodes and edges for each stroke
     for(int i=0; i<strokes.Count; i++)
     {
         if(StrokeManager.isClosed(strokes[i],0))
         {
             graph.Remove(graph.Nodes.getNode(strokes[i]));
         }
         else
         {
             graph.Remove(graph.Edges.getEdge(strokes[i]));
         }
     }
     Invalidate();
 }
Пример #6
0
    private void inkoverlay_StrokesDeleting(object sender, InkOverlayStrokesDeletingEventArgs e)
    {
        dbg.WriteLine("----- inkoverlay_StrokesDeleting -----");

        // Ensure we're on the UI thread.
        dbg.Assert(!this.InvokeRequired);

        // Track region to repaint.
        Rectangle dirtybbox = Rectangle.Empty;

        try         // To prevent exceptions from propagating back to ink runtime.
        {
            // Get objects for stroke(s) to delete.
            RigidBodyBase[] bodies = doc.GetBodiesFor(e.StrokesToDelete);
            MechanismBase[] mechs  = doc.GetMechanismsFor(e.StrokesToDelete);

            // Delete mechanisms.
            foreach (MechanismBase mech in mechs)
            {
                doc.Mechanisms.Remove(mech);
                dirtybbox = Rectangle.Union(dirtybbox, mech.BoundingBox);
            }

            // Delete bodies and their attached mechanisms.
            foreach (RigidBodyBase body in bodies)
            {
                mechs = doc.GetMechanismsForBody(body);
                foreach (MechanismBase mech in mechs)
                {
                    doc.Mechanisms.Remove(mech);
                    dirtybbox = Rectangle.Union(dirtybbox, mech.BoundingBox);

                    Strokes mstrokes = doc.Ink.CreateStrokes(new int[] { mech.strokeid });
                    doc.Ink.DeleteStrokes(mstrokes);
                }

                doc.Bodies.Remove(body);
                dirtybbox = Rectangle.Union(dirtybbox, body.BoundingBox);
            }

            // Check if this stroke was the gravity vector's?
            if (doc.Gravity != null)
            {
                foreach (Stroke s in e.StrokesToDelete)
                {
                    if (s.Id == doc.Gravity.strokeid)
                    {
                        this.InvalidateInkSpaceRectangle(doc.Gravity.BoundingBox);
                        doc.Gravity = null;
                    }
                }
            }
        }
        catch (Exception ex)
        {
            // Log the error.
            Global.HandleThreadException(this, new System.Threading.ThreadExceptionEventArgs(ex));
        }
        finally
        {
            // Repaint the affected area.
            InvalidateInkSpaceRectangle(dirtybbox);
        }
    }
Пример #7
0
    private void inkoverlay_StrokesDeleting(object sender, InkOverlayStrokesDeletingEventArgs e)
    {
        dbg.WriteLine("----- inkoverlay_StrokesDeleting -----");

        // Ensure we're on the UI thread.
        dbg.Assert(!this.InvokeRequired);

        // Track region to repaint.
        Rectangle dirtybbox = Rectangle.Empty;

        try // To prevent exceptions from propagating back to ink runtime.
        {
            // Get objects for stroke(s) to delete.
            RigidBodyBase[] bodies = doc.GetBodiesFor(e.StrokesToDelete);
            MechanismBase[] mechs = doc.GetMechanismsFor(e.StrokesToDelete);

            // Arrays de inteiros para remover os elementos posteriormente!
            ArrayList mechs_int = new ArrayList();
            ArrayList bodies_int = new ArrayList();
            ArrayList gravits_int = new ArrayList();

            // Delete mechanisms.
            foreach (MechanismBase mech in mechs)
            {
                // Para posterior envio
                mechs_int.Add( doc.Mechanisms.IndexOf(mech) );

                doc.Mechanisms.Remove(mech);
                dirtybbox = Rectangle.Union(dirtybbox,mech.BoundingBox);
            }

            // Delete bodies and their attached mechanisms.
            foreach (RigidBodyBase body in bodies)
            {
                // Para posterior envio
                bodies_int.Add( doc.Bodies.IndexOf(body) );

                mechs = doc.GetMechanismsForBody(body);
                foreach (MechanismBase mech in mechs)
                {
                    doc.Mechanisms.Remove(mech);
                    dirtybbox = Rectangle.Union(dirtybbox,mech.BoundingBox);

                    Strokes mstrokes = doc.Ink.CreateStrokes(new int[] { mech.strokeid });
                    doc.Ink.DeleteStrokes(mstrokes);
                }

                doc.Bodies.Remove(body);
                dirtybbox = Rectangle.Union(dirtybbox,body.BoundingBox);
            }

            // Check if this stroke was the gravity vector's?
            if (doc.Gravity != null)
            {
                foreach (Stroke s in e.StrokesToDelete)
                    if (s.Id == doc.Gravity.strokeid)
                    {
                        gravits_int.Add(s.Id);

                        this.InvalidateInkSpaceRectangle(doc.Gravity.BoundingBox);
                        doc.Gravity = null;
                    }
            }

            // Aqui vou mandar o evento para o servidor!
            // Um ArrayList com os MechanismBase a serem removidos
            // Um ArrayList com os Bodies
            // Um arraylist com os strokes a serem deletados

            ArrayList list = new ArrayList();

            list.Add(mechs_int);
            list.Add(bodies_int);
            list.Add(gravits_int);

            // Este evento eh para reproduzir o inkoverlay_Stroke
            Global.clienteEnvia.EnviaEvento((Object) list,"inkoverlay_StrokesDeleting");

        }
        catch (Exception ex)
        {
            // Log the error.
            Global.HandleThreadException(this, new System.Threading.ThreadExceptionEventArgs(ex));
        }
        finally
        {
            // Repaint the affected area.
            InvalidateInkSpaceRectangle(dirtybbox);
        }
    }
Пример #8
0
 /// <summary>
 /// Event Handler for Ink Overlay's StrokeDeleting event.
 /// This event is fired when a set of stroke is about to be deleted.
 /// The stroke should also be removed from the ink divider's
 /// stroke collection as well
 /// </summary>
 /// <param name="sender">The control that raised the event</param>
 /// <param name="e">The event arguments</param>
 void myInkOverlay_StrokeDeleting(object sender, InkOverlayStrokesDeletingEventArgs e)
 {
     // Remove the strokes to be deleted from the ink divider's stroke collection
     myInkDivider.Strokes.Remove(e.StrokesToDelete);
 }
        /// <summary>
        /// Stroke event handler fired when a stroke is deleting.
        /// </summary>
        /// <remarks>The input parameter e contains a collection of strokes 
        /// e.StrokesToDelete because the user might delete several strokes
        /// at once</remarks>
        /// <param name="sender">Event sender</param>
        /// <param name="e">Event arguments</param>
        private void inkOverlay_StrokesDeleting(object sender, InkOverlayStrokesDeletingEventArgs e)
        {
            Log("Stroke deletion...");

            // Loop through all the strokes that just has been deleted
            foreach(Stroke s in e.StrokesToDelete)
            {
                Log(string.Format(CultureInfo.CurrentCulture, "Inside foreach Guid of the stroke to delete: {0}", 
                    s.ExtendedProperties[RTStroke.ExtendedPropertyStrokeIdentifier].Data.ToString()));
                try 
                {
                    rtDocumentHelper.SendStrokeRemove(s);
                }
                catch (Exception ex)
                {
                    RtlAwareMessageBox.Show(this, ex.ToString(), string.Empty, MessageBoxButtons.OK, 
                        MessageBoxIcon.None, MessageBoxDefaultButton.Button1, (MessageBoxOptions)0);
                }
            }
        }
        /// <summary>
        /// Stroke event handler fired when a stroke is deleting.
        /// </summary>
        /// <remarks>The input parameter e contains a collection of strokes 
        /// e.StrokesToDelete because the user might delete several strokes
        /// at once</remarks>
        /// <param name="sender">Event sender</param>
        /// <param name="e">Event arguments</param>
        private void inkOverlay_StrokesDeleting(object sender, InkOverlayStrokesDeletingEventArgs e)
        {
            Log("Stroke deletion...");

            // Loop through all the strokes that just has been deleted
            foreach(Stroke s in e.StrokesToDelete)
            {
                Log("Inside foreach Guid of the stroke to delete: " + s.ExtendedProperties[RTStroke.ExtendedPropertyStrokeIdentifier].Data.ToString());
                try
                {
                    rtDocumentHelper.SendStrokeRemove(s);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(this, ex.ToString());
                }
            }
        }