using FLY.OBJComponents.Client; using FLY.Winder.Common; using FLY.Winder.IService; using System; using System.Collections.Generic; using System.Linq; using System.Text; 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 Unity; namespace FLY.Winder.UI.Client.UiModule { /// <summary> /// MainPanel.xaml 的交互逻辑 /// </summary> public partial class MainPanel2 : UserControl { IUnityContainer container; IWinderSystemService winderSystem; SetPLCUpdatePlan setPlan_accessory; SetPLCUpdatePlan[] setPlan_winders = new SetPLCUpdatePlan[2]; public MainPanel2() { InitializeComponent(); } [InjectionMethod] public void Init( IUnityContainer container, IWinderSystemService winderSystem) { this.container = container; this.winderSystem = winderSystem; this.DataContext = winderSystem; grid_winder.DataContext = winderSystem; //注册属性更新计划 setPlan_accessory = new SetPLCUpdatePlan( winderSystem.PLCos, winderSystem.Accessory, new string[] { "VelocitySet", "IsVelocityChanged", "Velocity", "RotaryFreqSet", "IsRotaryFreqChanged", "RotaryCurrent", "RotaryFreq", "IsRotaryOn", "IsRotaryOrg", "IsRotaryForw", "IsRotaryBackw", "IsRotaryForwLimit", "IsRotaryForwTurn", "IsRotaryOrgSign", "IsRotaryBackwLimit", "IsRotaryBackwTurn", "Traction1Current", "IsTraction1On", "IsTraction2Manual", "Traction2TensionKgSet", "Traction2TensionKg", "Traction2Current", "IsTraction2Manual", "IsTraction2On" }); for (int i = 0; i < 2; i++) { setPlan_winders[i] = new SetPLCUpdatePlan( winderSystem.PLCos, winderSystem.Items[i], new string[] { "MeasureLenSet", "MeasurePreWarning", "MeasureLen", "MeasureStop", "TensionKgSet", "TensionKg", "Current", "IsManual", "IsOn" }); } } private void button_v_set_Click(object sender, RoutedEventArgs e) { var w = container.Resolve<WdVelocity>(); w.Owner = FLY.ControlLibrary.COMMON.GetWindow(this); w.ShowDialog(); } private void button_manual_Click(object sender, RoutedEventArgs e) { var w = container.Resolve<WdManual2>(); w.Owner = FLY.ControlLibrary.COMMON.GetWindow(this); w.ShowDialog(); } private void button_freq_Click(object sender, RoutedEventArgs e) { var w = container.Resolve<WdFreq>(); w.Owner = FLY.ControlLibrary.COMMON.GetWindow(this); w.ShowDialog(); } private void button_measure_Click(object sender, RoutedEventArgs e) { Button button = sender as Button; WinderInsideOutside item = (WinderInsideOutside)(button.Tag); WdMeasure w = new WdMeasure(); w.Init((int)(item.MeasureLenSet), (int)(item.MeasurePreWarning)); w.Owner = FLY.ControlLibrary.COMMON.GetWindow(this); if (w.ShowDialog() == true) { item.MeasureLenSet = w.viewmodel.MeasureLenSet; item.MeasurePreWarning = w.viewmodel.MeasurePreWarning; } } } }