Browse Source

广告显示

Lishi
xxe 2 years ago
parent
commit
3e2d6db123
5 changed files with 72 additions and 0 deletions
  1. +1
    -0
      HKCardOUT/HKCardOUT.csproj
  2. +13
    -0
      HKCardOUT/ViewModels/AdWindowViewModel.cs
  3. +21
    -0
      HKCardOUT/Views/AdWindow.xaml
  4. +35
    -0
      HKCardOUT/Views/AdWindow.xaml.cs
  5. +2
    -0
      HKCardOUT/Views/RootView.xaml.cs

+ 1
- 0
HKCardOUT/HKCardOUT.csproj View File

@@ -26,6 +26,7 @@
<PackageReference Include="HandyControls" Version="3.4.1" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0" />
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.1343.22" />
<PackageReference Include="Quartz" Version="3.4.0" />
<PackageReference Include="Stylet" Version="1.3.6" />
<PackageReference Include="SqlSugarCore" Version="5.1.2.7" />


+ 13
- 0
HKCardOUT/ViewModels/AdWindowViewModel.cs View File

@@ -0,0 +1,13 @@
using Stylet;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HKCardOUT.ViewModels
{
public class AdWindowViewModel : PropertyChangedBase
{
}
}

+ 21
- 0
HKCardOUT/Views/AdWindow.xaml View File

@@ -0,0 +1,21 @@
<hc:Window
x:Class="HKCardOUT.Views.AdWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:hc="https://handyorg.github.io/handycontrol"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:view2="clr-namespace:Microsoft.Web.WebView2.Wpf;assembly=Microsoft.Web.WebView2.Wpf"
xmlns:viewModels="clr-namespace:HKCardOUT.ViewModels"
Title="海科智慧一卡通平台"
d:DataContext="{d:DesignInstance Type=viewModels:AdWindowViewModel}"
ShowMaxButton="False"
ShowMinButton="False"
ShowTitle="True"
WindowStartupLocation="CenterScreen"
WindowState="Maximized"
mc:Ignorable="d">
<Grid>
<view2:WebView2 x:Name="view2" />
</Grid>
</hc:Window>

+ 35
- 0
HKCardOUT/Views/AdWindow.xaml.cs View File

@@ -0,0 +1,35 @@
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.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace HKCardOUT.Views
{
/// <summary>
/// AdWindow.xaml 的交互逻辑
/// </summary>
public partial class AdWindow : HandyControl.Controls.Window
{
public AdWindow()
{
InitializeComponent();
InitView2();
}
public async void InitView2()
{
await view2.EnsureCoreWebView2Async(null);
view2.CoreWebView2.Settings.AreDefaultContextMenusEnabled = false;
view2.CoreWebView2.Settings.AreDevToolsEnabled = false;
view2.CoreWebView2.NavigateToString("<html><body><div>hello world</div></body></html>");
}
}
}

+ 2
- 0
HKCardOUT/Views/RootView.xaml.cs View File

@@ -11,6 +11,8 @@ namespace HKCardOUT.Views
public RootView()
{
InitializeComponent();
AdWindow ad = new AdWindow();
ad.Show();
if (Screen.AllScreens.Count() >= 2)
{
Dispatcher.Invoke(() =>


Loading…
Cancel
Save