invoke

How to "invoke" a class instance in PHP?

Hi, is there any possibility to "invoke" a class instance by a string representation? In this case i would expect code to look like this: class MyClass { public $attribute; } $obj = getInstanceOf( "MyClass"); //$obj is now an instance of MyClass $obj->attribute = "Hello World"; I think this must be possible, as PHP's SoapClient a...

How Can I Avoid Invoking Every Event From My External Library?

I've written a library which handles all the TCP/IP comms with our custom embedded hardware. It is used with most of our in house software and in the future could possibly be sold separately. The most annoying thing this is that every time I handle events from the library, I have to have a seperate function to invoke through. I can only...

Invoke after async call changes two controls

I cannot find the solution for this problem, here is the simplified example: On a windows form I have 2 text boxes (invokeText1, invokeText2) and two buttons (invokeButton1, invokeButton2). There are both button clicks: private void invokeButton1_Click(object sender, EventArgs e) { Form1.GetVersionCompleted += (object sender...

Invoking UI delegate causes UI to be hidden...

Hi, Suppose I have thread 1, the main window UI thread and thread 2, a login UI thread that is modal form. Now thread 1 executes a piece of code and wants to change a UI element in the login form so it invokes a delegate to change something in thread 2. But when it does so, the login form becomes hidden behind the main window and there...

How to invoke a method with a superclass.

I'm trying to invoke a method that takes a super class as a parameter with subclasses in the instance. public String methodtobeinvoked(Collection<String> collection); Now if invoke via List<String> list = new ArrayList(); String methodName = "methodtobeinvoked"; ... method = someObject.getMethod(methodName,new Object[]{list}); It w...

How to make Sleep on background thread work with Invoke

I have a PictureBox control on a Form that is supposed to draw something every 100ms. The background thread performs some calculation in a loop and after every iteration, it fires an event. Edited (as a reply to a comment): World world = new World(); void CreateBackgroundThread() { Thread backgroundThread = new Thread(world.Backg...

Input string was not in a correct format vb net

This is really confusing me as I'm not doing anything with Strings. This is the details the debugger gives back to me: System.FormatException was unhandled Message=Input string was not in a correct format. Source=System.Windows.Forms StackTrace: at System.Windows.Forms.Control.MarshaledInvoke(Control caller, Del...

PHP Callable Object as Object Member

I have a class Logger which, among other things has a method Log. As Log is the most common use of the Logger instance, I have wired __invoke to call Log Another class, "Site" contains a member "Log", an instance of Logger. Why would this work: $Log = $this->Log; $Log("Message"); But not this: $this->Log("Message"); The for...

Invoke C dll functions,structs and callbacks in C#

Below is the header file.can anyone please give a idea to call the callback function below. //Function Prototype int PASCAL EXPORT RegisterCallbackFunctions (TCallbacks CallbackFuncs); //Data Structure struct TCallbacks { LPONUSSDREQUEST m_pOnRequest; LPONUSSDRESPONSE m_pOnResponse; }; struct TData { DWORD m_dwCmd; BYTE ...

Asynchronous runtime method invocation

I am loading some assemblies at run time and invoking methods on them using Reflections (MethodInfo.Invoke). Now I want to make these calls asynchronous. So I am thinking of using Delegate.BeginInvoke(). But I am not sure how to create delegate instance by providing function name at run-time. (All examples I see have delegate instance t...

Which cross threading invoke function is better for a control that is inherited?

I have a relatively simple question regarding the best way to call the DataGridView.Rows.Add function when it is inherited into the current control. Which is the best way to make the call to the inherited control? Call it directly in the invoke or call it using recursive-like function? They both seem to produce the same result, a row get...

C# Multithreading -- Invoke without a Control

I am only somewhat familiar with multi-threading in that I've read about it but have never used it in practice. I have a project that uses a third party library that shares the status of an input device by raising events. The problem is, the way the library is written these events are raised from a different thread. My application doe...

Is this a right case for using the Threadpool?

Here's the setup: I'm trying to make a relatively simple Winforms app, a feed reader using the FeedDotNet library. The question I have is about using the threadpool. Since FeedDotNet is making synchronous HttpWebRequests, it is blocking the GUI thread. So the best thing seemed like putting the synchronous call on a ThreadPool thread, and...

Using ASP.NET MVC SubControllers with action parameters?

I am experimenting with MvcContrib subcontrollers. Looking at the example in the source, your parent controller (HomeController) takes an action which takes the subcontroller (FirstLevelSubController) as a parameter: public class HomeController : Controller { public ActionResult Index(FirstLevelSubController firstLevel) { ...

Control.Invoke fails at second call.

Hello! I'm developing a Windows Mobile 5.0 and above application with .Net Compact Framework 2.0 SP2 and C#. I have this code inside a method: if (listBox1.InvokeRequired) { Invoke(new MethodInvoker( delegate() { listaBox1 = listaBox2; listBox1.Visible = true; })); } else { listBox1 = listBox2; listBox1.Visible = t...

powershell - launching local apps fast

I am building a kiosk type config script on low-spec hardware. At the end of the script, it runs the various apps for the user to interact with. I currently use a plain Invoke-Command "path\to\app.exe". I want to get the interface up and running as quickly as possible. I want to launch the apps asynchronous. I know there there is star...

How to catch connection timeout exceptions from XSD-generated typed DataSets?

This might be a bit complicated, but bear with me. I have a Windows Forms app. It uses strongly typed DataSets via the XSD designer. I am running data access queries via an asynchronous thread, performed like so: // Calling it in code on the main thread: LoadDataList_WorkerCaller dataDelegate = new LoadDataList_WorkerCaller(LoadDataL...

Avoid calling Invoke when the control is disposed

I have the following code in my worker thread (ImageListView below is derived from Control): if (mImageListView != null && mImageListView.IsHandleCreated && !mImageListView.IsDisposed) { if (mImageListView.InvokeRequired) mImageListView.Invoke( new RefreshDelegateInternal(mImageListView.RefreshInternal))...

Will multiple Control.BeginInvoke/Invoke calls execute in order?

I need to know whether Control.BeginInvoke and Control.Invoke calls will execute in the order they are called. I have the following scenario: UI thread is blocked WCF thread calls Control.BeginInvoke WCF thread calls Control.Invoke (or possibly BeginInvoke again) UI thread is unblocked ?? The execution order of step 1-4 is guarantee...

Finding and invoking a generic overloaded method

How can I find a generic overloaded method? For example, Queryable's public static IQueryable<TResult> Select<TSource , TResult> ( this IQueryable<TSource> source , Expression<Func<TSource , int , TResult>> selector ); I've looked for existing solutions, and they're either not generic enough (are based on the method's parameters count...