MainWindow.xaml.cs 956 Bytes
using HHECS.DAQClient.ViewModel;
using Microsoft.Extensions.DependencyInjection;
using System.ComponentModel;
using System.Configuration;
using System.Windows;

namespace HHECS.DAQClient
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            this.DataContext = App.Current.Services.GetService<MainVM>();
            _ = bool.TryParse(ConfigurationManager.AppSettings["IsProductionEnvironment"], out var isProductionEnvironment);
            if (!isProductionEnvironment)
            {
                var txt = "(测试版)";
                this.Title += txt;
                NotifyIconContextContent.Text += txt;
            }
        }

        protected override void OnClosing(CancelEventArgs e)
        {
            this.Hide();
            e.Cancel = true;
        }
    }
}