|
Hope the article by rudy.net here[^] in CP will help you.
Regards,
Satips.
Don't walk in front of me, I may not follow;
Don't walk behind me, I may not lead;
Walk beside me, and just be my friend. - Albert Camus
|
|
|
|
|
Ok to start i'll tell you what im doing, I have a InterOpWindow class that i created. It basically allows me easy talking between Process's and Thread's allowing me to just send strings all over however i like.
eg, to setup a window to talk to:
<br />
InterOpWindow MyCommandWindow = new InterOpWindow("some_window_name");<br />
MyCommandWindow.evDataCommandRecieved += new InterOpWindow.delDataRecieved(OnDataCommandRecieved);<br />
<br />
static void OnDataCommandRecieved(string sData)<br />
{<br />
MessageBox.Show("Data: " + sData);<br />
}<br />
and to send data and check a window reference:
<br />
InterOpWindow.SendRemoteMessage("some_window_name", "my data message");<br />
InterOpWindow.CheckRemoteWindow("some_window_to_check");<br />
Nice and easy... just how i like it, im happy i got it working as i've only been C# coding for about 3 weeks heh.
Which is where i come to my problem with the timer class. What i assumed was fine was to keep enabling and disabling it to start and stop the monitoring process for command sending timeouts. However after the timer being used (and working) it seems to be 'dead' if i try to disable then enable it... the Tick event never fires.
Is the object being disposed? does it need a container to stay active? any thoughts would be great...
For now im just leaving it enabled for good and using a var to count around 3 ticks (1 second each) for timeout.
Of course i could have just stuffed up completely and its something small... ya never know
<br />
public class InterOpWindow : NativeWindow<br />
{<br />
...<br />
private Timer tmrTimeout = new Timer();<br />
...<br />
public InterOpWindow(string sLocalWindowName)<br />
{<br />
...<br />
tmrTimeout.Tick += new EventHandler(tmrTimeout_Tick);<br />
}<br />
}<br />
thats basically how i've set it up, any ideas would be great... thanks
Always more to learn, and i wouldn't have it any other way.
|
|
|
|
|
DMWhiteDragon wrote: Is the object being disposed?
Good guess. The MSDN documentation on Forms.Timer clearly states on Enabled:
"The timer is not subject to garbage collection when the value is true."
This means there are two ways to keep a Forms.Timer alive (i.e. not collected):
1. make sure it is running
2. make sure to keep a reference to it (in a private member of one of your classes
as opposed to in a local variable of a method that has returned)
|
|
|
|
|
Thanks for the reply, i swear i checked MSDN and google... but ya can't always get a straight thought in ya head when you a little fustrated
Seems i'll have to keep the way im doing it, as its already a private member of the class and its still being difficult.
I could use the API Timer i guess but that seems messy yes? Is there any other Timers hidden somewhere in this mind bogginly huge framework that might suit?
Always more to learn, and i wouldn't have it any other way.
|
|
|
|
|
Hi,
1.
There is also Threading.Timer and Timers.Timer; both of them run their handler
on a separate thread, not the GUI thread. And you must keep them alive too.
2.
I fail to see how exactly your timer might be collected: if you are able
to set its Enabled property true again, that means you are holding a reference,
so I believe something else is going on. If you need more help, show us the code !
|
|
|
|
|
Well i did some more testing
I moved the class to a new blank project and forced some timeouts and its working fine, enabled/disabled/enabled etc. Go figure :/
So its bound to be something else, i'll get onto the other coders in the project and perhaps break one of their arms for making me think my class was broke
Always more to learn, and i wouldn't have it any other way.
|
|
|
|
|
You dont need arm parts to fix a timer...
|
|
|
|
|
I don't know if I'm writing in the right topic but I hope it...
I've done a web site that allows file access only to certain users (registered). If a user is not logged in it has to do it before access to files.It works with cookies.
Is really simple to do this steps with the browser but I have no ideas on how to do it with c# code... I thought that I can do the login by calling the page login.aspx and to put the autenthication credential in the http body( POST METHOD). The question is: how can I do it?
I'd like to do: CALL FROM CODE THE URL "www.mywebsite.com/login.aspx?username=myid&password=pass"
(this is the GET method I'd like to use POST of http)
How can I intercept the data from the server?
Thanks to everyone will reply me...
|
|
|
|
|
Is this what you are after?
http://msdn.microsoft.com/msdnmag/issues/01/09/cweb/[^]
I assume you know how to read post/get submissions from a asp.net webpage... its a little hard to read your english so i assumed you want something similar to the link i posted?
-- modified at 22:54 Sunday 8th July, 2007
To give you a more 'workable' idea:
New C# Project, add a button and a listbox (make it fairly wide)
add a new using:
<br />
using System.Net;<br />
then add this to the button code:
<br />
WebRequest MyRequest = WebRequest.Create("http://mmo.shadowdevelopment.com/default.aspx?TEST=Bob");<br />
WebResponse MyResponse = MyRequest.GetResponse();<br />
<br />
for (int iC = 0; iC < MyResponse.Headers.Count;iC++ )<br />
{<br />
listBox1.Items.Add(MyResponse.Headers.Keys[iC] + ": " + MyResponse.Headers[iC]);<br />
}<br />
MyResponse.Close();<br />
Thats a link to a test page on my domain so it wont be up forever but as you can see there is a Set-Cookie: header you need to read this value and re-send it with any other request (and each time it will send a new one back) that will identify your requests with the correct session store on the server and allow you to do whatever you want while being logged in on a website using a normal c# application.
Always more to learn, and i wouldn't have it any other way.
|
|
|
|
|
cardy1 wrote: calling the page login.aspx and to put the autenthication credential in the http body( POST METHOD).
This[^] article was written to help you do exactly that!
/ravi
|
|
|
|
|
firs I want to thank you for replying me.
GIS stands for gegraphic information system.in this project as I told you I'm looking for a control in c# that has the ability to view any kind of map;also I want to define tools for zooming ,surching and etc.
|
|
|
|
|
Why not just use google maps ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
i need to know that if a C# application is maintainig a database and if data is entered in a mobile application built in j2me then how it can be done that the data entered will be stored in the C# application? i m anxiously waiting for replies.Thanks
regards
amna
regards
|
|
|
|
|
I'm not sure I follow, you seem to be talking about two apps connecting to the same data store. If this is true, it will just work, the j2me app updates the common database, and the C# app will find it the next time it reads it.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Christian Graus wrote: you seem to be talking about two apps connecting to the same data store
That is how I read it, too.
"That's no moon, it's a space station." - Obi-wan Kenobi
|
|
|
|
|
I want to print a form on wireless printer from windowsCE 5.0 device
with C# programming language in Visual Studio.net2003
-- modified at 17:18 Sunday 8th July, 2007
|
|
|
|
|
|
I'd imagine that normal printing code would work
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
The link Judah provided looks like a start. Like Christian said, shouldn't be any different. Just use what the framework offers and let the OS do the rest.
"That's no moon, it's a space station." - Obi-wan Kenobi
|
|
|
|
|
Is anybody now, how to get the date now from DateTime object or other data objects of C# class.
Thanks in advance.
|
|
|
|
|
|
Kevin I have tried this but it is not working in 2.0 in my visual express, is it working in yours?
|
|
|
|
|
With the advent of intellisence couldn't you have figured that one out for yourself?
It really depresses me the level of questions I see here. Does no one take the time to try and figure things out for themselves any more?
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
"I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless."
Ready to Give up - Your help will be much appreciated.
My website
|
|
|
|
|
At least he didn't say it was urgent, need answer now
only two letters away from being an asset
|
|
|
|
|
There was a deadline tho, he wanted to know today's date...
|
|
|
|