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

77 lines
2.2 KiB
C#
Raw Normal View History

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

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-08-20 16:50:24 +08:00
private static readonly AboutControl about = new AboutControl();
private static readonly ThemeControl theme = new ThemeControl();
private static readonly MotionControl motion = new MotionControl();
private static readonly OtherControl other = new OtherControl();
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
2021-05-21 17:19:46 +08:00
/// <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;
2021-07-21 11:15:51 +08:00
case "Other":
RightCard.Content = other;
break;
2021-05-31 17:31:16 +08:00
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
}
}