Skip to content

Commit

Permalink
Caller Test
Browse files Browse the repository at this point in the history
  • Loading branch information
ITAgnesmeyer committed Jun 18, 2020
1 parent 1b1ac77 commit 2e47ceb
Show file tree
Hide file tree
Showing 7 changed files with 130 additions and 75 deletions.
8 changes: 5 additions & 3 deletions DigaCoreTest/BrowserWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ protected override void InitControls()
this.Name = "BrowserWindow";
this.StatusBar = true;
this.IconFile = "Browser.ico";
this.Width = 600;
this.Height = 400;

this.Width = 800;
this.Height = 600;
this.StartUpPosition = WindowsStartupPosition.CenterScreen;


this._Browser = new NativeWebBrowser()
{
Expand Down Expand Up @@ -51,6 +52,7 @@ private void OnNaviationCompleted(object sender, NavigationCompletedEventArgs e)
}
private void OnNavigationStart(object sender, NavigationStartingEventArgs e)
{

this.Text = "Start-Navigate" + e.Uri;
}
private void OnDocumentTitleChanged(object sender, WebView2EventArgs e)
Expand Down
74 changes: 74 additions & 0 deletions DigaWinFormsTest/BrowserWindow.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
using System.Diagnostics;
using CoreWindowsWrapper;
using Diga.NativeControls.WebBrowser;
using Diga.WebView2.Wrapper.EventArguments;

namespace DigaWinFormsTest
{
class BrowserWindow : NativeWindow
{
private NativeWebBrowser _Browser;
protected override void InitControls()
{
this.Text = "WebBrowser";
this.Name = "BrowserWindow";
this.StatusBar = true;
this.IconFile = "Browser.ico";
this.Width = 800;
this.Height = 600;
this.StartUpPosition = WindowsStartupPosition.CenterScreen;


this._Browser = new NativeWebBrowser()
{
Width = this.Width,
Height = this.Height,
Url = "http://localhost:1",
IsStatusBarEnabled = true,
DefaultContextMenusEnabled = false,
DevToolsEnabled = false,
EnableMonitoring = true,
MonitoringFolder = ".\\wwwroot",
MonitoringUrl = "http://localhost:1/"
};
this._Browser.DocumentTitleChanged += OnDocumentTitleChanged;
this._Browser.NavigationStart += OnNavigationStart;
this._Browser.NavigationCompleted += OnNaviationCompleted;
this._Browser.WebResourceRequested += OnWebResourceRequested;
this.Controls.Add(this._Browser);
}
private void OnWebResourceRequested(object sender, WebResourceRequestedEventArgs e)
{
Debug.Print(e.Request.Uri);
}

private void OnNaviationCompleted(object sender, NavigationCompletedEventArgs e)
{
if (e.IsSuccess)
this.Text = e.IsSuccess + "->" + this._Browser.DocumentTitle;
else
this.Text = "Navigation-Error=>" + e.GetErrorText();

}
private void OnNavigationStart(object sender, NavigationStartingEventArgs e)
{

this.Text = "Start-Navigate" + e.Uri;
}
private void OnDocumentTitleChanged(object sender, WebView2EventArgs e)
{
this.Text = this._Browser.DocumentTitle;
}

protected override void OnSize(SizeEventArgs e)
{
if (e.Width == 0) return;
base.OnSize(e);
this._Browser.Left = e.X;
this._Browser.Top = e.Y;
this._Browser.Width = e.Width;
this._Browser.Height = e.Height;
this._Browser.DoDock();
}
}
}
43 changes: 36 additions & 7 deletions DigaWinFormsTest/DigaWinFormsTest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
Expand All @@ -33,6 +35,28 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="CoreWindowsWrapper, Version=1.0.4.1, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\CoreWindowsWrapper.1.0.41\lib\net472\CoreWindowsWrapper.dll</HintPath>
</Reference>
<Reference Include="Diga.Core.Api.Win32, Version=1.0.19.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Diga.Core.Api.Win32.1.0.19\lib\net472\Diga.Core.Api.Win32.dll</HintPath>
</Reference>
<Reference Include="Diga.NativeControls.WebBrowser, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Diga.NativeControls.WebBrowser.1.0.0\lib\net472\Diga.NativeControls.WebBrowser.dll</HintPath>
</Reference>
<Reference Include="Diga.WebView2.Interop.V9430, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Diga.WebView2.Interop.2.0.4\lib\net472\Diga.WebView2.Interop.V9430.dll</HintPath>
<EmbedInteropTypes>False</EmbedInteropTypes>
</Reference>
<Reference Include="Diga.WebView2.Wrapper.V9430, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Diga.WebView2.Wrapper.2.0.4\lib\net472\Diga.WebView2.Wrapper.V9430.dll</HintPath>
</Reference>
<Reference Include="MimeTypeExtension, Version=1.0.1.1, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MimeTypeExtension.1.0.1\lib\netstandard2.0\MimeTypeExtension.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
Expand All @@ -42,16 +66,10 @@
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="BrowserWindow.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Properties\Resources.resx">
Expand All @@ -63,6 +81,7 @@
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
Expand All @@ -77,4 +96,14 @@
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\Diga.WebView2.Wrapper.2.0.4\build\Diga.WebView2.Wrapper.targets" Condition="Exists('..\packages\Diga.WebView2.Wrapper.2.0.4\build\Diga.WebView2.Wrapper.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>Dieses Projekt verweist auf mindestens ein NuGet-Paket, das auf diesem Computer fehlt. Verwenden Sie die Wiederherstellung von NuGet-Paketen, um die fehlenden Dateien herunterzuladen. Weitere Informationen finden Sie unter "http://go.microsoft.com/fwlink/?LinkID=322105". Die fehlende Datei ist "{0}".</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Diga.WebView2.Wrapper.2.0.4\build\Diga.WebView2.Wrapper.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Diga.WebView2.Wrapper.2.0.4\build\Diga.WebView2.Wrapper.targets'))" />
</Target>
<PropertyGroup>
<PostBuildEvent>xcopy /S /Y $(SolutionDir)wwwroot\* $(TargetDir)wwwroot\*</PostBuildEvent>
</PropertyGroup>
</Project>
40 changes: 0 additions & 40 deletions DigaWinFormsTest/Form1.Designer.cs

This file was deleted.

20 changes: 0 additions & 20 deletions DigaWinFormsTest/Form1.cs

This file was deleted.

10 changes: 5 additions & 5 deletions DigaWinFormsTest/Program.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
using System;
using CoreWindowsWrapper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;


namespace DigaWinFormsTest
{
Expand All @@ -14,9 +15,8 @@ static class Program
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
BrowserWindow bw = new BrowserWindow();
NativeApp.Run(bw);
}
}
}
10 changes: 10 additions & 0 deletions DigaWinFormsTest/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="CoreWindowsWrapper" version="1.0.41" targetFramework="net472" />
<package id="Diga.Core.Api.Win32" version="1.0.19" targetFramework="net472" developmentDependency="true" />
<package id="Diga.NativeControls.WebBrowser" version="1.0.0" targetFramework="net472" />
<package id="Diga.WebView2.Interop" version="2.0.4" targetFramework="net472" />
<package id="Diga.WebView2.Wrapper" version="2.0.4" targetFramework="net472" />
<package id="MimeTypeExtension" version="1.0.1" targetFramework="net472" />
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net472" />
</packages>

0 comments on commit 2e47ceb

Please sign in to comment.