Esempio n. 1
0
        private void Canvas_MouseMove(object sender, MouseEventArgs e)
        {
            if (e.RightButton == MouseButtonState.Pressed)
            {
                return;
            }

            if (e.LeftButton == MouseButtonState.Pressed)
            {
                if (!CanDraw())
                {
                    if (_currentEntry != null && Message.Entries.Contains(_currentEntry))
                    {
                        Message.Entries.Remove(_currentEntry);
                    }
                    //ApplicationViewModel.Current.IsDrawing = false;
                    _currentEntry = null;
                }

                Point currentPoint = e.GetPosition(sender as Canvas);
                if (_currentEntry != null)
                {
                    _currentEntry.Points.Add(currentPoint);
                }

                //if( _currentEntry == null )
                //{
                //	BeginRecording( e.GetPosition( sender as Canvas ) );
                //}
            }
            else if (_currentEntry != null)
            {
                SendCurrentData();
            }
        }
        public override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value == DependencyProperty.UnsetValue)
            {
                return(null);
            }
            WhiteboardEntry entry = value as WhiteboardEntry;

            PointCollection points = entry.Points;

            if (points.Count == 1)
            {
                points.Add(points[0]);
            }
            if (entry != null)
            {
                Polyline line = new Polyline();
                line.StrokeThickness    = entry.StrokeThickness;
                line.Stroke             = entry.Stroke;
                line.StrokeStartLineCap = PenLineCap.Round;
                line.StrokeEndLineCap   = PenLineCap.Round;
                line.StrokeLineJoin     = PenLineJoin.Round;
                line.Points             = entry.Points;
                return(line);
            }
            return(null);
        }
Esempio n. 3
0
 private void SendCurrentData()
 {
     if (_currentEntry != null && CanDraw())
     {
         ApplicationViewModel.Current.ChatProxy.SendWhiteboardData(Message, _currentEntry);
         //ApplicationViewModel.Current.IsDrawing = false;
         _currentEntry = null;
     }
 }
Esempio n. 4
0
 private void theCanvas_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
 {
     if (e.RightButton == MouseButtonState.Pressed && _currentEntry != null)
     {
         Message.Entries.Remove(_currentEntry);
         _currentEntry = null;
         //ApplicationViewModel.Current.IsDrawing = false;
         e.Handled = true;
     }
 }
Esempio n. 5
0
        private void BeginRecording(Point p)
        {
            if (CanDraw())
            {
                _startPoint = p;

                Brush brush = ApplicationViewModel.Current.CurrentBrush.Clone();
                brush.Opacity = ApplicationViewModel.Current.CurrentOpacity;

                _currentEntry = new WhiteboardEntry
                {
                    User   = ApplicationViewModel.Current.ChatProxy.CurrentUser,
                    Points = new PointCollection {
                        p
                    },
                    Stroke          = brush,
                    StrokeThickness = ApplicationViewModel.Current.CurrentThickness,
                };

                Message.Entries.Add(_currentEntry);
            }
        }