This is a migrated thread and some comments may be shown as answers.

[Solved] Navigation with dynamically downloaded pages

7 Answers 209 Views
Navigation
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Michael
Top achievements
Rank 1
Michael asked on 24 Jan 2009, 01:16 AM
I am using the RadPage and RadFrameContainer to navigate between RadPages. The browser forward and back buttons work fine for all the RadPages that are contained in the main startup xap file. However, when I dynamically download a RadPage that is in a different xap file the browser forward and back buttons cannot load the page. I can load the page using a button click event because then I execute a web client to load the page like this:

 

 

 

Dim deploymentParts As List(Of XElement) = (From assemblyParts In deploymentRoot.Elements().Elements() Select assemblyParts).ToList()

 

 

Dim asm As System.Reflection.Assembly = Nothing

 

 

 

 

 

 

For Each xElement As XElement In deploymentParts

 

 

    Dim source As String = xElement.Attribute("Source").Value

 

 

    Dim asmPart As AssemblyPart = New AssemblyPart

 

 

    Dim streamInfo As StreamResourceInfo = Application.GetResourceStream(New StreamResourceInfo(e.Result, "application/binary"), New Uri(source, UriKind.Relative))

 

 


    If
source = "Load.dll" Then

 

 

 

        asm = asmPart.Load(streamInfo.Stream)

 

 

        Dim service As New NavigationService

 

        service = NavigationService.GetNavigationService

        service.Navigate(asm.CreateInstance(

"Load.Page"))

 

 

    End If

 

 

 

 

 

 

Next xElement

 

 

Do you have any examples or know of any that can help me with this problem? I need the browser forward and back buttons to be able to load the dynamic xap file.

Thanks



7 Answers, 1 is accepted

Sort by
0
Bobi
Telerik team
answered on 26 Jan 2009, 09:29 AM
Hello Michael,

To dynamically load pages from different assemblies you can try this:

            //Load the TestAssembly.dl assembly.
            Uri packageUri = new Uri("TestAssembly.dll", UriKind.Relative);
           
           StreamResourceInfo stream = System.Windows.Application.GetResourceStream(packageUri);

            AssemblyPart assemblyPart = new AssemblyPart();
          
           Assembly targetAssembly = assemblyPart.Load(stream.Stream);

            this.service = NavigationService.GetNavigationService();
           
            Type[] assemblyTypes = targetAssembly.GetTypes();
            foreach (var type in assemblyTypes)
            {
                Type[] typeInterfaces = type.GetInterfaces();

               //HomePage is a page from TestAssembly.dll assembly.
                if (type.Name == "HomePage")
                {
                    RadPage page = (RadPage)targetAssembly.CreateInstance(type.FullName);
                    this.service.Navigate(page);
                    break;
                }
            }

After that  Back/Forward navigation should work as expected.
It is important to correctly  load the assembly in order to have the access to its pages.
I hope this answers your question.

Regards,
Boryana
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Michael
Top achievements
Rank 1
answered on 26 Jan 2009, 06:22 PM
I tried this code and it displays the downloaded RadPage but the browser forward and back buttons still do not work. I may have messed something up because I had to translate from C# to VB.

My RadPage is in a separate XAP file in the client bin along with the main application XAP file. Is this sample code for a RadPage in a XAP file or for a RadPage in a Resource?

Here are the navigation strings.
This is the main page in the main xap file (Navigate.xap):
http://localhost:1808/NavigateTestPage.aspx#tkagnav=Navigate.MainPage
This works fine.

This is the downloaded page in the second xap file (Load.xap):
http://localhost:1808/NavigateTestPage.aspx#tkagnav=Load.Page
This works fine.

I hit the browser back button:
http://localhost:1808/NavigateTestPage.aspx#tkagnav=Navigate.MainPage
This works fine.

Then I hit the browser forward button:
http://localhost:1808/NavigateTestPage.aspx#tkagnav=Load.Page
But this page doesn't display. It stays on the main page. It is like the Load.Page is not placed in the cache.

Thanks
0
Bobi
Telerik team
answered on 28 Jan 2009, 04:17 PM
Hello Michael,

Thank you for reporting this issue. For now  Back and Forward functionality in the RadNavigation framework
can be used only if you have navigation between pages that are in the same XAP file. It is possible to navigate to page from a different XAP, however you will have to implement your own custom logic in order to have Back/Forward functionality between pages from different XAP files.

We will add multiple XAP support to RadNavigation as soon as possible.

To implement your own back/forward functionality you have to navigate between the pages using page instants , not page string representation. For example you could try this:
         RadPage page = assemblyPart.CreateInstance("SilverlightApplication1.MasterPage1") as RadPage;
         this.service.Navigate(page);

Best wishes,
Boryana
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Michael
Top achievements
Rank 1
answered on 29 Apr 2009, 10:33 PM

Hi,

 

I am wondering if you have added multiple XAP support to RadNavigation yet.

 

Thanks

 

Michael

 

0
Accepted
Miroslav
Telerik team
answered on 01 May 2009, 01:26 PM
Hi Michael,

Unfortunately the feature is not implemented yet because of a trend to phase out the RadNavigation framework in favor of the MS navigation framework.

In Silverlight 3, the built-in navigation can offer tight tool integration like with Blend 3 (Sketch Flow and its player for example). Unfortunately we would not be able to match the same tool integration as even Blend 3 is not very extensible. Also we expect that the built-in navigation will evolve with new features that we will be unable to support. 

Greetings,
Miroslav
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Michael
Top achievements
Rank 1
answered on 01 May 2009, 01:36 PM

Thanks Miroslav,

 

I guess I will be using the MS navigation in Silverlight 3.0.

The only drawback is you guys are a lot better at support than Microsoft.

 

0
Valentin.Stoychev
Telerik team
answered on 01 May 2009, 01:49 PM
Hello Michael,

Let us know if you face any problems with the MS navigation system - we will be glad to help!

All the best,
Valentin.Stoychev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Navigation
Asked by
Michael
Top achievements
Rank 1
Answers by
Bobi
Telerik team
Michael
Top achievements
Rank 1
Miroslav
Telerik team
Valentin.Stoychev
Telerik team
Share this question
or