mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-03-03 08:10:50 +08:00
阀门优化
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Reactive.Linq;
|
||||
using System.Text;
|
||||
using Util.DiagramDesigner;
|
||||
|
||||
@@ -8,6 +9,7 @@ namespace AIStudio.Wpf.SFC.ViewModels
|
||||
{
|
||||
public class Simulate_SolenoidViewModel : SFCNode
|
||||
{
|
||||
private IDisposable diChangedSubscription;
|
||||
public Simulate_SolenoidViewModel() : base(SFCNodeKinds.Simulate_Solenoid)
|
||||
{
|
||||
ItemWidth = 32;
|
||||
@@ -21,6 +23,17 @@ namespace AIStudio.Wpf.SFC.ViewModels
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Init()
|
||||
{
|
||||
base.Init();
|
||||
if (diChangedSubscription != null)
|
||||
{
|
||||
diChangedSubscription.Dispose();
|
||||
}
|
||||
Random random = new Random();
|
||||
diChangedSubscription = WhenPropertyChanged.Where(o => o.ToString() == "Value").Throttle(TimeSpan.FromSeconds(random.Next(1,10))).Subscribe(OnValueChanged);//Sample
|
||||
}
|
||||
|
||||
private bool _showText;
|
||||
public override bool ShowText
|
||||
{
|
||||
@@ -64,11 +77,19 @@ namespace AIStudio.Wpf.SFC.ViewModels
|
||||
{
|
||||
if (DOLinkPoint != null)
|
||||
{
|
||||
DOLinkPoint.Value = DILinkPoint.Value;
|
||||
Value = DILinkPoint.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnValueChanged(string propertyName)
|
||||
{
|
||||
if (DOLinkPoint != null)
|
||||
{
|
||||
DOLinkPoint.Value = Value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 反馈
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user