Files
GeekDesk/Control/Windows/ConfigWindow.xaml.cs

85 lines
2.4 KiB
C#
Raw Normal View History

2021-05-20 17:33:49 +08:00

using GalaSoft.MvvmLight.Command;
using GeekDesk.Control.UserControls;
using GeekDesk.Control.UserControls.Config;
2021-05-20 17:33:49 +08:00
using GeekDesk.ViewModel;
using HandyControl.Controls;
using HandyControl.Data;
using System;
2021-05-21 17:19:46 +08:00
using System.Windows;
using System.Windows.Input;
2021-05-20 17:33:49 +08:00
namespace GeekDesk.Control.Windows
2021-05-20 17:33:49 +08:00
{
/// <summary>
/// ConfigDialog.xaml 的交互逻辑
/// </summary>
public partial class ConfigWindow
{
2021-05-31 17:31:16 +08:00
private static AboutControl about = new AboutControl();
private static ThemeControl theme = new ThemeControl();
private static MotionControl motion = new MotionControl();
2021-06-01 21:49:50 +08:00
public MainWindow mainWindow;
2021-05-31 17:31:16 +08:00
private ConfigWindow(AppConfig appConfig, MainWindow mainWindow)
2021-05-20 17:33:49 +08:00
{
InitializeComponent();
this.DataContext = appConfig;
2021-05-31 17:31:16 +08:00
RightCard.Content = about;
2021-05-20 17:33:49 +08:00
this.Topmost = true;
2021-06-01 21:49:50 +08:00
this.mainWindow = mainWindow;
2021-05-20 17:33:49 +08:00
}
2021-05-21 17:19:46 +08:00
/// <summary>
/// 移动窗口
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void DragMove(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
if (e.LeftButton == MouseButtonState.Pressed)
{
DragMove();
}
}
/// <summary>
/// 点击关闭按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Close_Button_Click(object sender, RoutedEventArgs e)
{
this.Close();
}
2021-05-26 17:19:04 +08:00
2021-05-31 17:31:16 +08:00
private void MemuClick(object sender, RoutedEventArgs e)
{
SideMenuItem smi = sender as SideMenuItem;
switch (smi.Tag.ToString())
{
case "Motion":
RightCard.Content = motion;
break;
case "Theme":
RightCard.Content = theme;
break;
default:
RightCard.Content = about;
break;
}
}
private static System.Windows.Window window = null;
public static void Show(AppConfig appConfig, MainWindow mainWindow)
{
if (window == null || !window.Activate())
{
window = new ConfigWindow(appConfig, mainWindow);
}
window.Show();
}
2021-05-20 17:33:49 +08:00
}
}