|
|
@@ -5,6 +5,7 @@ using System.Collections.Generic;
|
|
|
using System.Collections.ObjectModel;
|
|
|
using System.Diagnostics;
|
|
|
using System.Linq;
|
|
|
+using System.Runtime.CompilerServices;
|
|
|
using System.Text;
|
|
|
using System.Threading.Tasks;
|
|
|
using System.Windows;
|
|
|
@@ -68,7 +69,31 @@ namespace PunkHPX8_Themes.UserControls
|
|
|
get { return (ObservableCollection<RecipeNode>)this.GetValue(RecipeNodesProperty); }
|
|
|
set { this.SetValue(RecipeNodesProperty, value); }
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ public static readonly DependencyProperty IsDummyLoadSelectedProperty = DependencyProperty.Register(
|
|
|
+ "IsDummyLoadSelected", typeof(bool), typeof(RecipeLoadControl), new FrameworkPropertyMetadata(false, new PropertyChangedCallback(OnItemsSourceChanged)));
|
|
|
+ /// <summary>
|
|
|
+ /// IsDummyLoadSelected
|
|
|
+ /// </summary>
|
|
|
+ public bool IsDummyLoadSelected
|
|
|
+ {
|
|
|
+ get
|
|
|
+ {
|
|
|
+ return (bool)this.GetValue(IsDummyLoadSelectedProperty);
|
|
|
+ }
|
|
|
+ set
|
|
|
+ {
|
|
|
+ this.SetValue(IsDummyLoadSelectedProperty, value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ private static void OnItemsSourceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
|
|
+ {
|
|
|
+ // 将 DependencyObject 转换为当前控件实例
|
|
|
+ if (d is RecipeLoadControl control)
|
|
|
+ {
|
|
|
+ control.UpdateRecipeNodes(); // 调用共用逻辑
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
private void Self_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
|
|
|
{
|
|
|
@@ -77,22 +102,7 @@ namespace PunkHPX8_Themes.UserControls
|
|
|
bool result = (bool)e.NewValue;
|
|
|
if (result)
|
|
|
{
|
|
|
- if (!string.IsNullOrEmpty(RecipeType))
|
|
|
- {
|
|
|
- RecipeNodes = RecipeClient.Instance.Service.GetRecipesByType(RecipeType);
|
|
|
- if ("dep".Equals(RecipeType))
|
|
|
- {
|
|
|
- ObservableCollection<RecipeNode> DqdrRecipeNodes = RecipeClient.Instance.Service.GetRecipesByType("dqdr");
|
|
|
- if (DqdrRecipeNodes != null)
|
|
|
- {
|
|
|
- foreach(var item in DqdrRecipeNodes)
|
|
|
- {
|
|
|
- RecipeNodes.Add(item);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
+ UpdateRecipeNodes();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -151,5 +161,20 @@ namespace PunkHPX8_Themes.UserControls
|
|
|
SelectedRecipeNode = null;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ private void UpdateRecipeNodes()
|
|
|
+ {
|
|
|
+ if (!string.IsNullOrEmpty(RecipeType))
|
|
|
+ {
|
|
|
+ if ("dep".Equals(RecipeType) && IsDummyLoadSelected)
|
|
|
+ {
|
|
|
+ RecipeNodes = RecipeClient.Instance.Service.GetRecipesByType("dqdr");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ RecipeNodes = RecipeClient.Instance.Service.GetRecipesByType(RecipeType);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|