delegates

making asynchronous calls from generic handler (.ashx)

爱⌒轻易说出口 提交于 2019-12-22 03:44:55
问题 I have a form in my website which posts json to the async handler which validates the data and return back the resonse OK or error and i will make the redirect on the client based on the response give by my handler. But when the response is ok, i want to perform some tasks asynchronously. But the asynchronous calls are not working inside the .ashx code. it is always synchronous. Could you please give me an advice on this.? code: public class ValidateHandler : IHttpHandler,

How to delegate telerik grid view common methods to be call from parent page from every child page?

喜欢而已 提交于 2019-12-22 02:02:43
问题 I am using Telerik Gridview for displaying list of records and i have more than 10 pages on which i am using this gridview with this following common events code copy pasted(with some minor changes) on all this pages: protected void Page_Load(object sender, EventArgs e) { DisplayRecords() } public void DisplayRecords() { //Grid view names are different on different pages. GridView1.DataSource=Fetching records from database. GridView1.DataBind(); } protected void GridView1_SortCommand(object

Cannot convert from 'method group' to 'System.Action<object>' error

无人久伴 提交于 2019-12-22 01:47:03
问题 I have created the following function: public void DelegatedCall(Action<Object> delegatedMethod) And defined the following method public void foo1(String str) { } However, when I try to call DelegateCall with foo1 : DelegatedCall(foo1); ...I get the following compiler error: Argument 1: cannot convert from 'method group' to 'System.Action<object>' What is the reason for this error and how can I correct it? Unfortunately, casting foo1 to Action is not an option. 回答1: DelegatedCall expects a

Registering a handler for an event on the current class with a custom delegate

若如初见. 提交于 2019-12-21 20:45:28
问题 I defined an event on my class and I want to make one of the methods of the class a handler for the event. This is what I have so far: using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace DelegatesAndEvents { class Program { static void Main(string[] args) { Person p = new Person(); p.NameChangeEventHandler += new Person.NameChangeEventHandlerDel; p.Name = "Paul"; } } class Person { #region Events public delegate void NameChangeEventHandlerDel(object

Apple Push - didReceiveIncomingPushWithPayload not called - instead error: Failed sending message to client

六月ゝ 毕业季﹏ 提交于 2019-12-21 20:28:34
问题 I have an app that uses pushkit (voip push). Most of the time the pushes get through. But when there is a lot of traffic, the pushes don't get through to the app. I am in a state where I can somehow reproduce the error. I used the extended logging from here: https://developer.apple.com/library/ios/technotes/tn2265/_index.html And I found this to examine the logging: http://iosdevelopertips.com/core-services/debug-failed-push-messages-by-logging-apsd-process.html Still, I got two different

When using delegates, need better way to do sequential processing

天涯浪子 提交于 2019-12-21 19:45:09
问题 I have a class WebServiceCaller that uses NSURLConnection to make asynchronous calls to a web service. The class provides a delegate property and when the web service call is done, it calls a method webServiceDoneWithXXX on the delegate. There are several web service methods that can be called, two of which are say GetSummary and GetList. The classes that use WebServiceCaller initially need both the summary and list so they are written like this: -(void)getAllData { [webServiceCaller

Expression tree depth limitations

假如想象 提交于 2019-12-21 17:39:03
问题 I'm facing a problem trying to call Compile() on the LambdaExpression of type Expression<Func<MyType, bool>> which has a depth around 400. And lesser values do not cause any problems. And I can't find anything about such kind of limitation. Can anyone clarify this? Can I increase this limit? upd: Sorry, forgot to mention, I'm getting StackOverflowException: An unhandled exception of type 'System.StackOverflowException' occurred in System.Core.dll {Cannot evaluate expression because the

Action, Func and Predicate delegates - C# [duplicate]

放肆的年华 提交于 2019-12-21 17:24:06
问题 This question already has answers here : Delegates: Predicate Action Func (8 answers) Closed 5 years ago . I'm trying to understand the differences between the Action<T>, Func<T> and Predicate<T> delegates as part of my WPF/MVVM learning. I know Action<T> and Func<T> both take zero to one+ parameters, only Func<T> returns a value while Action<T> don't. As for Predicate<T> - I have no idea. Therefore, I came up with this following questions: What does Predicate<T> do? (Examples welcomed!) If

UITextField doesn't end editing when Button clicked( delegate textFieldDidEndEditing )

主宰稳场 提交于 2019-12-21 17:18:40
问题 I have two textFields on the screen and a Submit button . User inputs details in first textField and then the second one. My requirement is to end the editing when Submit button is clicked and print the user inputs in these textFields .I am having issues printing the second textField's value, as the editing never seems to end when the user clicks the Submit button . Here is my code. Appreciate your help on this issue (I have added the textfield delegate) import UIKit class ViewController:

Passing data between UIPageViewController Child views with Swift

心已入冬 提交于 2019-12-21 15:09:12
问题 I cant seem to find a specific answer to my direct dilemma. I have a UIPageViewController that programmatically loads through 6 child UIView scenes. They host various stages of an 'add' element functionality. Currently the PageViewController Class adds each child view into an array and instantiates them when required with: storyboard?.instantiateViewControllerWithIdentifier("editViewController") The natural delegate is set-up to swipe between each child scene and therefore no "