mirror of
https://gitcode.com/gh_mirrors/ope/OpenFace.git
synced 2025-12-30 04:52:29 +00:00
40 lines
975 B
C#
40 lines
975 B
C#
using System.Windows.Controls;
|
|
|
|
namespace OpenFaceOffline
|
|
{
|
|
/// <summary>
|
|
/// Interaction logic for BarGraph.xaml
|
|
/// </summary>
|
|
public partial class BarGraph : UserControl
|
|
{
|
|
private double targetValue = 0;
|
|
|
|
public BarGraph()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public void SetValue(double value)
|
|
{
|
|
targetValue = 1.5 * value;
|
|
if (targetValue > 0)
|
|
{
|
|
if (targetValue > barContainerPos.ActualHeight)
|
|
targetValue = barContainerPos.ActualHeight;
|
|
|
|
barPos.Height = targetValue;
|
|
barNeg.Height = 0;
|
|
}
|
|
if (targetValue < 0)
|
|
{
|
|
if (-targetValue > barContainerNeg.ActualHeight)
|
|
targetValue = -barContainerNeg.ActualHeight;
|
|
|
|
barPos.Height = 0;
|
|
barNeg.Height = -targetValue;
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|