I have experienced that it may work without invoke on one machine but it doesn't work on other machines (and took a long time trying to find that out with the assumption that part was not the problem). So it's better to use invoke regardless.
I am fixing to begin writing an app the obvious design is simple however it will most likely not scale very well. What I am trying to do is have an app that notifies a user when an action needs to be taken. My initial thought was to have a table that it read based on user and showed new actions. I will have about 1000+- user hitting this app I want it to be fairly close to real time. So my question is how are other doing this? I have read about WCF however it seems convoluted and possibly overkill. Another thought I had was to have a service running on a server that could send messages out to the other apps it would only need be a one way communication. Are there other ways to accomplish this? I have read WCF has quite alot of overhead as well is this correct? Thank you,
EDIT*** This a winforms app FYI. Humble Programmer
Unless all 1000+- users are on the same machine, then your app IS a "server".
I'm assuming the users are remote, however, so you need to consider how they will connect to your server app to receive push notifications.
What protocol will you use? For example, TCP/IP using sockets works but do you want every user solidly connected? What happens on disconnects? Who manages the firewall issues? etc...
I personally would use HTTP over TCP/IP. No firewall issues for most clients.
I would also probably use WCF since it comes with HTTP bindings that allow push notifications from a server. Sure you could roll your own HTTP server using IHttpHandler but since HTTP is request/reply and connectionless, you'd have to reinvent code that's already available out of the box with WCF.
I have a code generator that generates code, and if I use that to generate a different table with the different columns and replace the table name IntersectionPedSignalNotes with IntersectionSignageNotes.
I get the exact same xml code as above, the only difference is the table name. I am hoping to copy this code and paste it in the DataSet so that the new table IntersectionSignageNotes can be created, without me having to add table and columns manually.
Let me know if there are any ideas.
Thanks, but this is not what I am looking for, I am talking about pasting the xml code when DataSet is opened using "View Designer". Once I copy the xml code generated by code generator and paste it in the DataSet designer window it should create the table.
I'm building an application with a 3D render window in the middle of my main form. When the user holds the right mouse button, the cursor is hidden and the mouse is instead used to control the camera within the 3D window. The problem with this is that whilst the cursor is hidden, the mouse is still moving beyond the edge of my window, and eventually I will stop receiving MouseMove events. For this reason I need to set the cursor to it's previous position after handling the MouseMove event.
This won't work because changing the cursor position will cause more MouseMove events to be fired. I thought perhaps I could unsubscribe from the MouseMove event before setting the cursor position, and then resubscribe.
this.panel_RenderWindow.MouseMove -= this.onMouseMove;
Cursor.Position = prevMousePos;
this.panel_RenderWindow.MouseMove += new System.Windows.Forms.MouseEventHandler(this.onMouseMove);
The problem is this doesn't seem to be working correctly. I still get MouseMove events generated from moving the cursor programatically. I have a feeling I'm not unsubscribing the handler correctly. I would check this in the debugger, but I'm unable to find the event in the debugger.
Am I unsubscribing the event correctly, and if I am, is there a reason that this isn't working? Is there a better way to achieve this?
Note: a side-effect of the recursive MouseMove events is that the cursor moves until it gets to the top-left corner of the screen, at which point no further events are generated because the mouse can move no further.
This doesn't help me. The motivation behind wanting to change the cursor position is that if the user continues dragging the mouse (controlling the 3D camera) whilst the right mouse button is held, then the cursor will eventually leave my window, and I will stop receiving MouseMove events. I need to set the cursor position to the point where the user initiated the drag operation, so that as long as the right mouse button is held, the cursor will remain within my window.
I am aware that very large mouse movements will still be able to free the cursor, but this isn't likely to occur frequently and can be ignored.
Thanks, this sounds like what I'm looking for. There's a minor hitch though, I'm using a Panel control as my render window. It seems that this control doesn't inherit the IInputElement interface required for Mouse.Capture(). My second choice would be a PictureBox control, however that doesn't implement the interface either. Now the question becomes, what control implementing IInputElement can I use that would be suitable for rendering my 3D scene to?
I'm not familiar with WPF, so I can't help you in any specific way, however a quick glance brought me this sentence, which might help:
In particular, UIElement descends from Visual, which provides the lower-level graphics support for rendering a ContentElement to a rectangular region within a composited window, whereas ContentElement defers rendering so that concepts more common to document scenarios, such as flow and wrapping, are more easily supported. These two related classes also implement the common interfaces IInputElement and IAnimatable.
Now the cursor's position is reset correctly, however the problem of the recursive MouseMove events still remains - if I remove Cursor.position = prevMousePos, then my application continues to update in the background, however if I don't everything else freezes until I release the right mouse button - including the 3D render window where the user is expecting to see updates to the camera position. The event is definitely not being unsubscribed correctly, though I can't figure out the correct way.
EDIT: I've been googling for hours and this[^] is the only thread I could turn up that dealt with this specific issue, and the answer he get was less than helpful.
Why are you programatically moving the mouse cursor if the cursor is hidden? Only because you were not receiving mousemove events if the cursor left the panel, correct?
Just capture the mouse on the right button down event and release capture on the up event (of course the Panel class has the IInputElement interface needed for the Mouse.Capture() call - how else would you be handling other mouse input on your panel?).
Then your panel will receive all the mouse move events even if the cursor leaves the panel, so you don't have to move the cursor or unsubscribe/subscribe to the event.
In part, yes - I won't receive events when the mouse leaves the panel. That's the theory at least. I've done testing and it seems I still receive events even when the cursor is outside my panel, but when the mouse reaches the edge of the monitor, I will stop receiving MouseMove events, because the cursor will have nowhere further to go. At the moment, the user has to perform multiple click + drag operations to keep the camera rotating over long distances.
The other reason I want this behaviour is that when the right button is released, the mouse will appear in the same place the user initiated the operation, rather than some unexpected location across the screen.
As for IInputElement, I'm no C# expert, but my understanding is that Panel and PictureBox are Winforms controls, whereas IInputElement is a WPF interface. WPF has an Image control (similar to PictureBox, but with different behaviour) that would work well for me, but I can't figure out how to enable WPF controls in my project. All the WPF controls are greyed out. I've added the appropriate references but no luck.
Either way, I'm no longer certain that Mouse.Capture() is what I'm after anyway. Everything I've set out to accomplish here is working, with the exception of unsubscribing the event handler + resubscribing after changing the cursor position.
What is the best way(s) to send strings from java app to .net app?
I have a main c#.net project that runs .jar (java project). The java part must give strings (recognized speech) to the c# part. it's a desktop solution that runs on one computer.
So far I see the following ways to do this:
- use a temporary text file as a buffer;
- windows services;
- web services (imo it's a very bad option);
- free 3d-party tools like ikvm.net and others (tried many, won't work properly, bad option).
Sp what is the best and most effective (and simple) way to do the job?
I don't know if it qualifies as a socket, but I'd use a Named Pipe.
Named Pipes are used for communication between processes, more info here (wikipedia)[^]. MSDN[^]
I can't find a good article on it (for .Net 3.5) at the moment, I guess I'll have to owe you.
Last Visit: 31-Dec-99 18:00 Last Update: 26-Aug-16 11:21