|
Situation:
There is a page where left side has a menu which is static and right side has screens according to the menu selected. If I change something on the page and without saving the content I click on the other menu.
Requirment:
A popup should popup- "Do you want to save the content of the page", before it redirects to the page of the menu selected.
Conditions:
If I have saved the changes then,if I click on some other menu, the message should not popup.
If I save the changes made then again I change something on that page, then, the message should popup.
|
|
|
|
|
Does 'redirect' mean this is an ASP.NET question?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I think you need to be more specific to get an answer to this question. What is it that you want help with?
|
|
|
|
|
Hello everyone,
When we invoke Set/Reset/WaitOne method on an object instance of ManualResetEvent, do we need to make it thread safe? i.e. make sure only one thread is invoking Set/Reset/WaitOne by some synchronization approach, like lock or Monitor?
thanks in advance,
George
|
|
|
|
|
When WaitOne() is called by multiple threads, it will be placed in a queue. When ManualResetEvent 's Set() is called it will signal all the threads waiting in the queue. If you want to signal only one thread in the WaitOne() queue, you need to use AutoresetEvent instead.
|
|
|
|
|
Thanks N a v a n e e t h,
I think I have not made myself understood in my original question. My question is, when we invoke methods in ManualResetEvent, like Set/Reset/WaitOne, whether we need to synchronize the function call?
Here is some code to show my question, whether we need to write code like this?
lock (_SomeManualResetEventInstanceLock)
{
_SomeManualResetEventInstance.Set();
}
lock (_SomeManualResetEventInstanceLock)
{
_SomeManualResetEventInstance.Reset();
}
lock (_SomeManualResetEventInstanceLock)
{
_SomeManualResetEventInstance.WaitOne();
}
regards,
George
|
|
|
|
|
Read this[^]. The part about Thread Safety should help you.
Scott P
“It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.”
-Edsger Dijkstra
|
|
|
|
|
Thanks Scott,
After reading and learning, I think all the methods of ManualResetEvent is thread safe and no need to add lock, right?
regards,
George
|
|
|
|
|
George_George wrote: After reading and learning, I think all the methods of ManualResetEvent is thread safe and no need to add lock, right?
George if you can't understand this:
Thread Safety
This type is safe for multithreaded operations.
Then there is no hope for you.
led mike
|
|
|
|
|
Thanks led mike,
I appreciate your help.
regards,
George
|
|
|
|
|
An abstract class is a special kind of class that cannot be instantiated.No funciton definition can be done in these type of classes.
So what's the advantaghe to incorporate these kind of classes in our project?
If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!
|
|
|
|
|
As a base class.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
This is further to ur reply.
If i say , what's the need of such a base class , which doesnot have funciton definition , only contains funciton declaration.
I can also create such class , where i am defining the funcitons , further , i can override the base class functions , if needed.
Sir , Isn't that ?
If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!
|
|
|
|
|
For example, I wrote a paint program. All my paint tools derived from a Tool class. Tool is not useful, it merely defines the base. So, I don't want to be able to create Tool, only it's derived classes.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Pankaj Garg wrote: No funciton definition can be done in these type of classes.
What do you mean? It's quite possible to have methods and properties in the abstract class. The only limitation is that it cannot be instantiated. As previously stated you use them as base classes that can contain common functionality that all derived classes need/can make use of.
|
|
|
|
|
In addition to the answers already given, read up on Polymorphism[^] as it relates to OOP.
|
|
|
|
|
The abstract keyword is for classes which forms the base for other classes, but does not implement full functionality by itself. You can look at it as a safety net of sorts.
--
Kein Mitleid Für Die Mehrheit
|
|
|
|
|
Jörgen Sigvardsson wrote: but does not implement full functionality by itself
They usually don't, but they may.
|
|
|
|
|
Pankaj Garg wrote: An abstract class is a special kind of class that cannot be instantiated.
Correct.
Pankaj Garg wrote: No funciton definition can be done in these type of classes.
That is not correct.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Pankaj Garg wrote: you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!
But if you (for instance, don't take it personally) have a bad idea and tell me about it, and I give you back a better idea, we both end up with one idea. (Both instances of the bad idea get garbage collected.)
|
|
|
|
|
Yes,thats right you can make a class that its fundamental for other classes but you cant declare variable at this class you can use of it as parent class.
|
|
|
|
|
Helllo,
how can i create a notification in the system tray. this messsage should indicate that a new available update exists.
thanks
dghdfghdfghdfghdgh
|
|
|
|
|
You never bother to use google do you? :P
|
|
|
|
|
Normally, I wouldn't do this - but please read this[^] article, and act on it. You really need to follow the guidelines in the article (especially point 1 of the Content section).
|
|
|
|