protected override void OnStrokeErasing(InkCanvasStrokeErasingEventArgs e) { DrawXml.Remove(parent.Page, this.Strokes.IndexOf(e.Stroke), this.Strokes.Count); if (service != null) service.Erase("Pen",parent.Page, 0, 0, (Point[])e.Stroke.StylusPoints); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnPointEraseResultChanged(object sender, StrokeHitEventArgs e) { Debug.Assert(null != e.HitStroke, "e.HitStroke cannot be null"); bool fSucceeded = false; // The below code might call out StrokeErasing or StrokeErased event. // The out-side code could throw exception. // We use try/finally block to protect our status. try { InkCanvasStrokeErasingEventArgs args = new InkCanvasStrokeErasingEventArgs(e.HitStroke); this.InkCanvas.RaiseStrokeErasing(args); if ( !args.Cancel ) { // Erase only if the event wasn't cancelled StrokeCollection eraseResult = e.GetPointEraseResults(); Debug.Assert(eraseResult != null, "eraseResult cannot be null"); StrokeCollection strokesToReplace = new StrokeCollection(); strokesToReplace.Add(e.HitStroke); try { // replace or remove the stroke if (eraseResult.Count > 0) { this.InkCanvas.Strokes.Replace(strokesToReplace, eraseResult); } else { this.InkCanvas.Strokes.Remove(strokesToReplace); } } catch (ArgumentException ex) { //this can happen if someone sits in an event handler //for StrokeErasing and removes the stroke. //this to harden against failure here. if (!ex.Data.Contains("System.Windows.Ink.StrokeCollection")) { //System.Windows.Ink.StrokeCollection didn't throw this, //we need to just throw the original exception throw; } } //raise ink erased this.InkCanvas.RaiseInkErased(); } fSucceeded = true; } finally { if ( !fSucceeded ) { // Abort the editing. Commit(false); } } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnStrokeEraseResultChanged(object sender, StrokeHitEventArgs e) { Debug.Assert(null != e.HitStroke); bool fSucceeded = false; // The below code calls out StrokeErasing or StrokeErased event. // The out-side code could throw exception. // We use try/finally block to protect our status. try { InkCanvasStrokeErasingEventArgs args = new InkCanvasStrokeErasingEventArgs(e.HitStroke); this.InkCanvas.RaiseStrokeErasing(args); if ( !args.Cancel ) { // Erase only if the event wasn't cancelled InkCanvas.Strokes.Remove(e.HitStroke); this.InkCanvas.RaiseInkErased(); } fSucceeded = true; } finally { if ( !fSucceeded ) { // Abort the editing. Commit(false); } } }
private void InkCanvas_StrokeErasing(object sender, InkCanvasStrokeErasingEventArgs e) { if (ThisAddIn.instance.wire.isConnected && ThisAddIn.instance.wire.isInConversation) ThisAddIn.instance.wire.sendRawDirtyStroke(e.Stroke); InkCanvas source = (InkCanvas)sender; strokeCollectionsForSlides[lastSlide].Remove(e.Stroke); foreach (InkCanvas canvas in ActiveCanvasses) if (canvas != source) { detachInkCanvasHandlers(canvas); var StrokesToRemove = new StrokeCollection(); foreach (Stroke s in canvas.Strokes) if (e.Stroke.sum().checksum.ToString().Equals(s.sum().checksum.ToString())) StrokesToRemove.Add(s); canvas.Strokes.Remove(StrokesToRemove); attachInkCanvasHandlers(canvas); } }
private void erasingStrokes(object sender, InkCanvasStrokeErasingEventArgs e) { try { if (!(filter(Strokes, Globals.me).Contains(e.Stroke))) { e.Cancel = true; return; } Trace.TraceInformation("ErasingStroke {0}", e.Stroke.sum().checksum); doMyStrokeRemoved(e.Stroke); } catch { //Tag can be malformed if app state isn't fully logged in } }
protected virtual new void OnStrokeErasing(InkCanvasStrokeErasingEventArgs e) { }
protected virtual void OnStrokeErasing(object sender, System.Windows.Controls.InkCanvasStrokeErasingEventArgs e) { InkCanvasStrokeErasingEventArgs e2 = new InkCanvasStrokeErasingEventArgs(e.Stroke); OnStrokeErasing(e2); }
void onStrokeErasing(object sender, InkCanvasStrokeErasingEventArgs e) { m_analyzer.RemoveStroke(e.Stroke); }
void InkCanvas_StrokesDeleting(object sender, System.Windows.Controls.InkCanvasStrokeErasingEventArgs e) { // Nothing for now }
private void erasingStrokes(object sender, InkCanvasStrokeErasingEventArgs e) { if (!(filter(Strokes, Globals.me).Contains(e.Stroke))) { e.Cancel = true; return; } doMyStrokeRemoved(e.Stroke); }