AccountTreeView.xaml.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using GalaSoft.MvvmLight.Messaging;
  2. using Muchinfo.MTPClient.Data.Enums;
  3. using System;
  4. using System.Windows.Controls;
  5. using System.Windows.Input;
  6. namespace Muchinfo.MTPClient.Account.Views
  7. {
  8. /// <summary>
  9. /// AccountTreeView.xaml 的交互逻辑
  10. /// </summary>
  11. public partial class AccountTreeView : UserControl
  12. {
  13. public AccountTreeView()
  14. {
  15. InitializeComponent();
  16. this.AccountInfo.IsSelected = true;
  17. TreeViewClick();
  18. //Messenger.Default.Register<string>(this, MessengerTokens.OrderCancelCommand, (args) =>
  19. //{
  20. // TreeViewClick();
  21. //});
  22. }
  23. private void TreeViewClick()
  24. {
  25. var treeItem = FunctionTreeView.SelectedItem as TreeViewItem;
  26. if (treeItem == null || treeItem.Tag==null) return;
  27. var tradeTreeMenu = TradeTreeMenu.AccountInfo;
  28. if (Enum.TryParse(treeItem.Tag.ToString(), out tradeTreeMenu))
  29. {
  30. Messenger.Default.Send(tradeTreeMenu, MessengerTokens.AccountFunction);
  31. }
  32. }
  33. private void TreeView_OnMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
  34. {
  35. TreeViewClick();
  36. }
  37. }
  38. }