private void inkCanvas_StrokeErasing(object sender, InkCanvasStrokeErasingEventArgs e)
 {
     /*if (undoTracking)
      *  _undoStack.Push(new KeyValuePair<Stroke, int>(e.Stroke, 0));
      *
      * _viewModel.activeCanvas.RefreshThumbnail();*/
 }
        /// <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);
                }
            }
        }
Beispiel #3
0
        //</Snippet17>

        //<Snippet16>
        void inkCanvas1_StrokeErasing(object sender, InkCanvasStrokeErasingEventArgs e)
        {
            if (e.Stroke.DrawingAttributes.IsHighlighter)
            {
                e.Cancel = true;
            }
        }
 protected override void OnStrokeErasing(InkCanvasStrokeErasingEventArgs e)
 {
     base.OnStrokeErasing(e);
     undoActions.Add(ActiveEditingMode);
     undoStrokes.Add(e.Stroke);
     redoActions.Clear();
     redoStrokes.Clear();
 }
Beispiel #5
0
 private void ink_StrokeErasing(object sender, InkCanvasStrokeErasingEventArgs e)
 {
     // _undoStack.Add(e.Stroke, true);
     Models.UndoStack undo = new Models.UndoStack();
     undo.isErase = true;
     undo.stroke  = e.Stroke;
     _undoStackModel.Add(undo);
 }
Beispiel #6
0
        // </SearchQuery_Submitted>

        // <InkCanvas_StrokeErased>
        private void InkCanvas_StrokeErased(object sender, InkCanvasStrokeErasingEventArgs e)
        {
            StopTimer();

            strokeStore.RemoveStroke(strokeToIdMap[e.Stroke]);
            idToStrokeMap.Remove(strokeToIdMap[e.Stroke]);
            strokeToIdMap.Remove(e.Stroke);

            StartTimer();
        }
Beispiel #7
0
        private void Canvas_StrokeErasing(object sender, InkCanvasStrokeErasingEventArgs e)
        {
            VueModele vueModele = ((VueModele)this.DataContext);

            //Empiler la modification
            if (e.Stroke is Savable && !((CustomStroke)e.Stroke).isLocked())
            {
                CustomStroke erasedStroke = (CustomStroke)e.Stroke;
                vueModele.editeur.Do(new DeleteStroke(erasedStroke.Id.ToString(), ((Savable)erasedStroke).toJson()));
                EditionSocket.RemoveStroke(erasedStroke.Id.ToString());
            }
            else if (((CustomStroke)e.Stroke).isLocked())
            {
                e.Cancel = true;
            }
        }
        // Token: 0x06006D6C RID: 28012 RVA: 0x001F6ABC File Offset: 0x001F4CBC
        private void OnPointEraseResultChanged(object sender, StrokeHitEventArgs e)
        {
            bool flag = false;

            try
            {
                InkCanvasStrokeErasingEventArgs inkCanvasStrokeErasingEventArgs = new InkCanvasStrokeErasingEventArgs(e.HitStroke);
                base.InkCanvas.RaiseStrokeErasing(inkCanvasStrokeErasingEventArgs);
                if (!inkCanvasStrokeErasingEventArgs.Cancel)
                {
                    StrokeCollection pointEraseResults = e.GetPointEraseResults();
                    StrokeCollection strokeCollection  = new StrokeCollection();
                    strokeCollection.Add(e.HitStroke);
                    try
                    {
                        if (pointEraseResults.Count > 0)
                        {
                            base.InkCanvas.Strokes.Replace(strokeCollection, pointEraseResults);
                        }
                        else
                        {
                            base.InkCanvas.Strokes.Remove(strokeCollection);
                        }
                    }
                    catch (ArgumentException ex)
                    {
                        if (!ex.Data.Contains("System.Windows.Ink.StrokeCollection"))
                        {
                            throw;
                        }
                    }
                    base.InkCanvas.RaiseInkErased();
                }
                flag = true;
            }
            finally
            {
                if (!flag)
                {
                    base.Commit(false);
                }
            }
        }
Beispiel #9
0
        /// <summary>
        /// Deletes an error label when its corresponding strokes are erased.
        /// </summary>
        private void InkPicture_StrokesDeleting(object sender, InkCanvasStrokeErasingEventArgs e)
        {
            System.Windows.Ink.Stroke iStroke = e.Stroke;

            if (iStroke2Label == null)
            {
                return;
            }

            if (iStroke2Label.ContainsKey((String)iStroke.GetPropertyData(idGuid)))
            {
                System.Windows.Controls.Label label = iStroke2Label[(String)iStroke.GetPropertyData(idGuid)];

                label.Visibility = System.Windows.Visibility.Visible;
                sketchPanel.InkCanvas.Children.Remove(label);

                errorLabels.Remove(label);

                sketchPanel.InkCanvas.InvalidateArrange();
            }
        }
        // Token: 0x06006D6B RID: 28011 RVA: 0x001F6A4C File Offset: 0x001F4C4C
        private void OnStrokeEraseResultChanged(object sender, StrokeHitEventArgs e)
        {
            bool flag = false;

            try
            {
                InkCanvasStrokeErasingEventArgs inkCanvasStrokeErasingEventArgs = new InkCanvasStrokeErasingEventArgs(e.HitStroke);
                base.InkCanvas.RaiseStrokeErasing(inkCanvasStrokeErasingEventArgs);
                if (!inkCanvasStrokeErasingEventArgs.Cancel)
                {
                    base.InkCanvas.Strokes.Remove(e.HitStroke);
                    base.InkCanvas.RaiseInkErased();
                }
                flag = true;
            }
            finally
            {
                if (!flag)
                {
                    base.Commit(false);
                }
            }
        }
