2026-01-26 18:56:53 +09:00

66 lines
2.1 KiB
C#

using Aurora;
using System;
using System.Windows.Controls;
using Xceed.Wpf.Toolkit.PropertyGrid;
namespace WeldingCommon.Views
{
/// <summary>
/// Interaction logic for UCPowerProfile.xaml
/// </summary>
public partial class UCPowerProfile : UserControl
{
UCPowerProfileViewModel _ViewModel = null;
public UCPowerProfile(IAuroraEnvironment aurora, string deviceId)
{
InitializeComponent();
_ViewModel = new UCPowerProfileViewModel(aurora, deviceId);
DataContext = _ViewModel;
//PropertyGrid Event 구현하는 방법은 다양하겠지만 우선 이방법으로 진행...
propertyGrid.PropertyValueChanged += PropertyGrid_SelectedObjectChanged;
}
private void ProfileList_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (ProfileList.SelectedIndex >= 0) {
int comboboxSelectedIndex = ProfileList.SelectedIndex;
_ViewModel.UpdateListboxPowerProfile(comboboxSelectedIndex);
_ViewModel.UpdateChartPowerProfile();
}
}
private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
int listboxSelectedIndex = ListboxProfileList.SelectedIndex;
_ViewModel.UpdatePropertyGridPowerProfile(listboxSelectedIndex);
}
private void PropertyGrid_SelectedObjectChanged(object sender, EventArgs e)
{
// Handle the event (the sender is the PropertyGrid)
var propertyGrid = (PropertyGrid)sender;
// The new selected object is propertyGrid.SelectedObject
var newSelectedObject = propertyGrid.SelectedObject;
// Call the ViewModel's method
_ViewModel.UpdateChartPowerProfile(newSelectedObject);
}
private void RegionIDList_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (RegionIDList.SelectedIndex >= 0) {
int id = RegionIDList.SelectedIndex;
_ViewModel.UpdateChartRecord(id);
}
}
}
}