C# Inside one event handler, how to pause execution and wait for a second event to fire?How to block until an event is fired in c#Understanding events and event handlers in C#How to remove a lambda event handlerASP .NET Button event handlers do not fire on the first click, but on the second click after a PostBackEnsure jQuery event handler execution orderWhy is the button's event handler not firing?JQuery event handlers firing before event occursGeneric event handler not firing from dynamic buttonsJavascript Event Handler to Fire C# MethodAutoResetEvents locking main thread while waiting on event handlerPausing Main Thread Until Event Is Fired

How did researchers find articles before the Internet and the computer era?

Most important new papers in computational complexity

Donkey as Democratic Party symbolic animal

Skipping over failed imports until they are needed (if ever)

The Confused Alien

Why do changes to /etc/hosts take effect immediately?

Details of video memory access arbitration in Space Invaders

Does any Greek word have a geminate consonant after a long vowel?

How did installing this RPM create a file?

Was it really unprofessional of me to leave without asking for a raise first?

Create custom script for send mail in magento 1.9

How hard is it to sell a home which is currently mortgaged?

How can I deal with extreme temperatures in a hotel room?

How can I specify a local port when establishing SSH connections?

Why is Japan trying to have a better relationship with Iran?

Does the Pi 4 resolve the Ethernet+USB bottleneck issue of past versions?

cannot execute script while its permission is 'x'

Most elegant way to write a one shot IF

What does grep -v "grep" mean and do?

Do launching rockets produce a sonic boom?

Could human civilization live 150 years in a nuclear-powered aircraft carrier colony without resorting to mass killing/ cannibalism?

Who voices the character "Finger" in The Fifth Element?

What is "oversubscription" in Networking?

Is there a legal way for US presidents to extend their terms beyond four years?



C# Inside one event handler, how to pause execution and wait for a second event to fire?


How to block until an event is fired in c#Understanding events and event handlers in C#How to remove a lambda event handlerASP .NET Button event handlers do not fire on the first click, but on the second click after a PostBackEnsure jQuery event handler execution orderWhy is the button's event handler not firing?JQuery event handlers firing before event occursGeneric event handler not firing from dynamic buttonsJavascript Event Handler to Fire C# MethodAutoResetEvents locking main thread while waiting on event handlerPausing Main Thread Until Event Is Fired






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I have a DLL that return all information asynchronous to several event handler. When I press a button I call a series of functions in the DLL, but the next function should not be called until the previous function has fired the event handler.



Button_Click_Handler() 
LCV.Load() // Returns immediately, Fires OnLoaded or OnError when done.
// Pause execution here and wait the for OnLoaded or OnError event to fire.
LCV.Read() // Returns immediately, Fires OnCard Or OnError when done.
// Pause execution here and wait the for OnCard or OnError event to fire.
LCV.Put(x) // Returns immediately, Fires OnPut Or OnError when done.
// Pause execution here and wait the for OnPut or OnError event to fire.



Is there a way to wait for an event to fire without having to attach an event handler and use signalling? To spread out the flow through all event handler would be very messy and not easy to follow. If the code was in the event handlers themself, it has to know "what mode" it is in and execute different code snippets. As I said, extremely messy.










share|improve this question






















  • Normally you should use a semaphore like WaitOne : docs.microsoft.com/en-us/dotnet/api/… I like the socket asynchronous Server as a good example : docs.microsoft.com/en-us/dotnet/framework/network-programming/…

    – jdweng
    Mar 25 at 13:39











  • "Is there a way to wait for an event to fire without having to attach an event handler and use signalling?" Not really, but here's a relatively simple solution by Adam using TaskCompletionSource.

    – Idle_Mind
    Mar 25 at 14:12

















0















I have a DLL that return all information asynchronous to several event handler. When I press a button I call a series of functions in the DLL, but the next function should not be called until the previous function has fired the event handler.



Button_Click_Handler() 
LCV.Load() // Returns immediately, Fires OnLoaded or OnError when done.
// Pause execution here and wait the for OnLoaded or OnError event to fire.
LCV.Read() // Returns immediately, Fires OnCard Or OnError when done.
// Pause execution here and wait the for OnCard or OnError event to fire.
LCV.Put(x) // Returns immediately, Fires OnPut Or OnError when done.
// Pause execution here and wait the for OnPut or OnError event to fire.



Is there a way to wait for an event to fire without having to attach an event handler and use signalling? To spread out the flow through all event handler would be very messy and not easy to follow. If the code was in the event handlers themself, it has to know "what mode" it is in and execute different code snippets. As I said, extremely messy.










