123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- using FestoDebugger.Beckoff;
- using FestoDebugger.Models;
- using FestoDebugger.Service;
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- 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 FestoDebugger.UserControls
- {
- /// <summary>
- /// FestoControl.xaml 的交互逻辑
- /// </summary>
- public partial class FestoControl : UserControl
- {
- public FestoControl()
- {
- InitializeComponent();
- }
- public static readonly DependencyProperty ModuleNameProperty = DependencyProperty.Register(
- "ModuleName", typeof(string), typeof(FestoControl),
- new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.AffectsRender));
- /// <summary>
- /// 信号名称
- /// </summary>
- public string ModuleName
- {
- get
- {
- return (string)this.GetValue(ModuleNameProperty);
- }
- set
- {
- this.SetValue(ModuleNameProperty, value);
- }
- }
- public static readonly DependencyProperty SignalOnProperty = DependencyProperty.Register(
- "SignalOn", typeof(bool), typeof(FestoControl), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));
- /// <summary>
- /// WaferPresent
- /// </summary>
- public bool SignalOn
- {
- get
- {
- return (bool)this.GetValue(SignalOnProperty);
- }
- set
- {
- this.SetValue(SignalOnProperty, value);
- }
- }
- public static readonly DependencyProperty ModuleDataProperty = DependencyProperty.Register(
- "ModuleData", typeof(SignalModuleData), typeof(FestoControl), new FrameworkPropertyMetadata(null, new PropertyChangedCallback(OnItemsSourceChanged)));
- /// <summary>
- /// WaferPresent
- /// </summary>
- public SignalModuleData ModuleData
- {
- get
- {
- return (SignalModuleData)this.GetValue(ModuleDataProperty);
- }
- set
- {
- this.SetValue(ModuleDataProperty, value);
- }
- }
- private void On_Click(object sender, RoutedEventArgs e)
- {
- object[] paramater = new object[] { $"{ModuleData.ModuleName}",true };
- BeckhoffIOManager.Instance.WriteDoOperation(" ", paramater);
- }
- private void Off_Click(object sender, RoutedEventArgs e)
- {
- object[] paramater = new object[] { $"{ModuleData.ModuleName}", false };
- BeckhoffIOManager.Instance.WriteDoOperation(" ", paramater);
- }
- private static void OnItemsSourceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
- {
- if (e.NewValue != null)
- {
- SignalModuleData newValue = (SignalModuleData)e.NewValue;
- d.SetValue(SignalOnProperty, newValue.SignalOn);
- }
- }
- }
- }
|