Make silverlight app on page a "singleton"
-
So I have a silverlight app. The page can be referenced with arguments so when someone click on a link in another html page it starts up the silverlight app web page and works according to the arguments. The problem is that the link on the other html page can be clicked again and it will also start up the silverlight app in *another* web page and work according to the arguments. Basically I can have two or more of my silverlight app running. Is there a way to tell that second click that the silverlight app is already up and running and to accept these new arguments - without having to reset the entire silverlight app? I made it work where the existing app starts over again (it doesn't look good that way), but I just want the app to respond to the new arguments passed in by the link clicked on the html page. Is that even possible? Thanks
Brent
-
So I have a silverlight app. The page can be referenced with arguments so when someone click on a link in another html page it starts up the silverlight app web page and works according to the arguments. The problem is that the link on the other html page can be clicked again and it will also start up the silverlight app in *another* web page and work according to the arguments. Basically I can have two or more of my silverlight app running. Is there a way to tell that second click that the silverlight app is already up and running and to accept these new arguments - without having to reset the entire silverlight app? I made it work where the existing app starts over again (it doesn't look good that way), but I just want the app to respond to the new arguments passed in by the link clicked on the html page. Is that even possible? Thanks
Brent
As there is no method for an SL app to receive data from an aspx page (except the initial parameters) then I don't think this is possible. Caveat, I'm fairly new to SL so don't take this as a definitive answer.
Never underestimate the power of human stupidity RAH
-
So I have a silverlight app. The page can be referenced with arguments so when someone click on a link in another html page it starts up the silverlight app web page and works according to the arguments. The problem is that the link on the other html page can be clicked again and it will also start up the silverlight app in *another* web page and work according to the arguments. Basically I can have two or more of my silverlight app running. Is there a way to tell that second click that the silverlight app is already up and running and to accept these new arguments - without having to reset the entire silverlight app? I made it work where the existing app starts over again (it doesn't look good that way), but I just want the app to respond to the new arguments passed in by the link clicked on the html page. Is that even possible? Thanks
Brent
Would you want a browser plugin that could hijack the default behaviour of your browser? I wouldn't. If the app opens up in a new window, then how is this any different from having a hyperlink with a jump target on it? The SL runtime has to behave itself like any other browser component, so it has to respect the same airspace issues.
I'm not a stalker, I just know things. Oh by the way, you're out of milk.
Forgive your enemies - it messes with their heads
-
So I have a silverlight app. The page can be referenced with arguments so when someone click on a link in another html page it starts up the silverlight app web page and works according to the arguments. The problem is that the link on the other html page can be clicked again and it will also start up the silverlight app in *another* web page and work according to the arguments. Basically I can have two or more of my silverlight app running. Is there a way to tell that second click that the silverlight app is already up and running and to accept these new arguments - without having to reset the entire silverlight app? I made it work where the existing app starts over again (it doesn't look good that way), but I just want the app to respond to the new arguments passed in by the link clicked on the html page. Is that even possible? Thanks
Brent
So, sounds like you want the first click to open the Silverlight application in a new window, but you want the second click of that same link to cause the Silverlight app to change in some way. If that is correct, then that should be doable. I'm pretty sure you can pass variables from one window to another window opened by that first window using JavaScript. I am also fairly certain that you can interact with a Silverlight control using JavaScript, even after the Silverlight control has been created. See here and here (note: I didn't read those fully, but they seem like what you are looking for).
-
As there is no method for an SL app to receive data from an aspx page (except the initial parameters) then I don't think this is possible. Caveat, I'm fairly new to SL so don't take this as a definitive answer.
Never underestimate the power of human stupidity RAH
Mycroft Holmes wrote:
there is no method for an SL app to receive data from an aspx page
Pretty sure that's not correct. See my answer below.
-
Would you want a browser plugin that could hijack the default behaviour of your browser? I wouldn't. If the app opens up in a new window, then how is this any different from having a hyperlink with a jump target on it? The SL runtime has to behave itself like any other browser component, so it has to respect the same airspace issues.
I'm not a stalker, I just know things. Oh by the way, you're out of milk.
Forgive your enemies - it messes with their heads
Not sure what you mean by "hijack the default behavior". Seems to me the OP is just building a web application and would like to have the second click act differently than the first click. More specifically, the first click should open a new window and the second click should interact with that opened window. Sounds both reasonable and possible to me (see my answer below).
-
Mycroft Holmes wrote:
there is no method for an SL app to receive data from an aspx page
Pretty sure that's not correct. See my answer below.
AspDotNetDev wrote:
Pretty sure that's not correct
Therefore the caveat, interesting looking article, it does imply there can be an interaction between the 2 spheres after the SL app is created.
Never underestimate the power of human stupidity RAH
-
So, sounds like you want the first click to open the Silverlight application in a new window, but you want the second click of that same link to cause the Silverlight app to change in some way. If that is correct, then that should be doable. I'm pretty sure you can pass variables from one window to another window opened by that first window using JavaScript. I am also fairly certain that you can interact with a Silverlight control using JavaScript, even after the Silverlight control has been created. See here and here (note: I didn't read those fully, but they seem like what you are looking for).
Here's what I have tried. I created another silverlight "application" which is merely a control that looks like a hyperlink. Then I can use the LocalMessageSender to talk to my main app and also talk to the web page that my "control" app lives on. The only problem left is that typically when a page changes, the tab in the browser flashes or goes red (at least this is the behavior in IE). This doesn't happen here. The user has no clue that anything happened until he goes to the main silverlight app page and everything shifts. It appears that the main app doesn't run the Message Received event until AFTER the tab becomes active again.
Brent