iWOWS/WolfOfWallStreet/Views/Controllers/OnlinePlusController.xaml.cs

52 lines
1.5 KiB
C#

using System;
using System.Windows;
using System.Windows.Controls;
using HandyControl.Controls;
using WolfOfWallStreet.ViewModels;
namespace WolfOfWallStreet.Views.Controllers
{
/// <summary>
/// Interaction logic for OnlinePlusController
/// </summary>
public partial class OnlinePlusController : UserControl
{
private Tag selecteTag = null;
public OnlinePlusController()
{
InitializeComponent();
}
private void SymbolButtonBase_OnClick(object sender, RoutedEventArgs e)
{
if (sender is Button btn && DataContext is OnlinePlusControllerViewModel viewModel)
{
viewModel.SelectSymbolCommand.Execute(btn.DataContext);
}
}
private void SymbolTag_OnSelected(object sender, EventArgs e)
{
if (selecteTag != null)
{
selecteTag.IsSelected = false;
}
if (sender is Tag tag && DataContext is OnlinePlusControllerViewModel viewModel)
{
viewModel.SelectSymbolCommand.Execute(tag.DataContext);
selecteTag = tag;
}
}
private void StackToggleButton_OnChecked(object sender, RoutedEventArgs e)
{
if (sender is RadioButton radioButton && radioButton.DataContext is int stock &&
DataContext is OnlinePlusControllerViewModel viewModel)
viewModel.Stock = stock;
}
}
}