Beispiel #1
0
        protected override void OnStrokesReplaced(InkCanvasStrokesReplacedEventArgs e)
        {
            //if the stroke doesnt have stylus points
            if (e.NewStrokes.Count == 0)
            {
                return;
            }
            //if stroke is loaded from the file change its PreviousColor to gray
            StrokeCollection sc = new StrokeCollection();

            foreach (Stroke s in e.NewStrokes)
            {
                s.DrawingAttributes.Color = Colors.Gray;
                sc.Add(s);
            }
            ExpertStrokeLoaded = true;
            ExpertStrokeLoadedEventEventArgs args = new ExpertStrokeLoadedEventEventArgs();

            args.strokes = sc;
            args.state   = ExpertStrokeLoaded;
            OnExpertStrokeLoaded(args);

            // start the animation
            base.OnStrokesReplaced(e);
        }//OnStrokesReplaced
Beispiel #2
0
        protected virtual void OnStrokesReplaced(object sender, InkCanvasStrokesReplacedEventArgs e)
        {
            InkCanvasStrokesReplacedEventHandler handler = StrokesReplaced;

            if (handler != null)
            {
                handler(this, e);
            }
        }
Beispiel #3
0
 void inkCanvas1_StrokesReplaced(object sender, InkCanvasStrokesReplacedEventArgs e)
 {
     if (StrokeCollection.ReferenceEquals(e.NewStrokes, player1))
     {
         Title = "Player one's turn";
     }
     else
     {
         Title = "Player two's turn";
     }
 }
Beispiel #4
0
        /// <summary>当从文件中加载墨迹时,会自动调用此方法</summary>
        protected override void OnStrokesReplaced(InkCanvasStrokesReplacedEventArgs e)
        {
            isFromFileInk = true;
            StrokeCollection strokes = e.NewStrokes.Clone();

            this.Strokes.Remove(e.NewStrokes);
            base.OnStrokesReplaced(e);

            foreach (var v in strokes)
            {
                this.Strokes.Remove(v);
                Guid      id   = v.GetPropertyDataIds()[0];
                string[]  s    = ((string)v.GetPropertyData(id)).Split('#');
                MyInkData data = new MyInkData();
                for (int i = 0; i < s.Length; i++)
                {
                    string[] property = s[i].Split(':');
                    switch (property[0])
                    {
                    case "inkName":
                        this.SetInkAttributes(property[1]);
                        break;

                    case "inkRadius":
                        data.inkRadius = double.Parse(property[1]);
                        break;

                    case "inkColor":
                        string[] c = property[1].Split(',');
                        data.inkColor = Color.FromArgb(byte.Parse(c[0]), byte.Parse(c[1]), byte.Parse(c[2]), byte.Parse(c[3]));
                        break;

                    case "inkBrushType":
                        data.inkBrushType = (InkBrushType)Enum.Parse(typeof(InkBrushType), property[1]);
                        break;

                    case "inkStylusType":
                        data.inkStylusType = (InkStylusType)Enum.Parse(typeof(InkStylusType), property[1]);
                        break;

                    case "inkDrawOption":
                        data.inkDrawOption = (InkDrawOption)Enum.Parse(typeof(InkDrawOption), property[1]);
                        break;
                    }
                }
                ink.inkTool = ink.CreateFromInkData(data);
                InkCanvasStrokeCollectedEventArgs args = new InkCanvasStrokeCollectedEventArgs(v);
                this.OnStrokeCollected(args);
            }
        }
Beispiel #5
0
        /// <summary>
        /// Protected override called when the InkAnalysisCanvas.Strokes StrokeCollection is replaced
        /// </summary>
        protected override void OnStrokesReplaced(InkCanvasStrokesReplacedEventArgs e)
        {
            //update the InkAnalyzer and unsubscribe / subscribe to StrokeChanged events
            _inkAnalyzer.RemoveStrokes(e.PreviousStrokes);
            e.PreviousStrokes.StrokesChanged -= OnStrokesChanged;
            foreach (Stroke stroke in e.PreviousStrokes)
            {
                //we're removing this stroke so we don't need to listen
                //to StylusPointsChanged anymore
                stroke.StylusPointsChanged -= OnStrokeStylusPointsChanged;
            }

            _inkAnalyzer.AddStrokes(e.NewStrokes);
            e.NewStrokes.StrokesChanged += OnStrokesChanged;
            Debug.Assert(e.NewStrokes == this.Strokes);
            foreach (Stroke stroke in e.NewStrokes)
            {
                //listen for StylusPointsChanged, which can happen
                //during move and resize operations
                stroke.StylusPointsChanged += OnStrokeStylusPointsChanged;
            }

            _inkAnalyzer.BackgroundAnalyze();
        }
Beispiel #6
0
 private void StrokesReplaced(object sender, InkCanvasStrokesReplacedEventArgs e)
 {
     Trace.WriteLine("InkCanvas stroke replaced.");
 }
Beispiel #7
0
 private void surfaceDessin_StrokesReplaced(object sender, InkCanvasStrokesReplacedEventArgs e)
 {
 }
Beispiel #8
0
 protected override void OnStrokesReplaced(InkCanvasStrokesReplacedEventArgs e)
 {
     base.OnStrokesReplaced(e);
 }
Beispiel #9
0
 private void paint_StrokesReplaced(object sender, InkCanvasStrokesReplacedEventArgs e)
 {
 }
Beispiel #10
0
 /// <summary>
 /// Occurs when strokes are replaced
 /// Stop the timer
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void InkCanvas_StrokesReplaced(object sender, InkCanvasStrokesReplacedEventArgs e)
 {
     ClearStrokes();
 }
Beispiel #11
0
 private void InkCanvas_StrokesReplaced(object sender, InkCanvasStrokesReplacedEventArgs e)
 {
     textBox.Text += "InkCanvas_StrokesReplaced\n";
 }