|
Phil, I've just one question about your suggestion, and would appreciate you help as you've obviously spent time putting together something robust along the same lines.
At the moment, if I create multiple RTDServers, all the different calls to UpdateNotify() will be on the same thread. Is that correct? Should I thread them out, so that the initial calls can be made on separate threads?
Could I just create a delegate with the same signature as my RTDUpdates method and make a call to BeginInvoke in the UpdateNotify method to queue all the updates on the ThreadPool? (It doesn't matter if the updates are not processed in order). If I do something like that, do I need a dummy EndInvoke to close the AsyncWaitHandle?
When UpdateNotify is called, could I make a call to to a new method (one that calls the RefreshData method) with BeginInvoke, and then set up the RTDUpdates method as the callback method?
I'd appreciate any pointers you could give me on this, as I'm sure some of the above are illadvised for various reasons.
Best regards,
Tom.
|
|
|
|
|
I'm not certain I understand the design of your software system. Please give more specific details such as: Are there one or more executables creating the data that is to be displayed? Are there one or more executables reading and displaying this data? Is there any other processing besides getting the data ready for display?
When updating the UI from a separate thread, one should always use the delegate and begin invoke calls in the UI method for the reason that the UI processing will be done on the UI thread. You don't need to worry about calling the end invoke method, that method is called by the UI thread when it is finished and the clean up will ensue.
As for how to setup the delegates for the UI properly, you can read up on that in your help documentation. Look up the key word "delegates".
Phil
|
|
|
|
|
led mike wrote: I don't know what you are asking? You have still not supplied a complete description of your Problem/Goal. Surely putting values into member variables is not the end goal of your processing.
Thanks again for the help.
It's not the end goal, no. I set variables, do some processing and comparisons based on the updates, fir events, update a GUI, save a log etc. Everything after that is working perfectly. Once the variables are set with the updates, my application works as expected. The only problem is that I'm dropping updates. I'm collecting a value from an 'intray' in an external program - an intray that only has space to store one update. I need a thread that does nothing but collect updates, throw them onto a queue and return immediately.
Then I need to nofify a method that updates are on the queue, and get it to remove the updates in order, set variables accordingly and clear the queue. The problem is that I need to do that without 'locking the queue', because then my other thread will not return to collecting data from the external program in time. . . . Any ideas?
Best regards,
Tom.
|
|
|
|
|
tobriain wrote: Any ideas?
Might be a good time to condsider a Message Queue.
|
|
|
|
|
What does it mean? When are you supposed to use this?
|
|
|
|
|
it is part of an identifier, just like regular letters and digits.
Some people prefix an underscore (or even m_) to indicate a class member,
as opposed to a method's parameters. And lots of people dont like it.
|
|
|
|
|
Luc Pattyn wrote: And lots of people dont like it.
And I don't like this kind of people!
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Is there anything in the Dot Net framework 2 that would allow me to use a Queue Collection but where the data is read from and written to disk rather than kept in memory.
I want to be able to add a large amount of items to the queue (100,000+) and for the data in the queue to be stored on disk so that the data can be kept whwn when the application is off. I suppose it would be like a very small database.
Any idead would be greatly appreciated.
Many thanks,
Bara
|
|
|
|
|
Hi
Not sure I have enough information from you as this seems like quite a simple solution.
Can you not just use a streamwriter to write to a text file then regenerate the queue according to the order the info was written to the file
Hope this helps
Dan.
|
|
|
|
|
The simple answer is "No". At the very least an object that does this sort of thing may be available, but I have not heard of it yet.
However, if you look back to the old days of dBase and other simple data base programs, you could use the ideas from that era. Those ideas are that the records are stored to the HD and the location in the file is kept in another "index" file. This index file could be kept in memory easily and would provide a quick reference as to where the data is stored in the file.
As always, there are alternatives to this which others may well enlighten you about.
Phil
|
|
|
|
|
I am opening a word doc (in C#) and doing a find and replace after which i am using the .printout (below) - which is printing to a local pdf port. However, i get a popup to asking to click Save or Cancel. How do I bypass that?
object Background = true;
object Append = false;
object Range = Word.WdPrintOutRange.wdPrintCurrentPage;
object Items = Word.WdPrintOutItem.wdPrintDocumentContent;
object Copies = "1";
object Pages = "1";
object PageType = Word.WdPrintOutPages.wdPrintAllPages;
object PrintToFile = false;
object Collate = true;
object ManualDuplexPrint = false;
object NullObj = System.Reflection.Missing.Value;
oApp.Visible = true;
oApp.ActivePrinter = "Adobe PDF";
oDoc.ActiveWindow.PrintOut(ref Background, ref Append, ref Range, ref OutputFileName, ref NullObj, ref NullObj, ref Items, ref Copies, ref Pages, ref PageType, ref PrintToFile, ref Collate, ref NullObj, ref ManualDuplexPrint, ref NullObj, ref NullObj, ref NullObj, ref NullObj);
|
|
|
|
|
Doesnt Word do the same thing (show the save/cancel dialog) when you manually open
and print a document ? if that is still true, I dont expect there is a way around that.
|
|
|
|
|
I've always been lead to believe that if a file is opened the O/S will prevent other processes that try to open the same file.
However in .Net you can open a file and specify non-blocking access so that the file can be opened... how does this work? Is it some magic in .Net, or have I been misled about the role of operating systems.
|
|
|
|
|
Windows offers that protection as an option.
When opening a file you specify what operations you want to perform (mode=read, readwrite),
and what operations you allow others to perform in the mean time (share=none, read, readwrite).
This is available when using a .NET language such as C#, and also when using older
languages (fopen in C) and even with plain old Win32 functions such as OpenFile.
Now by default share=none, so open files behave as you are accustomed to.
But you can choose it differently.
|
|
|
|
|
Ah, thanks Luc.
Looks like I've been living a lie. Again.
|
|
|
|
|
How can I make a multiple row selection in a dataGrid, without using rowheaders?
I'm using visual studio.net 2003..
tnx in advance..
|
|
|
|
|
|
Hi,
I need to develop a website, but it needs to be in different labguages. I don't even know how it works? Where do I start coding, what do I look at, can some please help with some advice?
I will be using ASP.NET and C# 2.0, and hopefully 3.0.
Regards
ma se
|
|
|
|
|
Better Buy a Book related to Asp.Net 2.0 using C# and start learn and then Practice the Code as your Requirement.
Regards,
Satips.
|
|
|
|
|
Multi lingual websites can be done in a couple of different ways. One way is to store all text in database tables. So each page must query the database to figure out what text to display. I am not a big fan of that one, but it is one way of doing it. The other way is using resource files. You can seach for info on resource files. These files are using to store the different languages, then based off users broswer settings you can setup the site to use different resources.
Hope that helps.
Ben
|
|
|
|
|
Yah, I agree too. But if you have lot of statics pages with large text then you must create different pages for different languages.
|
|
|
|
|
Which part needs to be in different languages? Is the site going to be static content or more CMS style dynamic content? You need to provide more information.
|
|
|
|
|
Just make a website in your native language..
then add resource files to each web page
and on load.. check the current culture of the client and load the appropriate language related page
|
|
|
|
|
check www.asp.net and look around for Starter Kits
which help you to start....
Nav.
|
|
|
|
|
Hello,
Nowadays, i am constructing an aplication in C#. And i have to obtain information about:
- opended and closed ports
- privileges of groups of users
- updates
i have tried it using WMI but i wasn't be able to reach any important thing.
I would thank you a lot if you can help me.
|
|
|
|