currently i'm developing a WP7 that contacts a RemoteService within a BackgroundWorker. As Part of the communication the user needs to validate some Data (something like captcha). As the Communication is connection session based and synchronous i can not complete the background worker, ask the user and start a new communication to the server.
So the question is, is there any way to pause the BackgroundWorker, ask the User for input, pass that input into the BackgroundWorker and unpause the WorkerThread?
Thanks and kind Regards
Kornelis
You could use the MVVMLight Dialog message as described here to send a message to the View to ask it to prompt the user for a message.
In order to pause/unpause the background worker, you could wait on an AutoResetEvent in your background thread, and in the dialog's callback, signal the event to let the background worker know that the response has come back ...
Related
I've set up a workflow (with Slack Workflow Builder) to send a survey to a channel, asking for feedback. I want everyone to be able to answer it, but as soon as one person responds the workflow completes.
Going back to the setup I see the message "If you send this form to a channel, keep in mind that only one person can click the button to submit a response."
If I can't send to more than one person at a time, and I can't get multiple people in a channel to respond, is there any other workaround I could try?
I am trying to 'pause' a bot conversation and resume it via a ProActive Message.
The way I have been trying to do so is by ending the dialog turn to 'pause' the conversation. Following I'm using ContinueDialogAsync in my ProActive message to 'resume' the conversation. Below is how I'm doing this as part of the ProActive message:
DialogManager dialogManager = new DialogManager(this.resourceExplorer.LoadType<AdaptiveDialog>(this.resourceExplorer.GetResource("echobot-final.dialog")));
dialogManager.UseResourceExplorer(this.resourceExplorer);
dialogManager.UseLanguageGeneration();
var conversationStateAccessors = conversationState.CreateProperty<DialogState>(nameof(DialogState));
var dialogSet = new DialogSet(conversationStateAccessors);
dialogSet.Add(dialogManager.RootDialog);
var dialogContext = await dialogSet.CreateContextAsync(turnContext, cancellationToken);
However, when running the ContinueDialogAsync after the dialog turn had been ended previously, I run into this error:
System.NullReferenceException
HResult=0x80004003
Message=Object reference not set to an instance of an object.
Source=Microsoft.Bot.Builder.Dialogs.Adaptive
StackTrace:
at Microsoft.Bot.Builder.Dialogs.Adaptive.Generators.ResourceMultiLanguageGenerator.TryGetGenerator(DialogContext dialogContext, String locale, LanguageGenerator& languageGenerator)
I'm not getting this NullReferenceException though when removing the EndTurn from the dialog, so I believe I my dialogContext object should be correct?
Am I misunderstanding the concept of ending a dialog turn?
What is the correct approach to pause a conversation, and resume the conversation later?
In the Bot Framework, a turn is the time between the bot receiving an activity in an HTTP request and the bot responding to that request. Note that responding to an HTTP request is different from replying to an activity. The bot can reply by sending new activities to ABS in their own HTTP requests, and it can do this many times in a turn. The HTTP response is not another activity, it's just a status code (like 200 OK) that signifies the end of the turn.
There's not really a concept of a "dialog turn." There are "steps" in waterfall dialogs and adaptive dialogs, though they don't correlate to turns since a step can span multiple turns and a turn can span multiple steps. There is an "End Dialog Turn" action in adaptive dialogs which I think is what you're talking about, but it just ends the turn. The word "Dialog" may be superfluous/misleading there.
There also isn't really a concept of "pausing" a conversation. A conversation is understood to be a series of turns and activities exchanged between a bot and one or more users. Your bot always needs to know what to do about every request that reaches its endpoint, so it's up to you to define what pausing a conversation means.
I'm guessing you want the bot to respond differently or not respond at all while the conversation is paused. You will need some sort of bot state for the bot to know that it's paused for a given user or conversation, and dialogs use bot state so a dialog would do. Whatever you do to indicate to the bot that the conversation is paused, you can just undo it to unpause it. Just ending the turn won't work because that doesn't add anything to state and the next turn will start as soon as the user sends a message.
Is there a way in windows phone to track sent message event? i mean to say that whenever a message is sent then a function of my application execute
all i want is to execute a function whenever sent message button of windows phone is clicked?
If you open the message launcher (I don't remember the exact name), it'll open this screen and you have the event (something like application deactivated) and once the user sends the message, the screen should close and come back to your app (again another event is available at that point, activated).
So you'll have to play with the events to do something you like, IIRC there is no call back when the message button is clicked.
Here's a link with the lifecycle of apps
There is no API that notifies you if a message was sent (at least no open API). A similar question was asked here.
I am developing a application for Windows Phone 7 in which on a button click I need to first send some text messages and then make a call. But as both process are user dependent so I am not getting how should I make it such a way that unless user first finishes the sending messages my app should not initiate call. Because unless I do so it will give thread abort exception.
Thanks;
nil
With the current SDK there is no way to know if the SMS was actually sent. It could also have been changed by the user before being sent!
Lots of people have asked for this functionality (or similar but for other tasks). Let's hope it comes in a future update.
I believe you can't do it in parallel, because WP7 isn't really multitask.
Do you really need to do it in parallel?
Search for the events deactivated and activated. They are in App.cs.
After you make a call, and back to the program, the activated event will detect it, so you can add code there to send SMS.
Done in reverse way. First make a call and then when user comes back after tombstoning send an Email...but flag manipulation need to be saved in isolated storage.
I'd like to hook the event that is triggered when an application is trying to notify you of something (when its icon background turns orange and starts flashing) so that I can create my own custom notifications (like getting a text message or email)
For example I'd like to have an event triggered when I receive an instant message on my computer that will send a message to my phone so I can respond appropriately.
How would I go about doing this?
Preferably I'd like something that could hook any notification event (then do the filtering inside the application, and something that works on windows XP and up)
Thanks
Duplicate of How can I determine which taskbar application/windows are requesting user attention ? Anyway, use RegisterShellHookWindow and catch HSHELL_FLASH