using System.Windows;
using System.Windows.Media.Imaging;
using System.Windows.Media;

namespace ShanghaiEnvironmentalTechnology
{
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();


        }

        private static MainWindow _instance;
        public static MainWindow Instance
        {
            get
            {
                if (_instance == null || !_instance.IsLoaded)
                {
                    _instance = new MainWindow();
                }
                return _instance;
            }
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            string imagePath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Resources/sleep2.jpg");
            ImageBrush brush = new ImageBrush();
            brush.ImageSource = new BitmapImage(new Uri(imagePath, UriKind.Absolute));
            this.Background = brush;
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {

            Window1 mainWindow = new Window1();
            mainWindow.ShowDialog(); // 显示 MainWindow


            //this.Close(); // 如果您希望在打开新窗口时关闭当前窗口
        }

        private void Button1_Click(object sender, RoutedEventArgs e)
        {
            Window2 mainWindow = new Window2();
            mainWindow.ShowDialog(); // 显示 MainWindow


            //this.Close(); // 如果您希望在打开新窗口时关闭当前窗口
        }

        private void Button2_Click(object sender, RoutedEventArgs e)
        {
            Window3 mainWindow = new Window3();
            mainWindow.ShowDialog(); // 显示 MainWindow


            //this.Close(); // 如果您希望在打开新窗口时关闭当前窗口
        }

        private void Button3_Click(object sender, RoutedEventArgs e)
        {
            Window4 mainWindow = new Window4();
            mainWindow.ShowDialog(); // 显示 MainWindow


            //this.Close(); // 如果您希望在打开新窗口时关闭当前窗口
        }

        private void Button4_Click(object sender, RoutedEventArgs e)
        {
            Window5 mainWindow = new Window5();
            mainWindow.ShowDialog(); // 显示 MainWindow


            //this.Close(); // 如果您希望在打开新窗口时关闭当前窗口
        }

        private void Button5_Click(object sender, RoutedEventArgs e)
        {
            ParameterConfigWindow mainWindow = new ParameterConfigWindow();
            mainWindow.ShowDialog(); // 显示 MainWindow


            //this.Close(); // 如果您希望在打开新窗口时关闭当前窗口
        }
    }
}
