| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- using System;
- using System.Windows;
- using System.Windows.Controls;
- using TeamAAS.Robot.Models;
- using TeamAAS.Feeder.Models;
- using TeamAAS.ViewModels;
- namespace TeamAAS.Views
- {
- public partial class SettingView : UserControl
- {
- public SettingView()
- {
- InitializeComponent();
- Loaded += OnLoaded;
- _hasLoaded = false;
- }
- private bool _hasLoaded;
- private void OnLoaded(object sender, RoutedEventArgs e)
- {
- if (_hasLoaded) return;
- _hasLoaded = true;
- if (DataContext is SettingViewModel vm)
- {
- System.Windows.Threading.Dispatcher.CurrentDispatcher.BeginInvoke(
- new Action(() => vm.DelayedLoad()),
- System.Windows.Threading.DispatcherPriority.Background);
- }
- }
- private void RobotDataGrid_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
- {
- if (DataContext is SettingViewModel vm && vm.SelectedRobot is RobotInfo robot)
- {
- var copy = robot.Clone();
- if (DialogHelper.EditProperties(copy, "机器人属性"))
- vm.ApplyRobotEdit(copy);
- }
- }
- private void FeederDataGrid_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
- {
- if (DataContext is SettingViewModel vm && vm.SelectedFeeder is FeederInfo feeder)
- {
- var copy = feeder.Clone();
- if (DialogHelper.EditProperties(copy, "供料器属性(含四个方向振动参数)"))
- vm.ApplyFeederEdit(copy);
- }
- }
- }
- }
|