예제 #1
0
        private async void MyMainWindow_Closed(object sender, EventArgs e)
        {
            await TryStopHostAsync().ConfigureAwait(false);

            var v = TextBoxWriter?.DisposeAsync();

            if (v.HasValue)
            {
                await v.Value.ConfigureAwait(false);
            }
            PerformanceMonitor.Stop();
            Application.Current.Shutdown(0);
        }
예제 #2
0
        public MainWindow(IOptions <AppSettings> settings, PerformanceMonitor performanceMonitor)
        {
            InitializeComponent();

            PerformanceMonitor = performanceMonitor;

            Console.SetOut(new TextBoxWriter(this, txtConsoleOut));

            MyData = new Data()
            {
                Settings     = settings.Value,
                CanStartHost = true,
                CanStopHost  = false,
                HostState    = "网站未运行"
            };
            winMainWindow.DataContext = MyData;
            PerformanceMonitor.Start(MyData);

            tbiNotify.DoubleClickCommand          = new ShowMainWindowCommand(this, tbiNotify);
            tbiNotify.DoubleClickCommandParameter = null;
        }