share|improve this question






















  • Normally you should use a semaphore like WaitOne : docs.microsoft.com/en-us/dotnet/api/… I like the socket asynchronous Server as a good example : docs.microsoft.com/en-us/dotnet/framework/network-programming/…

    – jdweng
    Mar 25 at 13:39











  • "Is there a way to wait for an event to fire without having to attach an event handler and use signalling?" Not really, but here's a relatively simple solution by Adam using TaskCompletionSource.

    – Idle_Mind
    Mar 25 at 14:12













0












0








0








I have a DLL that return all information asynchronous to several event handler. When I press a button I call a series of functions in the DLL, but the next function should not be called until the previous function has fired the event handler.



Button_Click_Handler() 
LCV.Load() // Returns immediately, Fires OnLoaded or OnError when done.
// Pause execution here and wait the for OnLoaded or OnError event to fire.
LCV.Read() // Returns immediately, Fires OnCard Or OnError when done.
// Pause execution here and wait the for OnCard or OnError event to fire.
LCV.Put(x) // Returns immediately, Fires OnPut Or OnError when done.
// Pause execution here and wait the for OnPut or OnError event to fire.



Is there a way to wait for an event to fire without having to attach an event handler and use signalling? To spread out the flow through all event handler would be very messy and not easy to follow. If the code was in the event handlers themself, it has to know "what mode" it is in and execute different code snippets. As I said, extremely messy.










share|improve this question














I have a DLL that return all information asynchronous to several event handler. When I press a button I call a series of functions in the DLL, but the next function should not be called until the previous function has fired the event handler.



Button_Click_Handler() 
LCV.Load() // Returns immediately, Fires OnLoaded or OnError when done.
// Pause execution here and wait the for OnLoaded or OnError event to fire.
LCV.Read() // Returns immediately, Fires OnCard Or OnError when done.
// Pause execution here and wait the for OnCard or OnError event to fire.
LCV.Put(x) // Returns immediately, Fires OnPut Or OnError when done.
// Pause execution here and wait the for OnPut or OnError event to fire.



Is there a way to wait for an event to fire without having to attach an event handler and use signalling? To spread out the flow through all event handler would be very messy and not easy to follow. If the code was in the event handlers themself, it has to know "what mode" it is in and execute different code snippets. As I said, extremely messy.







c# event-handling .net-4.5 event-wait-handle






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 25 at 13:26









Max KiellandMax Kielland

3,4917 gold badges42 silver badges80 bronze badges




3,4917 gold badges42 silver badges80 bronze badges












  • Normally you should use a semaphore like WaitOne : docs.microsoft.com/en-us/dotnet/api/… I like the socket asynchronous Server as a good example : docs.microsoft.com/en-us/dotnet/framework/network-programming/…

    – jdweng
    Mar 25 at 13:39











  • "Is there a way to wait for an event to fire without having to attach an event handler and use signalling?" Not really, but here's a relatively simple solution by Adam using TaskCompletionSource.

    – Idle_Mind
    Mar 25 at 14:12

















  • Normally you should use a semaphore like WaitOne : docs.microsoft.com/en-us/dotnet/api/… I like the socket asynchronous Server as a good example : docs.microsoft.com/en-us/dotnet/framework/network-programming/…

    – jdweng
    Mar 25 at 13:39











  • "Is there a way to wait for an event to fire without having to attach an event handler and use signalling?" Not really, but here's a relatively simple solution by Adam using TaskCompletionSource.

    – Idle_Mind
    Mar 25 at 14:12
















Normally you should use a semaphore like WaitOne : docs.microsoft.com/en-us/dotnet/api/… I like the socket asynchronous Server as a good example : docs.microsoft.com/en-us/dotnet/framework/network-programming/…

– jdweng
Mar 25 at 13:39





Normally you should use a semaphore like WaitOne : docs.microsoft.com/en-us/dotnet/api/… I like the socket asynchronous Server as a good example : docs.microsoft.com/en-us/dotnet/framework/network-programming/…

– jdweng
Mar 25 at 13:39













"Is there a way to wait for an event to fire without having to attach an event handler and use signalling?" Not really, but here's a relatively simple solution by Adam using TaskCompletionSource.

– Idle_Mind
Mar 25 at 14:12





"Is there a way to wait for an event to fire without having to attach an event handler and use signalling?" Not really, but here's a relatively simple solution by Adam using TaskCompletionSource.

– Idle_Mind
Mar 25 at 14:12












0






active

oldest

votes










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55338886%2fc-sharp-inside-one-event-handler-how-to-pause-execution-and-wait-for-a-second-e%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes




Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.







Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55338886%2fc-sharp-inside-one-event-handler-how-to-pause-execution-and-wait-for-a-second-e%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현