delegates

CLLocationManager delegate method is not called in iOS4

Hi Buddies, I am currently working in Map and i find the current location in my application and displayed. Now i am working with iOS4. So the CLLocationManger delegate method is not calling in iOS4. But i could run my application in older version of Xcode 3.1.4. it works fine and delegate method also called properly. So how can i call t...

Passing a method call and its parameter to a different method

I am using an external automation library with bunch of APIs with either 1 or 2 parameters which randomly throws TargetInvocationException. Calling these APIs second or third time usually works. I therefore created two helper methods to encapsulate the multiple retry logic //Original API calls bool result1 = Foo1(true); int result2 = Fo...

iPhone Parsing JSON : delegate methods

Hi everyone. I'm using this JSON framework. It's working well but I would like to put a loading view on my main screen to show that the iphone is downloading datas. I have searched for some delegate methode like - jsonBeginParse and - jsonEndParse but unsuccessfully. Have got an idea ? Thanks a lot ! ...

Using IComparer<> with delegate function to search

This feels like a too easy question to be found with google, I think/hope I've got stuck in the details when trying to implement my own version of it. What I'm trying to do is to sort a list of MyClass objects depending on my Datatype object different search functions should be used. I've had something like this in mind for the class Da...

Checkbox setState:0 on app launch

Hi, I'm having a problem with a checkbox. I want to set it to 0 (unchecked) on app launch, but the checkbox is controlled by another class "myClass" for example. Here's what I did: I opened Interface Builder and put a checkbox (NSButton) in my window, dragged NSObject in my MainMenu.xib window, renamed it to say "myClass". Added an o...

a race condition or not? delegates & multiple threads

Hi all, I'm puzzling over how multithreading can work with delegates. The main thread has an object "A", which has created an object "B". Object "A" is the delegate for object "B". Object "B" uses a thread to run the code. When object "B" wants to notify the delegate, it does: [[self delegate] performSelectorOnMainThread:@selector(di...

Is there any way to use C# methods directly as delegates?

This is more of a C# syntax question rather than an actual problem that needs solving. Say I have a method that takes a delegate as parameter. Let's say I have the following methods defined: void TakeSomeDelegates(Action<int> action, Func<float, Foo, Bar, string> func) { // Do something exciting } void FirstAction(int arg) { /* som...

iPad launch orientation when flat issues in app delegate

Like many people, I have a splash screen that animates off to reveal the first view of my app. I've been reworking this for the iPad and if you are holding the device in portrait or landscape modes, everything works as intended, the correct default image is used, the correct image that is used to animate this off is used, all orientation...

How to have a single UserControl added to baseform but with different event handlers for same event in the inheriting pages ?

Hi All, This is my application setup : I have a UserControls folder in my application inside which there is my .ascx file which happnes to contain just a simple ASP Button. I have not added any code in the code-behind of the ascx. I have a BaseForm.cs (just a C# class file and NOT an aspx file) which is inheriting from System.Web.UI.P...

Calculate repeater items which is in user control and display it in literal which is in page?

Hello experts, I've a scenario where I want to calculate the no of records in repeater which is in user control and display the count in a literal which is in page(ex default.aspx). How can I achieve this ? I don't wanna use public properties....i want to do it by creating my own custom event. Any help or suggestion would be highly app...

Problem with assigning delegates in for-loop

Hi. I have an application that is capable of plugins (MEF). The plugins are WPF UserControls that import services. The user can select the wanted plugin from the main menu of the application. To do this, i use the following loop: foreach(IToolPlugin Plugin in ToolPlugins) { Plugin.Init(); MenuItem PluginMenuItem = Plugin.MenuI...

jquery delegate problem with jquery templates

Hi all, I've been using the jQuery templates code (jquery.tmpl.js on github) and it's been working very well for me. However, I'm trying to attach events to the content using delegate and it's not working. Here is my simplified HTML structure after the templates are inserted: <!-- static in the html file --> <div id="container"> <!--...

Assigning IB textfields to delegate UITextField properties

I have three textfields in interface builder being used to accept input. When a button is pushed the data in the 3 fields are processed. Currently, when one of the textfields sends out a textFieldShouldReturn (or similar) message to its delegate, I assign the "sender" parameter (using the tag property) to the delegate's respective UIText...

How do I set up Delegates between my classes?

I'm working with a bit of code that is structured thusly: Form A has user controls B and G within it. User control B has User control D within it, and user control D has a "refresh" method. User control G has user control F within it, and user control F needs to call the "refresh" method in D. 1) Short of restructuring the code (It's l...

How can I handle custom events in iOS development?

We're working on a project using some custom views. We have the following hierarchy: UIViewController -> UIScrollView (custom subclass) -> UIView (custom subclass) We are presenting a grid of buttons that are dynamically generated. When a user taps one of the UIViews that belong to the custom scroll view we fire a method that looks lik...

.NET asynchronous delegates and object instance members

In using .NET asynchronous delegates for the first time, I was surprised to empirically discover that when changing an instance member value (e.g. an int) in the asynch method (running in the new thread), the value of the instance member running in the original thread was also changed. I thought that when a new thread is created, instan...

Implementing delegate methods for modal view controller data transfer

I have a simple project to present a modal view controller and transfer back a string based on which button in the modal VC that gets pressed. I based it all on watching the Stanford class on iTunes U. It looks like I have everything correct, but I get a couple of compiler warnings. First I get one called passing argument 1 of 'setDel...

Making an async call from an ASP.Net page-- recommended ways?

Hi everyone, We'd like to track who's on our website and what pages they're looking at. The plan is to create a delegate (which will log visits to a database table) and call it asynchronously. We're using .Net 3.5 and I don't know if the delegate idea, along with BeginInvoke and EndInvoke, is the way to go these days or if there are...

Multithreading and Delegates Execution

I created an object that has specific method to process different kind of events and will lived until my application is running. I also created individual delegates pointing to each methods and are referenced to x number of threads. Given y and z thread will invoke method1 by using a delegate pointing to it, will z thread wait for y thr...

what pattern should I use to couple .NET UI to a .NET library class that will provide callback updates

Hi, What's the best approach/pattern I should use for the following? Have a C# UI solution that will have (a) Winforms/WPF UI, and (b) class library. The UI will have to start a separate thread for the routine in the class library that will be polling The class library will then need to trigger a callback function in the UI to update ...