初始化提交

This commit is contained in:
2025-09-19 17:42:11 +08:00
commit fde5919d99
84 changed files with 55570 additions and 0 deletions

View File

@@ -0,0 +1,59 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Forms;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace
{
/// <summary>
/// MainWindow2.xaml 的交互逻辑
/// </summary>
public partial class MainWindow2 : Window
{
public MainWindow2()
{
InitializeComponent();
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
Screen[] screens = Screen.AllScreens;
if (screens.Length > 1)
{
int screenIndex = 1;
this.Left = (int)(Screen.AllScreens[screenIndex].Bounds.Left / GetDpiScaleX());
this.Top = (int)(Screen.AllScreens[screenIndex].Bounds.Top / GetDpiScaleX());
this.Width = (int)(Screen.AllScreens[screenIndex].Bounds.Width / GetDpiScaleX());
this.Height = (int)(Screen.AllScreens[screenIndex].Bounds.Height / GetDpiScaleX());
}
else
{
this.Close();
}
}
public double GetDpiScaleX()
{
return VisualTreeHelper.GetDpi(this).DpiScaleX;
}
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
WebServer.Stop();
Screen[] screens = Screen.AllScreens;
if (screens.Length > 1)
{
Environment.Exit(0);
}
}
}
}