Hello everyone. I have a question. How can i invoke a web service and get the result from a C# desktop application. I am making a desktop app and I want it to be able to connect to my online ASP.net web services. How is this possible?
...
I know that this question has been asked before, but I'm looking for a way to:
streamline the creation of safe cross-threaded code.
reuse this code in any situation (no Windows Forms references).
Here's what I have so far, but I want to remove the Windows Forms references. Any ideas?
public delegate void SafeInvokeDelegate(System.Ac...
In the course of my maintenance for an older application that badly violated the cross-thread update rules in winforms, I created the following extension method as a way to quickly fix illegal calls when I've discovered them:
/// <summary>
/// Execute a method on the control's owning thread.
/// </summary>
/// <param name="uiElement">Th...
Note: Part of a series: C#: Accessing form members from another class and How to access form objects from another cs file in C#.
Hello,
The Idea is to notify the user using the memo when a packet is received/sent in a TCP Client.
After couple of fixes,the most suitable solution seemed to be this one
public string TextValue
...
I am showing Dialogs with Form.ShowDialog(). Forms are set to TopMost. Some image processing calculations are performed asynchronly in the background. Their results are rendered in the main form by Invoke. So far so good. Strange thing is that every now and then the modal dialog is moved behind the main form. I guess that happens when th...
I've written a c# application to run an external program and i've redirectet it's output to a richtextbox in my form. I've created the process using the following settings
p1.StartInfo.RedirectStandardOutput = true;
p1.OutputDataReceived += new DataReceivedEventHandler(outputreceived);
and in the outputreceived event
void outputrecei...
Hello,
I use the code below to access the properties on my form,but today I'd like to write stuff to a ListView,which requires more parameters.
public string TextValue
{
set
{
if (this.Memo.InvokeRequired)
{
this.Invoke((MethodInvoker)delegate
{
...
Hello,
I couldn't describe the title of my question the best,I'm sorry.
Currently,I use Invoke to access the properties on my form,It works perfect,but I have a function for each property,which is quite not comfortable.
public static void EnableLogin(int enabled)
{
var form = Form.ActiveForm as FormMain;
if (for...
Similar to the KeyPress events, I want whoever is subscribed to the event to be able to set e.Handled in my EventArgs class. If they return true, I no longer want to continue firing events. Any ideas how to implement this? Right now, here is my method:
protected void OnDataReceived(SocketAsyncEventArgs e)
{
if (DataReceived != null)...
Hello,
I'd like to get the handle of my form from a different class(probably thread).
I want to do it the way I do invoke
public int GetHandle
{
get
{
if (this.InvokeRequired)
{
this.Invoke((MethodInvoker)delegate
{
return this.Handle.To...
Hi,
Using C# 2.0 and the MethodInvoker delegate, I have a GUI application receiving some event from either the GUI thread or from a worker thread.
I use the following pattern for handling the event in the form:
private void SomeEventHandler(object sender, EventArgs e)
{
MethodInvoker method = delegate
{
uiSomeT...
I can't believe it,this works in my other application,but in this one,which has similiar structure - it doesn't!
public string ListAdd
{
set
{
if (listView1.InvokeRequired)
{
this.Invoke((MethodInvoker)delegate
{
listView1.Items.Add(value...
Hello,
I always set the modifiers on my form to private,I don't like internal nor public.
Till now I used to Invoke like this:
public string Addtext
{
if(InvokeRequired)
{
Invoke((MethodInvoker)delegate
{
textbox.text = value;
});
}
else
textbox.text = value;
}
But addi...
This is a study project. I have three database classes A,B,C. There is a factory class that receives thru its constructor which class's object to create. Each of the three classes[A,B,C] has a constructor with a parameter to supply the database connection object. This is the code I'm using in the factory class's createObject method:
Typ...
I'm trying to put standard output from nmap into WPF window application (textbox exactly). I'm trying to use Dispatcher.Invoke but when nmap process starts everything just freezes. When I tried this in a console application (w/o Invoke), everything worked just fine, I think it's a problem with the Invoke method. Nmap itself is working, a...
PHP functions such as 'array_map' take a callback, which can be a simple function or a class or object method:
$array2 = array_map('myFunc', $array);
or
$array2 = array_map(array($object, 'myMethod'), $array);
But is there a syntax to pass a method which is bound within the iteration to the current object (like 'invoke' in Prototype.j...
Disclaimer: I'm completely clueless about .net and COM.
I have a vendor's application that appears to be written in .net and I'm trying to wrap it with a web form (a cgi-bin Perl script) so I can eventually launch this vendor's app from a separate computer. I'm on a Windows Server 2003 R2 SE SP1 system and I'm using Apache 2.2 for the...
I want to invoke methods with a certain attribute.
So I'm cycling through all the assemblies and all methods to find the methods with my attribute. Works fine, but how do I invoke a certain method when I only got it's MethodInfo.
AppDomain app = AppDomain.CurrentDomain;
Assembly[] ass = app.GetAssemblies();
Type[] types;
foreach (Assemb...
Hi,
I would like to code a proxy that forwards method invocations to another object over TCP without NSConnection and NSDistanceObject stuff. What I want is my own protocol.
The problem is that subclassing NSProxy and overriding forwardInvocation: is not sufficient. I have also to override methodSignatureForSelector
Here is my questio...
I am trying to use WebBrowser control to click a button that doesn't have any anchor text or anything
I looked at the source and saw this.
var _tm7 = new TabMenu(
'TempoTabMenuControl',
'TempoTabMenuControlRow', ['Add
Edit'], 0);
_tm7.Add(new TabMenuItem('View Menu', '/Edit/NewUI.html?tstudio=45',
'main'), true);
_tm7.Ad...