using MECF.Framework.Common.RecipeCenter;
using CyberX8_Core;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
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;
namespace CyberX8_Themes.UserControls
{
///
/// RecipeLoad.xaml 的交互逻辑
///
public partial class RecipeLoadControl : UserControl
{
public RecipeLoadControl()
{
InitializeComponent();
}
public static readonly DependencyProperty SelectedRecipeNodeProperty = DependencyProperty.Register( "SelectedRecipeNode", typeof(RecipeNode), typeof(RecipeLoadControl),
new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.AffectsRender));
///
/// 当前选中recipe节点
///
public RecipeNode SelectedRecipeNode
{
get
{
return (RecipeNode)this.GetValue(SelectedRecipeNodeProperty);
}
set
{
this.SetValue(SelectedRecipeNodeProperty, value);
}
}
public static readonly DependencyProperty RecipeTypeProperty = DependencyProperty.Register(
"RecipeType", typeof(string), typeof(RecipeLoadControl),new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.AffectsRender));
///
/// recipe类型
///
public string RecipeType
{
get
{
return (string)this.GetValue(RecipeTypeProperty);
}
set
{
this.SetValue(RecipeTypeProperty, value);
}
}
public static readonly DependencyProperty RecipeNodesProperty = DependencyProperty.
Register("RecipeNodes", typeof(ObservableCollection), typeof(RecipeLoadControl));
public ObservableCollection RecipeNodes
{
get { return (ObservableCollection)this.GetValue(RecipeNodesProperty); }
set { this.SetValue(RecipeNodesProperty, value); }
}
private void Self_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
{
if (e.NewValue != null)
{
bool result = (bool)e.NewValue;
if (result)
{
if (!string.IsNullOrEmpty(RecipeType))
{
RecipeNodes = RecipeClient.Instance.Service.GetRecipesByType(RecipeType);
}
}
}
}
public static readonly DependencyProperty IsEngineeringModeProperty = DependencyProperty.Register(
"IsEngineeringMode", typeof(bool), typeof(RecipeLoadControl), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));
///
/// IsEngineeringMode
///
public bool IsEngineeringMode
{
get
{
return (bool)this.GetValue(IsEngineeringModeProperty);
}
set
{
this.SetValue(IsEngineeringModeProperty, value);
}
}
public static readonly DependencyProperty IsProductionModeProperty = DependencyProperty.Register(
"IsProductionMode", typeof(bool), typeof(RecipeLoadControl), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender));
///
/// IsProductionMode
///
public bool IsProductionMode
{
get
{
return (bool)this.GetValue(IsProductionModeProperty);
}
set
{
this.SetValue(IsProductionModeProperty, value);
}
}
private void TreeView_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs