42 lines
1.2 KiB
C#
42 lines
1.2 KiB
C#
using System;
|
|
using System.Windows;
|
|
using System.Windows.Controls;
|
|
using HandyControl.Controls;
|
|
using WolfOfWallStreet.Models;
|
|
using WolfOfWallStreet.ViewModels;
|
|
|
|
namespace WolfOfWallStreet.Views.Controllers
|
|
{
|
|
/// <summary>
|
|
/// Interaction logic for EasyTraderController
|
|
/// </summary>
|
|
public partial class EasyTraderController : UserControl
|
|
{
|
|
private Tag selecteTag;
|
|
public EasyTraderController()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void SymbolButtonBase_OnClick(object sender, RoutedEventArgs e)
|
|
{
|
|
|
|
if (sender is Button btn && btn.DataContext is Symbol symbol)
|
|
(DataContext as EasyTraderControllerViewModel)?.SelectSymbolCommand.Execute(symbol);
|
|
}
|
|
|
|
private void SymbolTag_OnSelected(object? sender, EventArgs e)
|
|
{
|
|
if (selecteTag != null)
|
|
{
|
|
selecteTag.IsSelected = false;
|
|
}
|
|
if (sender is Tag tag && tag.DataContext is Symbol symbol && DataContext is EasyTraderControllerViewModel viewModel)
|
|
{
|
|
viewModel.SelectSymbolCommand.Execute(symbol);
|
|
selecteTag = tag;
|
|
}
|
|
}
|
|
}
|
|
}
|