mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-03-20 16:36:36 +08:00
支持添加中间节点
This commit is contained in:
@@ -17,40 +17,6 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
/// </summary>
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Checks if a property already matches a desired value. Sets the property and
|
||||
/// notifies listeners only when necessary.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Type of the property.</typeparam>
|
||||
/// <param name="storage">Reference to a property with both getter and setter.</param>
|
||||
/// <param name="value">Desired value for the property.</param>
|
||||
/// <param name="propertyName">Name of the property used to notify listeners. This
|
||||
/// value is optional and can be provided automatically when invoked from compilers that
|
||||
/// support CallerMemberName.</param>
|
||||
/// <returns>True if the value was changed, false if the existing value matched the
|
||||
/// desired value.</returns>
|
||||
protected virtual bool SetProperty<T>(ref T storage, T value, [CallerMemberName] string propertyName = null)
|
||||
{
|
||||
if (EqualityComparer<T>.Default.Equals(storage, value))
|
||||
return false;
|
||||
|
||||
if (propertyName == "IsSelected")
|
||||
{
|
||||
|
||||
}
|
||||
else if (this.ContainsProperty("IsReadOnly"))
|
||||
{
|
||||
if (object.Equals(this.GetPropertyValue("IsReadOnly"), true))
|
||||
return false;
|
||||
}
|
||||
|
||||
var old = storage;
|
||||
storage = value;
|
||||
RaisePropertyChanged(propertyName, old, value);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private Dictionary<string, object> _oldDic = new Dictionary<string, object>();
|
||||
public void SetOldValue<T>(T value, string propertyName, string guid = null)
|
||||
{
|
||||
@@ -78,6 +44,44 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if a property already matches a desired value. Sets the property and
|
||||
/// notifies listeners only when necessary.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Type of the property.</typeparam>
|
||||
/// <param name="storage">Reference to a property with both getter and setter.</param>
|
||||
/// <param name="value">Desired value for the property.</param>
|
||||
/// <param name="propertyName">Name of the property used to notify listeners. This
|
||||
/// value is optional and can be provided automatically when invoked from compilers that
|
||||
/// support CallerMemberName.</param>
|
||||
/// <returns>True if the value was changed, false if the existing value matched the
|
||||
/// desired value.</returns>
|
||||
protected virtual bool SetProperty<T>(ref T storage, T value, [CallerMemberName] string propertyName = null)
|
||||
{
|
||||
if (EqualityComparer<T>.Default.Equals(storage, value))
|
||||
return false;
|
||||
|
||||
if (propertyName == "IsSelected")
|
||||
{
|
||||
|
||||
}
|
||||
else if (this.ContainsProperty("IsReadOnly"))
|
||||
{
|
||||
if (object.Equals(this.GetPropertyValue("IsReadOnly"), true))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (propertyName == "Area")
|
||||
{
|
||||
|
||||
}
|
||||
var old = storage;
|
||||
storage = value;
|
||||
RaisePropertyChanged(propertyName, old, value);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if a property already matches a desired value. Sets the property and
|
||||
/// notifies listeners only when necessary.
|
||||
@@ -93,11 +97,22 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
/// desired value.</returns>
|
||||
protected virtual bool SetProperty<T>(ref T storage, T value, Action onChanged, [CallerMemberName] string propertyName = null)
|
||||
{
|
||||
if (EqualityComparer<T>.Default.Equals(storage, value)) return false;
|
||||
if (EqualityComparer<T>.Default.Equals(storage, value)) return false;
|
||||
|
||||
if (propertyName == "IsSelected")
|
||||
{
|
||||
|
||||
}
|
||||
else if (this.ContainsProperty("IsReadOnly"))
|
||||
{
|
||||
if (object.Equals(this.GetPropertyValue("IsReadOnly"), true))
|
||||
return false;
|
||||
}
|
||||
|
||||
var old = storage;
|
||||
storage = value;
|
||||
onChanged?.Invoke();
|
||||
RaisePropertyChanged(propertyName);
|
||||
RaisePropertyChanged(propertyName, old, value);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user