I noticed the user is redirected back to our app after sending an email using the EmailComposeTask. Is there maybe a Completed event handler for this or someway to determine when the user returns back to our app?
The NavigatedTo event will be raised when the control comes back to your page.
Thanks,
Stefan Wick - Microsoft Silverlight
Yes there is a completed event handler.
Here is how to do it for CameraCaptureTask. EmailComposeTask should be the same.
Related
I've been playing around with proactive messaging, but I'm not sure how to achieve something like this. I've got a service that messages users products on a daily basis. Using a resumption cookie I call an end point, build a response by setting the .Text property and create the carousel of products by populating the .Attachments property. I want to add buttons to this message to allow a user to stop the alerts, but the only event a CardAction button allows is opening an URL in a web browser. Is there a way of creating a button which can trigger a method, or call a new dialog?
Any help will be greatly appreciated.
You can just use the ImBack or PostBack ActionTypes on the CardAction. Clicking on a button when using any of those, will send a message to the conversation with the Value of the action that will end up arriving to the method you are "waiting" (by doing context.Wait(...));
Then, in that method you can do whatever you want: call a new dialog or any other logic you want to trigger.
In the ContosoFlowers sample you can see how a card with buttons is used in that way.
So I used this example
http://facebooksdk.net/docs/phone/howtos/publish-to-feed/
And when I tap the button I made, it shares a preset link. How do I change it to a textbox i have in the app?
And I use this code:
App.RootFrame.Navigate(new Uri("/MainPage.xaml", UriKind.RelativeOrAbsolute));
To redirect back to the mainpage after posting a message on facebook. but if i tap the back button, it goes back to the previous page i used to post a message. how do I fix it?
You might be better using the phones built in share api. That way the user can share with any social network they've connected to on their phone.
http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh394009(v=vs.105).aspx
If you do need to do it the way you have then it sounds like you want to intercept the back button event.
http://msdn.microsoft.com/en-us/library/windowsphone/develop/microsoft.phone.controls.phoneapplicationpage.backkeypress(v=vs.105).aspx
You could change the navigation stack with NavigationService.RemoveBackEntry(); after you have navigated away from the posting page.
Perhaps it is possible to run RemoveBackEntry() on the on posting pages OnNavigatedFrom event.
when user close the web site that time i need to call some function here, what was the event for user close the page or browser in asp.net(C#).
You cannot do this with asp.net. The server does not know when the user closes the window. However you can use javascript, and attach an beforeunload event to the body tag.
window.onbeforeunload = function (e) {
//javascript code here
}
Here is a good SO thread on how this can be achieved.
There is no event in asp.net that could catch the event of user closing the window, because that happens on client-side. Your C# code runs on the server without any knowledge of the client's software.
There are some mechanisms using javascript and sending some data using ajax, but no one should rely on that.
I need to find a way to intercept browser closing and invoke a metod to update a record with several information about logged user in DB. It's very important this record is updated when the user is logging-out or when he close the browser. Obviously when the user clicks 'Logout' I handle the update in the server-side event, but what if the user simply exit from browser?
Someone suggest to use the window.onbeforeunload event and make an asynchronous call to some WS or WebMethod to execute the code, but this doesn't convince me at all: the problem with onbeforeunload is that it shows a confirm prompt. I need to avoid this message and simply invoke the method.
So I'm wondering if there is a 'server-side' solution without using ajax or javascript.
For example... a way to trigger some event on session abandon or session clear, or some other way to solve this problem just working on code-behind...
There is no way you could have a server-side solution to know something that happens in the client browser.
I do not believe there is any way to do what you need server-side only. Client side is the only way. Server has no way of knowing when browser window was closed, this is limitation of HTTP protocol.
Yes, you can put an event in the Global.AsaX which will fire when the session ends. Now if you need data from the client to update the db etc., you'll need a way of getting it there, but if not, then the Session_End will do the trick.
Note: Session end is slightly different than the browser closing, so it this will depend on what you want the event firing to do.
How to handle session end in global.asax?
I'd like to find a 'server-side' solution without using ajax or
javascript.
I suspect that it's impossible with that requirement.
Maybe you could do something like:
Have a hidden IFRAME on the page
Set the Refresh header on this IFRAME (or use a META element) to contact the server every couple of seconds
If you do not hear from the client for some period of time, assume the browser has been closed.
However, I imagine that this solution will not scale well.
Have you considered something like signalr? I use it to detect when someone has a record open.
public class ChatHub : Hub
{
public override Task OnDisconnected()
{
Broadcaster.Disconnected(Context.ConnectionId);
return base.OnDisconnected();
}
}
For the moment I changed radically the approach to my problem.
To update pending rows I implemented a timed job using Quartz.NET framework, that runs every night.
I want to handle the hyperlink click event in an outlook mail. To open the hyperlinks in outlook mails without opening the browser within itself.
Does anyone know how to handle hyperlink click event on a mail item?
After searching a lot, I found that there is no way to catch the hyperlink click event in outlook.
If we want to catch a link we can define our own protocol url as follow.
http://msdn.microsoft.com/en-us/library/aa767914(VS.85).aspx
Then using our own protocol handler we can catch the event.
If someone needs more information ask here.
Write an Outlook Add-in .net to handle that. To get the basic idea about writing an add- in look at the following link.
http://blogs.msdn.com/b/dancre/archive/2004/03/21/93712.aspx