コード例 #1
0
ファイル: Speaker.cs プロジェクト: DmitriiKostrov/Voice
 private void animateFace(FaceEventArgs e)
 {
     //lock (_lock)
     //{
     for (int i = 0; i < e.FaceArgs.Length; i++)
     {
         for (int j = 0; j < _faceElems.Length; j++)
         {
             if (e.FaceArgs[i].name == _faceElems[j].Name)
             {
                 _faceElems[j].Width = e.FaceArgs[i].width;
                 Control sub = _faceElems[j].Tag == null ? null : (Control)_faceElems[j].Tag;
                 _faceElems[j].Location = new Point(e.FaceArgs[i].x, e.FaceArgs[i].y);
                 if (sub != null && e.FaceArgs[i].height <= sub.Height + 4)
                 {
                     _faceElems[j].Height = sub.Height + 4;
                     _faceElems[j].Top    = sub.Top - 2;
                 }
                 else
                 {
                     _faceElems[j].Height = e.FaceArgs[i].height;
                 }
                 if (e.FaceArgs[i].name == "MouseButton")
                 {
                     manageTeeth();
                 }
                 break;
             }
         }
     }
     //this.Refresh();
     // }
 }
コード例 #2
0
 /// <summary>
 /// Handles the <see cref="E:FaceFound" /> event.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="FaceEventArgs"/> instance containing the event data.</param>
 private void OnFaceFound(object sender, FaceEventArgs e)
 {
     if (FaceFound != null)
     {
         FaceFound(sender, e);
     }
 }
コード例 #3
0
ファイル: FaceForm.cs プロジェクト: mindnumb/Accord.Net
        private void controller_FaceMove(object sender, FaceEventArgs e)
        {
            int x = (int)(e.X * 20f);
            int y = (int)(e.Y * 20f);

            tbHorizontal.Value = Math.Min(Math.Max(x, tbHorizontal.Minimum), tbHorizontal.Maximum);
            tbVertical.Value   = Math.Min(Math.Max(y, tbVertical.Minimum), tbVertical.Maximum);

            pointBox1.PointX = e.X;
            pointBox1.PointY = e.Y;
        }
コード例 #4
0
 /// <summary>
 /// Handles the FaceFound event of the Camera control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="FaceEventArgs"/> instance containing the event data.</param>
 void Camera_FaceFound(object sender, FaceEventArgs e)
 {
     try
     {
         Dispatcher.Invoke(() =>
             {
                 double scaleX = this.ActualWidth / e.Width;
                 double scaleY = this.ActualHeight / e.Height;
                 var bounds = e.Bounds;
                 _rectangle.Margin = new Thickness(bounds.X * scaleX, bounds.Y * scaleY, 0, 0);
                 _rectangle.Width = bounds.Width * scaleX;
                 _rectangle.Height = bounds.Height * scaleY;
             });
     }
     catch (TaskCanceledException)
     {
         // Do nothing.
     }
 }
コード例 #5
0
 /// <summary>
 /// Handles the FaceFound event of the Camera control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="FaceEventArgs"/> instance containing the event data.</param>
 void Camera_FaceFound(object sender, FaceEventArgs e)
 {
     try
     {
         Dispatcher.Invoke(() =>
         {
             double scaleX     = this.ActualWidth / e.Width;
             double scaleY     = this.ActualHeight / e.Height;
             var bounds        = e.Bounds;
             _rectangle.Margin = new Thickness(bounds.X * scaleX, bounds.Y * scaleY, 0, 0);
             _rectangle.Width  = bounds.Width * scaleX;
             _rectangle.Height = bounds.Height * scaleY;
         });
     }
     catch (TaskCanceledException)
     {
         // Do nothing.
     }
 }
コード例 #6
0
ファイル: Speaker.cs プロジェクト: DmitriiKostrov/Voice
 public void OnFaceEvent(object sender, FaceEventArgs e)
 {
     _parent.Invoke(new AnimateFace(animateFace), new object[] { e });
 }