mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-04-05 16:56:34 +08:00
mind
This commit is contained in:
@@ -219,6 +219,15 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
private SimpleCommand _removeTagCommand;
|
||||
public SimpleCommand RemoveTagCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._removeTagCommand ?? (this._removeTagCommand = new SimpleCommand(MindExecuteEnable, ExecuteRemoveTagCommand));
|
||||
}
|
||||
}
|
||||
|
||||
private SimpleCommand _changeMindTypeCommand;
|
||||
public SimpleCommand ChangeMindTypeCommand
|
||||
{
|
||||
@@ -645,12 +654,12 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
|
||||
private void ExecuteAddRemarkCommand(object obj)
|
||||
{
|
||||
|
||||
SelectedItems.OfType<MindNode>().ToList().ForEach(p => p.Remark = "备注");
|
||||
}
|
||||
|
||||
private void ExecuteRemoveRemarkCommand(object obj)
|
||||
{
|
||||
|
||||
SelectedItems.OfType<MindNode>().ToList().ForEach(p => p.Remark = null);
|
||||
}
|
||||
|
||||
private void ExecuteAddPriorityCommand(object obj)
|
||||
@@ -679,12 +688,16 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
|
||||
private void ExecuteAddTagCommand(object obj)
|
||||
{
|
||||
|
||||
SelectedItems.OfType<MindNode>().ToList().ForEach(p => {
|
||||
p.Tags.Add(obj?.ToString());
|
||||
});
|
||||
}
|
||||
|
||||
private void ExecuteRemoveTagCommand(object obj)
|
||||
{
|
||||
|
||||
SelectedItems.OfType<MindNode>().ToList().ForEach(p => {
|
||||
p.Tags.Remove(obj?.ToString());
|
||||
});
|
||||
}
|
||||
|
||||
private void ExecutedChangeMindTypeCommand(object obj)
|
||||
|
||||
@@ -64,6 +64,7 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
MoveForwardCommand = (Root as IMindDiagramViewModel)?.MoveForwardCommand;
|
||||
MoveBackCommand = (Root as IMindDiagramViewModel)?.MoveBackCommand;
|
||||
BuildMenuOptions();
|
||||
Tags = new ObservableCollection<string>();
|
||||
}
|
||||
|
||||
public void InitLayout(bool initAppearance)
|
||||
@@ -300,7 +301,36 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
}
|
||||
set
|
||||
{
|
||||
if (_tags != null)
|
||||
{
|
||||
_tags.CollectionChanged -= _tags_CollectionChanged;
|
||||
}
|
||||
SetProperty(ref _tags, value);
|
||||
if (_tags != null)
|
||||
{
|
||||
_tags.CollectionChanged += _tags_CollectionChanged;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void _tags_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
if (e.NewItems != null)
|
||||
{
|
||||
foreach (var item in e.NewItems.OfType<string>())
|
||||
{
|
||||
var width = GetTextDisplayWidthHelper.GetTextDisplayWidth(item, new FontFamily(FontViewModel.FontFamily), FontViewModel.FontStyle, FontViewModel.FontWeight, FontViewModel.FontStretch, 12) + 6;
|
||||
ItemWidth += width;
|
||||
}
|
||||
}
|
||||
|
||||
if (e.OldItems != null)
|
||||
{
|
||||
foreach (var item in e.OldItems.OfType<string>())
|
||||
{
|
||||
var width = GetTextDisplayWidthHelper.GetTextDisplayWidth(item, new FontFamily(FontViewModel.FontFamily), FontViewModel.FontStyle, FontViewModel.FontWeight, FontViewModel.FontStretch, 12) + 6;
|
||||
ItemWidth -= width;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
@@ -473,6 +503,24 @@ namespace AIStudio.Wpf.Mind.ViewModels
|
||||
ItemWidth = Math.Max(ItemWidth, GetTextDisplayWidthHelper.GetTextDisplayWidth(Text, new FontFamily(FontViewModel.FontFamily), FontViewModel.FontStyle, FontViewModel.FontWeight, FontViewModel.FontStretch, FontViewModel.FontSize) + 30);
|
||||
break;
|
||||
}
|
||||
case nameof(Rate):
|
||||
case nameof(Priority):
|
||||
case nameof(LinkInfo):
|
||||
case nameof(Remark):
|
||||
{
|
||||
if (e is ValuePropertyChangedEventArgs valuePropertyChangedEventArgs)
|
||||
{
|
||||
if (valuePropertyChangedEventArgs.OldValue == null && valuePropertyChangedEventArgs.NewValue != null)
|
||||
{
|
||||
ItemWidth += 24;
|
||||
}
|
||||
else if (valuePropertyChangedEventArgs.OldValue != null && valuePropertyChangedEventArgs.NewValue == null)
|
||||
{
|
||||
ItemWidth -= 24;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user