83 lines
2.5 KiB
C#
83 lines
2.5 KiB
C#
using Aurora;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
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;
|
|
using Xceed.Wpf.Toolkit.PropertyGrid;
|
|
|
|
namespace AuroraLaser.Views
|
|
{
|
|
/// <summary>
|
|
/// PowerProfile.xaml에 대한 상호 작용 논리
|
|
/// </summary>
|
|
public partial class PowerProfile : UserControl
|
|
{
|
|
PowerProfileViewModel ViewModel = null;
|
|
|
|
public PowerProfile(IAuroraEnvironment aurora, string deviceId)
|
|
{
|
|
InitializeComponent();
|
|
|
|
ViewModel = new PowerProfileViewModel(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);
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|