Readdy Write  
0,00 €
Your View Money
Views: Count
Self 20% 0
Your Content 60% 0

Users by Links 0
u1*(Content+Views) 10% 0
Follow-Follower 0
s2*(Income) 5% 0

Count
Followers 0
Login Register as User

How to use Windows 10 UWP Core under WPF WinForms Applications

03.08.2018 (👁9836)

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 >--