.net-4.5

Using asynchronous tasks to call synchronous WCF service

自作多情 提交于 2019-12-13 04:35:28
问题 I have a WCF service, called by a service client. I'd like to use the async / await constructs to wrap the call to this; however, the service and service client are .NET3.5. My solution to this is as follows: private async Task<ObservableCollection<MyEntity>> LoadData(ParamData param) { ServiceClient svc = new ServiceClient(); int results = 0; // Set-up parameters myParams = BuildParams(param); // Call a count function to see how much data we're talking about // This call should be relatively

Expand/Collapse Nested Repeater

*爱你&永不变心* 提交于 2019-12-13 04:12:53
问题 I am trying to implement a nested repeater with outer repeater showing categories (initially collapsed) and when user clicks + or - inner repeater expands/collapses. I have the repeaters but when I clicked on + both inner repeaters expanded. I tried to set the class name dynamically so only one would expand but now it sees I broke it. This is what I have and what I have tried (minus irrelevant stuff): <asp:Repeater runat="server" ID="rptCategoryList" OnItemDataBound="rptCategoryList

Looking for .NET 4.5 Progress<T> source code

时光毁灭记忆、已成空白 提交于 2019-12-13 02:56:30
问题 I don't have .NET 4.5 installed (and I can't install it). Where can I find the source code of the new System.Progress<T> class ? (Or someone kind enough, with the .NET 4.5 beta installed, to copy/paste the code) 回答1: Here is the output from ILSpy: using System; using System.Runtime; using System.Threading; namespace System { [__DynamicallyInvokable] public class Progress<T> : IProgress<T> { private readonly SynchronizationContext m_synchronizationContext; private readonly Action<T> m_handler;

Only the last MenuItem gets the Icon

我的梦境 提交于 2019-12-13 01:37:32
问题 I know there are other threads about this but in my case its a bit different. I like to use an icon from a separate resource assembly <MultiTrigger> <MultiTrigger.Conditions> <Condition Property="IsCheckable" Value="true" /> <Condition Property="IsChecked" Value="true" /> <Condition Property="Role" Value="SubmenuItem" /> </MultiTrigger.Conditions> <Setter Property="Icon"> <Setter.Value> <Image Margin="1,0" Width="16" Source="pack://application:,,,/MyResourceAssembly; component/Resources

Forms Authentication for WCF

喜夏-厌秋 提交于 2019-12-12 22:29:14
问题 How to secure my simple WCF service using FormsAuthentication concept ? The ServiceContract looks similar to this: [ServiceContract] public interface MovieDb { [OperationContract] string GetData(int value); [OperationContract] string Login(int value); [OperationContract] string Logout(int value); } I have used FormsAuthentication in my MVC 4 Application for authentication and authorization. All I could think of is like adding Authorize Filter attribute at the top of the ServiceContract class.

keep table(rows) together with OpenXML SDK 2.5

我是研究僧i 提交于 2019-12-12 20:56:21
问题 I'd like to generate multiple tables with 2 rows each inside of a word document. But I want to keep these two rows together (if possible). new KeepNext() on the first row doesn't work new KeepNext() on the last paragraph of the first row doesn't work new CantSplit() on the table doesn't work In all cases the second row (if too large) lands on the second page. A new CantSplit() on the last cell ( the one with large content) avoids a break of the cell. But none of the options avoids a split of

Complex Object won't return when using 'include' syntax in WCF with Entity Version 6

守給你的承諾、 提交于 2019-12-12 20:17:46
问题 Okay so this one has got me stumped as I just see that my client basically disconnects and terminates when returning an object with 'include'. However it works fine without that across a WCF SERVICE. The problem is that I really want those connected objects set up through navigation. Basically the code is a complex object return: public teCIF getCif(int aCifId) { using (CIFContainer context = GetCifContext()) { var thing = context.teCIFs .Include("Product_TYPE") .FirstOrDefault(i => i.CIF_ID

Task<WebResponse>.Wait lasts forever

天涯浪子 提交于 2019-12-12 18:15:26
问题 C#, .Net 4.5. I have a queue that contains objects which are to be processed. Processing includes obtaining data with the URL which specified in one of the fields of the object. In the course of operation the new objects can be added to the queue. When I tried to do the work with the network asynchronous, I faced with a problem. Here is a minimum code. public partial class Form1 : Form { private void button1_Click(object sender, EventArgs e) { string[] urls = { "http://www.stackoverflow.com/"

Deserialize JSON into custom list

心已入冬 提交于 2019-12-12 17:19:15
问题 I have this json: var x = [ [99,"abc","2dp",{"GroupNum": 0,"Total":[4, 1]}], [7,"x","date"], [60,"x","1dp",{"GroupNum": 1}], ... ] The following rules exist (let i refer to the inner list index): x[i][0] - mandatory item - always an integer x[i][1] - mandatory item - always a string x[i][2] - mandatory item - always a string x[i][3] - optional item - when it exists then it has the following rules: x[i][3].GroupNum - mandatory field - always an integer x[i][3].Total - optional field - when it

Windows 7 Tablet Button Double-Tap

落花浮王杯 提交于 2019-12-12 16:39:49
问题 I have developed an application to run on a Samsung Series 7 tablet. This application was developed using WPF, .NET 4.5, and C#. My problem is that sometimes a button does not receive input the first time it is tapped. For example, Window1 has a OpenWindow2Button on it that opens Window2. Close Window2 and then try to push DoSomethingElseButton. The first time I tap the button, nothing happens. The second time the button works like expected. The same problem also occurs when I tap a