portable-class-library

How to define a more aggressive timeout for HttpWebRequest?

扶醉桌前 提交于 2019-11-27 22:26:00
Inside a Portable Class Library, I've the following method which post data to a specific Url. The method works great. However I'd like to specify a more aggressive timeout (the default is 100 seconds). Considering that there's no Timeout property on the HttpWebRequest class from the Portable Class Library, how can I make sure that the call is abandoned if it takes longer than a few seconds? public async Task<HttpResponse> PostAsync(Uri uri, string data) { HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri); request.Method = "POST"; request.ContentType = "application/x-www-form

How to implement progress reporting for Portable HttpClient

做~自己de王妃 提交于 2019-11-27 20:17:54
I'm writing a library with intentions to use it in desktop (.Net 4.0 and up), phone (WP 7.5 and up) and Windows Store (Windows 8 and up) apps. The library has the capability to download files from the Internet using Portable HttpClient library, and report the progress of the download. I search around here and the rest of the internet for documentations and code sample/guidelines on how to implement the progress reporting, and this search led me to nowhere. Does anyone has an article, documentation, guideline, code sample or whatever to help me achieve this? I wrote the following code to

Is there an alternative to AppDomain.GetAssemblies on portable library?

♀尐吖头ヾ 提交于 2019-11-27 16:23:07
问题 I'm looking for a way to get the current app's assemblies inside a portable library project. In classic library project, the code line below do the job: var assemblies = System.AppDomain.CurrentDomain.GetAssemblies(); But seems that System.AppDomain is not available to portable library. Does anyone know a way to get the current domain assemblies on portable library? 回答1: You can use platform hooks: In your portable library: using System.Collections.Generic; namespace PCL { public interface

MonoDevelop: is it possible to switch PCL's compiler?

左心房为你撑大大i 提交于 2019-11-27 16:21:09
问题 We are starting a cross-platform project to be deployed to Android and iOS. Obviously, a lot of code is to be shared between the two, and some of the code relies heavily on the .NET framework items, like sqlite-net library does. The best way (afaik) to share the code between 2 projects is to use a PCL – this way it is possible to reference the project with shared code from both iOS and Android projects in a solution and have everything re-compiled and linked in a nice manner. However, a PCL

Is there any way I can implement IValidatableObject on Portable Class Library Project?

删除回忆录丶 提交于 2019-11-27 15:37:43
I would like to ask about a doubt I have concerning to Portable Class Library. I'm developing a DAL Layer and I'm using Portable project for my business objects, this project is target to .Net Framework 4.03 and higher, SilverLight 4 and higher and .Net for Windows Store Apps. I would like to implement IValidatableObject interface on each of my business objects, but even when System.ComponentModel.DataAnnotations is available for the frameworks this project is targeted to, I haven´t access to IValidatableObject interface, is not available on the .net portable framework, neither MetadataType

Building Portable Class Library Project in build server fails

梦想的初衷 提交于 2019-11-27 14:22:20
I've recently added some custom Portable Class Library projects to an application that is built in an build server. The build was working fine, but after that it stopped working and shows me the following messages: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets(983, 5): warning MSB3644: The reference assemblies for framework ".NETPortable,Version=v4.0,Profile=Profile136" were not found. C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets(1578, 5): warning MSB3270: There was a mismatch between the processor architecture of the project being built

Convert a PCL to a regular Class Library

我怕爱的太早我们不能终老 提交于 2019-11-27 13:57:27
I currently have a Portable Class Library whose code is entirely compatible with a regular Class Library without any modification. I was wondering if there was an existing software to do the conversion automatically ; I looked into the Visual Studio tools but could not find any suitable. Before writing my own I just wanted to be sure! The differences will be in your .proj file. Having tried it myself you will have to do all of the following; Remove the <TargetFrameworkProfile> element Remove the <ProjectTypeGuids> element Change where you have #2 (below) for what I shown in #1 1. Regular class

Portable class library equivalent of Dispatcher.Invoke or Dispatcher.RunAsync

别来无恙 提交于 2019-11-27 13:14:27
问题 In .NET, Windows 8 and Windows Phone 7 I have code similar to this: public static void InvokeIfRequired(this Dispatcher dispatcher, Action action) { if (dispatcher.CheckAccess()) { action(); } else { dispatcher.Invoke(action); } } How would I do something in the portable class library? It would be nice to have one platform agnostic implementation of this. My idea is to use the TPL which is not available in WP7 but definitely will be soon. // PortableDispatcher must be created on the UI thread

Referencing a .NET Standard library from a Windows Class Library

喜夏-厌秋 提交于 2019-11-27 13:01:10
问题 There are two projects in my solution currently: a Windows Class Library (targeting .NET Framework 4.6.1) and another class library that targets .NET Standard 1.3. I'm using Visual Studio 2015 Update 3. I've added a reference to the .NET Standard project from the other project and it appears in the list of references, but I can't see any of the classes or namespaces from the referenced library when I want to use them (even though the referenced library was successfully built and has no errors

Difference between .Net Core, Portable, Standard, Compact, UWP, and PCL?

那年仲夏 提交于 2019-11-27 10:52:10
I've heard of .Net Core .Net Portable .Net Standard .Net Compact Universal Windows Platform Portable Class Libraries All of these were explained to me as "a subset of the full .Net that allows you to target multiple platforms" . So my questions are What's the difference!? If I want to write a library that's usable to as large an audience as possible, which one (or more than one) of these do I need to use? (My specific situation: I have a library that targets .Net 2.0, .Net 4.5, and UWP. Targeting UWP required creating a new VS project and linking all the existing files, which is a huge pain.