using GalaSoft.MvvmLight.Messaging;
using Muchinfo.MTPClient.Data.Enums;
using System;
using System.Windows.Controls;
using System.Windows.Input;
namespace Muchinfo.MTPClient.Account.Views
{
///
/// AccountTreeView.xaml 的交互逻辑
///
public partial class AccountTreeView : UserControl
{
public AccountTreeView()
{
InitializeComponent();
this.AccountInfo.IsSelected = true;
TreeViewClick();
//Messenger.Default.Register(this, MessengerTokens.OrderCancelCommand, (args) =>
//{
// TreeViewClick();
//});
}
private void TreeViewClick()
{
var treeItem = FunctionTreeView.SelectedItem as TreeViewItem;
if (treeItem == null || treeItem.Tag==null) return;
var tradeTreeMenu = TradeTreeMenu.AccountInfo;
if (Enum.TryParse(treeItem.Tag.ToString(), out tradeTreeMenu))
{
Messenger.Default.Send(tradeTreeMenu, MessengerTokens.AccountFunction);
}
}
private void TreeView_OnMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
TreeViewClick();
}
}
}