public MainWindow() { InitializeComponent(); btnConsole.Visibility = StartupCommands.Console ? Visibility.Visible : Visibility.Hidden; Height = 100; Width = 100; Top = -500; WindowStyle = WindowStyle.None; if (!File.Exists(StartupCommands.Config)) { MessageBox.Show("配置不存在"); Close(); return; } var config = File.ReadAllText(StartupCommands.Config); try { var webview = new WebView(config) { HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch, }; main.Children.Add(webview); webview.Configurated += (_, e) => PlugInManager.OnWindowLoad(this, webview); WebView = webview; //SetBinding(BackgroundProperty, new Binding("Background") { Source = webview }); } catch (Exception ex) { MessageBox.Show(ex.Message); Close(); } if (StartupCommands.Console) { ConsoleWindow.Initialize(); this.Closing += (_, x) => ConsoleWindow.Close(); } }
private void ShowConsole(object sender, RoutedEventArgs e) => ConsoleWindow.Toggle();