Navigation with dynamically downloaded pages

8 posts, 1 answers
  1. Michael
    Michael avatar
    29 posts
    Member since:
    Sep 2008

    Posted 23 Jan 2009 Link to this post

    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



  2. Bobi
    Admin
    Bobi avatar
    513 posts

    Posted 26 Jan 2009 Link to this post

    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.
  3. DevCraft banner
  4. Michael
    Michael avatar
    29 posts
    Member since:
    Sep 2008

    Posted 26 Jan 2009 Link to this post

    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
  5. Bobi
    Admin
    Bobi avatar
    513 posts

    Posted 28 Jan 2009 Link to this post

    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.
  6. Michael
    Michael avatar
    29 posts
    Member since:
    Sep 2008

    Posted 29 Apr 2009 Link to this post

    Hi,

     

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

     

    Thanks

     

    Michael

     

  7. Answer
    Miroslav
    Admin
    Miroslav avatar
    922 posts

    Posted 01 May 2009 Link to this post

    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.
  8. Michael
    Michael avatar
    29 posts
    Member since:
    Sep 2008

    Posted 01 May 2009 Link to this post

    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.

     

  9. Valentin.Stoychev
    Admin
    Valentin.Stoychev avatar
    2198 posts

    Posted 01 May 2009 Link to this post

    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.
Back to Top
DevCraft banner