using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;

namespace SHH.CameraDashboard
{
    /// <summary>
    /// MainWindow.xaml 的交互逻辑
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private void TitleBar_MouseDown(object sender, MouseButtonEventArgs e)
        {
            if (e.ChangedButton == MouseButton.Left)
            {
                DragMove();
            }
        }

        private void BtnTheme_Click(object sender, RoutedEventArgs e)
        {
            var btn = sender as Button;
            if (btn != null && btn.ContextMenu != null)
            {
                // 设置菜单的目标为当前按钮（防止定位跑偏）
                btn.ContextMenu.PlacementTarget = btn;
                // 打开菜单
                btn.ContextMenu.IsOpen = true;
            }
        }
    }
}