Beispiel #11
0
 private void StrokeErasing(object sender, InkCanvasStrokeErasingEventArgs e)
 {
     Trace.WriteLine("InkCanvas stroke erasing.");
 }
 private void CanvasTinta_StrokeErasing(object sender, InkCanvasStrokeErasingEventArgs e)
 {
     m_analyzer.RemoveStroke(e.Stroke);
 }
Beispiel #13
0
 private void InkCanvas_StrokeErasing(object sender, InkCanvasStrokeErasingEventArgs e)
 {
     textBox.Text += "InkCanvas_StrokeErasing\n";
 }
Beispiel #14
0
 /// <summary>
 /// Occurrs when a stroke is being erased.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="InkCanvasStrokeErasingEventArgs"/> instance containing the event data.</param>
 private void StrokeErasing(object sender, InkCanvasStrokeErasingEventArgs e)
 {
     _client.SendStrokeToErase(e.Stroke, WeSketchClientData.Instance.User.Board.BoardID);
 }
        /// <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);
                }
            }
        }
Beispiel #16
0
 protected override void OnStrokeErasing(InkCanvasStrokeErasingEventArgs e)
 {
     base.OnStrokeErasing(e);
 }
Beispiel #17
0
		protected virtual void OnStrokeErasing(object sender, System.Windows.Controls.InkCanvasStrokeErasingEventArgs e)
		{
			InkCanvasStrokeErasingEventArgs e2 = new InkCanvasStrokeErasingEventArgs(e.Stroke);
			OnStrokeErasing(e2);
		}
 private void surfaceDessin_StrokeErasing(object sender, InkCanvasStrokeErasingEventArgs e)
 {
     (DataContext as VueModele).HandleErasing(e.Stroke);
     e.Cancel = true; //Prevent deletion
 }
Beispiel #19
0
 private void Canvas_StrokeErasing(object sender, InkCanvasStrokeErasingEventArgs e)
 {
     undoOrRedo = 0;
 }
Beispiel #20
0
		private void OnStrokeErasing(InkCanvasStrokeErasingEventArgs e)
		{
			InkCanvasStrokeErasingEventHandler handler = StrokeErasing;
			if (handler != null)
				handler(this, e);
		}
Beispiel #21
0
 void inkCanvas1_StrokeErasing(object sender, InkCanvasStrokeErasingEventArgs e)
 {
 }
Beispiel #22
0
		private void ErasePoint(Contact contact)
		{
			Point position = contact.GetPosition(this);
			Point[] points = new[] { position };
			foreach (Stroke stroke in inkCanvas.Strokes.HitTest(points, EraserShape))
			{
				InkCanvasStrokeErasingEventArgs e = new InkCanvasStrokeErasingEventArgs(stroke);
				OnStrokeErasing(e);
				if (!e.Cancel)
				{
					StrokeCollection eraseResult = stroke.GetEraseResult(points, EraserShape);
					inkCanvas.Strokes.Replace(stroke, eraseResult);
					RoutedEventArgs e2 = new RoutedEventArgs(StrokeErasedEvent, this);
					RaiseEvent(e2);
				}
			}
		}
Beispiel #23
0
		private void EraseStroke(Contact contact)
		{
			Point position = contact.GetPosition(this);
			foreach (Stroke stroke in inkCanvas.Strokes.HitTest(new[] {position}, EraserShape))
			{
				InkCanvasStrokeErasingEventArgs e = new InkCanvasStrokeErasingEventArgs(stroke);
				OnStrokeErasing(e);
				if (!e.Cancel)
				{
					inkCanvas.Strokes.Remove(stroke);
					RoutedEventArgs e2 = new RoutedEventArgs(StrokeErasedEvent, this);
					RaiseEvent(e2);
				}
			}
		}
Beispiel #24
0
        public void OnStrokeErased(InkCanvasStrokeErasingEventArgs e)
        {
            var stroke = e.Stroke as StrokeModel;

            e.Cancel = stroke != null && IsSelectedByOtherUser(stroke);
        }
Beispiel #25
0
 /// <summary>
 /// Removes strokes in an undo-able way.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void inkPic_StrokeErasing(object sender, InkCanvasStrokeErasingEventArgs e)
 {
     CM.ExecuteCommand(new CommandList.StrokeRemoveCmd(ref inkSketch, e.Stroke));
     InkChanged(false);
 }
 public void Strokes_StrokesErasing(object sender, InkCanvasStrokeErasingEventArgs e)
 {
     inkSketch.DeleteStroke(e.Stroke);
 }
Beispiel #27
0
 private void paint_StrokeErasing(object sender, InkCanvasStrokeErasingEventArgs e)
 {
     Console.WriteLine("paint_StrokeErasing");
 }