How to run command when popup shows up? - prism

I need to execute a command when popup shows up, like Loaded event, how can I do that? Do I need to override PopupWindowAction or it's supported already?

An interaction request is normally raised from code - execute the command just before raising the request, if that's possible.
Or you can execute it from the constructor of your popup's view model, that should happen a litte later.
As a last option, you can react to the Loaded event of your popup's content.
Another last option would be to override PopupWindowAction.CreateWindow and attach a handler to execute your command, but I'd prefer one of the code-only options that work without the actual view.

Related

Add a close button for a task module in ms teams

I am investigating if it's applicable to have a cancel/ close button on our html page inside taskmodule so it can actually close the task module?
Yes, it's entirely possible to do this. Basically, in order to close your task module in any way, you make a call from within the web page (in script), to:
microsoftTeams.tasks.submitTask
submitTask takes two parameters. The first is any object you want to return back to the caller (whatever opened your task module). For instance, if you have a Tab in your app, and the Tab opens the task module to app a new entry to a database, you could pass that new item back to the opening Tab by passing it as microsoftTeams.tasks.submitTask(newItem);
You can see more about this here.
If you have nothing at all to send back, you can simply call microsoftTeams.tasks.submitTask(null);. In this case, it will do nothing but close the task module, which sounds like what you're trying to do.

InstallShield (Windows Installer) Action Text not being updated for Custom Action

I'm using installshield to develop an installer for a product and I'm having issues with the ActionText (the current action description) updating for my custom action.
I've followed these steps here: http://helpnet.flexerasoftware.com/installshield17helplib/ActionTextSettings.htm which make perfect sense, and should work, but my custom action doesn't update the action text in the UI.
I'm thinking that because my custom action runs and waits for a long running process to end, maybe it's blocking whichever thread is responsible for updating the action text.
Now I write it, it doesn't seem to make sense, but I don't know what else might do it!
The main details of the Custom Action are:
Filename & Command line: wscript.exe "invisible.vbs" "longrunningbatch.bat"
Return Processing: Synchronous
In-Script Execution: Commit Execution in System Context
And invisible.vbs contains:
CreateObject("Wscript.Shell").Run """" & WScript.Arguments(0) & """", 0, True
The above line should hide the shell window and the 'True' ensures the shell doesn't return until the batch file has finished running.
I've also added my custom action to the Action Text list as per the link and associated it with a string.
Should work right?
Anyone else experienced this at all?
Firstly, you'll need to brush up on your Windows Installer, because if you've changed an action from commit to deferred and that's OK with you then you've done something unusual. Deferred actions are for actions that modify the system in some way related to the install. Commit actions are to finalise any work that the associated deferred action has done (e.g. deferred action modifies some system file. Commit action deletes the backup of the unmodified system file). Additionally, if you have a deferred action then you should also have a rollback action which undoes any action done by the deferred action in the event that the user cancels the install or it fails.
The following two links should help point you in the right direction:
http://blogs.flexerasoftware.com/installtalk/2011/10/i-take-it-all-back-using-windows-installer-msi-rollback-actions.html
http://www.installsite.org/pages/en/isnews/200108/index.htm
Secondly, if all the custom action does is to update the action text in the progress dialog, then you don't need it at all. Flexera doesn't document this, but you can set the action text for any custom action you build through the direct editor. To do this, add entries in the "ActionText" table, where the "Action" column is the name of your custom action and the "Description" column is the text you want to display.
Ok,
So I found this post: http://community.flexerasoftware.com/archive/index.php?t-82772.html, which basically says that since my custom action was set to commit execution, the install was effectively finished at the time it was running, and therefore there's no point in updating the progress text.
So the fix for my situation is to move my custom action to just before InstallFinalize and switch to 'deferred execution'.
Hope this might help someone.

Handling windows button during Async BeginGetResponse in wp7

is there any way to handle the Windows button keypress within the *.Xaml.cs especially when the app is busy getting a request processed using an Asynchronous BeginGetResponse. is there a override handler like OnBackKeyPress?
What's the appropriate way to handle this use case? i'm already handling Application_Activated and deactivated in the App.Xaml.cs file for tombstoning.
You can't stop this from happening. When this happens the current page will get its OnNavigatedFrom override called so you could clean up your page and save state from this method.
Bear in mind that it won't be possible to tell whether this is due to the hardware Start key or if the user just navigated away by say pressing the Back key or tapping a button.
Update:
If you're trying to avoid a crash due to Fast App Switching interrupting your networking call you should rather handle this when you return to the application. Your WebRequest will be cancelled and you should handle this case as shown in this MSDN blog post.

How to show a Carbon dialog as part of a plugin for an application with an existing event loop?

I'm writing a plugin for an application and need to use Carbon to show a dialog. I have everything set up including the event handler, but I cannot possibly call RunApplicationEventLoop() because this would stall the host application.
How can I fix this? Will I need to create a separate thread and call RunApplicationEventLoop() from there?
-Joe
What makes you think you need to call RunApplicationEventLoop? The host app is presumably running an event loop, probably either using RunApplicationEventLoop or NSApplicationMain. By the way, would your dialog be modal? Modal is easier.

netServiceBrowserDidStopSearch not called

I'm now writing a Bonjour service listener class, according to the document here:
Currently, it seems working, I can receive "netServiceBrowserWillSearch:" and "didFindService:moreComing:" correctly. However, after a long wait, I cannot receive " netServiceBrowserDidStopSearch:" or "netServiceBrowser:didNotSearch:". Therefore I don't know that is the proper time for my delegate class to stop showing some UI.
Could anyone have an idea for this? Thanks.
NSNetServiceBrowser doesn't stop browsing (and call the -netServiceBrowserDidStopSearch: delegate method) until you explicitly tell it to by calling -stop. After it's found the initial services, it continues informing you as new matching services are added or old ones disappear.
How you handle this depends on how you want your app to behave. If you have a window that continuously shows the available services (e.g. like the Bonjour window in iChat), then it's best to let it continue, and contiuously update the list in response to delegate messages. If you've got more like a dialog that gets populated and then goes away once the user makes a selection (e.g like the system Add Printer... dialog), then you want to keep the browser running while it's displayed, then call -stop once the user dismisses it. If you're waiting to find just one specific service, then you can call -stop once you've found and resolved it.

Resources