Integrate Windows Core functions into WPF
System.Runtime.WindowsRuntime.dll
Under c: \ Program Files (x86) \ Reference Assemblies \ Microsoft \ Framework \ .NETCore \ v4.5
And
Windows.winmd
C: \ Program Files (x86) \ Windows Kits \ 10 \ Union Metadata
Under the dialog: Reference Manger must then Windows.winmd and System.Runtime.WindowRuntime
Be marked with an active tick.
You will find the two entries under Solution Explorer-> Project-> References
System.Runtime.WindowsRuntime
Windows
Integrate the function under the program file:
To do this, you must now include the namespace of Windows 10 in the header
//< Windows 10 > using Windows.Web.Http; //</ Windows 10 >
|
Then you can use Windows 10 UWP methods
Here in the example a Window Core httpClient
(because deactivating the cache works here)
//--< Read HTML with httpClient >-- //-< HttpClient >- HttpBaseProtocolFilter filter = new HttpBaseProtocolFilter(); filter.CacheControl.ReadBehavior = HttpCacheReadBehavior.NoCache; filter.CacheControl.WriteBehavior = HttpCacheWriteBehavior.Default;
Windows.Web.Http.HttpClient client = new Windows.Web.Http.HttpClient(filter); //-</ HttpClient >-
//< read HTML > string sHTML = ""; //Client Request as string try { sHTML = await client.GetStringAsync(new Uri(sURL)); } catch (Exception ex) { //clsSys.show_Message(ex.Message); clsSys.fx_Log("Error httpClient: " + ex.Message); return null; } //</ read HTML > //--</ Read HTML with httpClient >--
|