Exemple #1
0
 private void initEvents()
 {
     ucTablet.PenLoaded += (s, e) => { PenLoaded?.Invoke(s, e); };
     this.ucTablet.MouseLeftButtonDown += TabletScroll_MouseLeftButtonDown;
     this.ucTablet.MouseLeftButtonUp   += TabletScroll_MouseRightButtonUp;
     this.ucTablet.MouseLeave          += UcTablet_MouseLeave;
 }
Exemple #2
0
        public UCTablet()
        {
            InitializeComponent();

            Loaded += (s, e) =>
            {
                drawingAttributes = new DrawingAttributes
                {
                    Color              = Colors.Black,
                    Width              = 0.9,
                    Height             = 0.9,
                    StylusTip          = StylusTip.Ellipse,
                    FitToCurve         = false,
                    StylusTipTransform = new Matrix(1, 1.5, 2.2, 1.0, 0.0, 0.0),
                    IsHighlighter      = false,
                    IgnorePressure     = false
                };
                inkPen.DefaultDrawingAttributes = drawingAttributes;

                mPen = PenController.Instance.GetPen(StudentId);
                if (mPen != null)
                {
                    mPen.HandlerWriteing += HandlerWriteing;
                    ShowHandwriting(mPen.GetPoints(), false);

                    mMainThread = new Thread(() =>
                    {
                        while (!App.IsExit)
                        {
                            List <PenPoint> points = new List <PenPoint>();
                            while (mRealtimeStacks.Count > 0)
                            {
                                try
                                {
                                    var point = mRealtimeStacks.Dequeue();
                                    if (point == null)
                                    {
                                        continue;
                                    }
                                    points.Add(point);
                                }
                                catch
                                {
                                    continue;
                                }
                            }
                            if (points.Count > 0)
                            {
                                this.UICall(updateUI, points);
                            }
                            Thread.Sleep(1);
                        }
                    });
                    mMainThread.Start();
                }
                else
                {
                    PenLoaded?.Invoke(mPen, new EventArgs());
                }
            };
            Unloaded += (s, e) =>
            {
                Close();
            };
        }