Silverlight object persistence - silverlight

Is it possible to have the same Silverlight object host persist in memory as the user traverses our site? I'm interested in having my Silverlight objects stick around from page to page.
Using IE7.

In short: No.
Typically to achieve this you make the decision that the Silverlight application is your site (or at least a complete segment of your site) and use Silverlight Navigation framework to allow the user to navigate from "page to page" within the application. Where "page" refers to various Xaml pages within a single Silverlight application.

As a workaround, you could store the object in JSON or XML in the IsolatedStorage for the Site (not the application) and use the built in serialization methods to work with the object. Then just check for its existence for each app that is loaded.

Related

Is Page Object Pattern suitable for Windows Application

I have read that Page Object Pattern is suitable for the Web Application Automation and I have used the Page object pattern with Selenium for one of the Web Apps I have automated.
How ever I am curious to know is Page Object suitable to Windows/Desktop applications ?. Though there is a scope in Windows Apps as well to create different Top level Windows as Pages and expose the operations as methods.
Has any one tried this and want to know the experiences/Advantages/disadvantages
The key equivalence here is page <=> dialog.
In a web app you encapsulate each page in a page object, while in a desktop app you encapsulate each dialog in an object that you might call a "dialog object".
The point is the encapsulation.
Over at my blog I've written about DRY page objects for testing web apps, but if you substitute dialog for page, it will apply equally well to dialog objects for desktop apps:
-- Keep Your Page Objects Clean and DRY
yes we can automate the desktop based application with Page object. you can refer WinAppDriverPageObjectModel

IFrame on Silverllight

I want to add IFrame to my Silverlight web site. and into that iframe i want to add aspx page. is that possible? (aspx page in silverlight.)
It's posible in your HTML where you call the Silverlight xap file, but not inside Silverlight itself
Yes you can add what ever asp / html elements to the web page where your silverlight application is running.
For example modify the ProjectNameTestPage.aspx in your web project.
Actually it is possible to have HTML content nested within the Silverlight, Telerik for example has a control called "HtmlWindow" or "RadWindow" which does just this. Either you could subscribe to their control set or try and find out how they did it.
I have used Telerik's control multiple times in an MEF Silverlight application where different web applications (SSRS for example) are contained with the MEF plugins.

passing value from one page to another

i m new developer to mobile apps and working on silverlight.
i want to knw how to pass value from textbox on one page to textbox on another page in mobile windows apps not in web apps using silverlight in c#.
So many options for this one:
Add variables to your app class
Global variable anywhere in the app (yuk)
Use a shared ViewModel if you are following the MVVM pattern
Store in App.Resource settings (these are easily bound to)
There is a shared app data store specifically for binding, but I can't remember what it is called or if it is in the mobile version (anybody?).
What are you doing with this value that is shared between to pages? The usage determines where/how it should be stored.

Managing links in silverlight applications

What is the best way to manage links in a Silverlight application? In my app, I have various custom controls that will open a new website in a new window.
I know in the hosting aspx page you can pass in parameters but I don't know how and where to store these links internally? Should I add a collection to the App object? Is there another mechanism that already exists? Is it a good idea to make my custom controls take the links from a global scope object or the links should be passed in the constructor?
How do you do it?
You have lots of options in Silverlight depending on what type of links they are, how many and how you want to maintain them.
If they are referenced by ID and updated occasionally, you could store them in a resource dictionary or a custom XAML file and load that on demand (XAML files are just object descriptions after all).
If you need to constantly maintain them, a database on the server would store them centrally and you would fetch them as needed via a service.
For lots in individual custom controls, that don't change links often, you could just make the hyperlink URL a property of the object and set the links in the XAML that contains the controls (this is the simplest option for the simplest usage). e.g.
<customControl Hyperlink="http://mylink.com/path/params/etc"/>
Basically it comes down to how you want to manage them. If you drop us a line via our website contact page with specific details we will be happy to provide more detailed examples/suggestions.
Hope this helps.

Silverlight 4.0 IsolatedStorageFile

How to view all the content in my IsolatedStorageFile by setting a new page in your browser?
Thank you
I'm not sure what "setting a new page in your browser" has to do with it. I assume you are refering perhaps to the loading of a different Silverlight app from the site.
There are two Isolated Stores one per application and one per site. If you do mean moving from one app to another then you will only be able to share the site store between them.
You can get access to the site store with IsolatedStorageFile.GetUserStoreForSite().
Enumeration of Directories and Files in the store are preformed with the methods GetDirectories() and GetFiles(). Try having a read through the documentation here.

Resources