Files
StructureHelper/StructureHelper/Windows/Forces/ForceInterpolationControl.xaml.cs
2025-11-04 21:16:06 +05:00

68 lines
2.2 KiB
C#

using StructureHelper.Windows.UserControls;
using StructureHelper.Windows.ViewModels.Materials;
using StructureHelperCommon.Services.Forces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace StructureHelper.Windows.Forces
{
/// <summary>
/// Логика взаимодействия для ForceInterpolationControl.xaml
/// </summary>
public partial class ForceInterpolationControl : UserControl
{
private ForceTupleInterpolationViewModel? properties;
public ForceTupleInterpolationViewModel? Properties
{
get => properties; set
{
properties = value;
DataContext = Properties;
}
}
public ForceInterpolationControl()
{
InitializeComponent();
}
private void StartValueChanged(object sender, EventArgs e)
{
var obj = (MultiplyDouble)sender;
var tmpTuple = ForceTupleService.MultiplyTupleByFactor(Properties.StartDesignForce, obj.DoubleFactor);
ForceTupleService.CopyProperties(tmpTuple, Properties.StartDesignForce, 1d);
Properties.RefreshStartTuple();
}
private void FinishValueChanged(object sender, EventArgs e)
{
var obj = (MultiplyDouble)sender;
var tmpTuple = ForceTupleService.MultiplyTupleByFactor(Properties.FinishDesignForce, obj.DoubleFactor);
ForceTupleService.CopyProperties(tmpTuple, Properties.FinishDesignForce, 1d);
Properties.RefreshFinishTuple();
}
private void StepCountValueChanged(object sender, EventArgs e)
{
var obj = (MultiplyDouble)sender;
var factor = obj.DoubleFactor;
if (factor > 0d)
{
Properties.StepCount = Convert.ToInt32(Properties.StepCount * factor);
}
}
}
}