Follow up on a submitted code sample

8 posts, 0 answers
  1. Moni
    Moni avatar
    39 posts
    Member since:
    Feb 2010

    Posted 17 Sep 2010 Link to this post

    Hi there,
    Last Friday I posted code samples General&Integration section a project which shows work with Prism 4.0 + TelerikTabControl + SL4.0.
    The goal is to show how you can take a whole self contained project (several modules) and inject it into a TelerikTabControl.
    You guys helped a lot figuring things out and I promised to post it.
    It has been a while now and I am wondering.
    If it is still in review - cool with me.
    I just need to know that I did not mess up the submission in some way and you did not get it at all.
    Many thanks
  2. Miro Miroslavov
    Admin
    Miro Miroslavov avatar
    588 posts

    Posted 17 Sep 2010 Link to this post

    Hi Moni,

     I've tested it today and found an issue with it. When

    1. I create both views
    2. Then I open the Complex View
    3. Close it.
    4. Create it again
    5. And when I try to select the Complex View tab I get an exception.

    Can you give it a try and let me know if you can reproduce it also.
    Thank you for your interest. :)

    All the best,
    Miro Miroslavov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft banner
  4. Moni
    Moni avatar
    39 posts
    Member since:
    Feb 2010

    Posted 17 Sep 2010 Link to this post

    That's true.
    The complex view would do this.
    I was really on the fence with this one - do I fix it or do I let it slide.
    Why fix it? - Well ... common decency - right.
    Why not? - Well ... it is a test project that achieves the set goal of explaining calls related to Prism + SL + TabControl.
    As you notice I deliberately stripped a ton of code that would usually go into a production-grade project. That simply makes the rest of the code read easy and without "clutter".
    For example - if you click on the buttons they do not set the focus on the tabs.
    I do mention these issues in the description though - so that they are not expected.

    I found that if you get somebody's project and fix a bug in it, this helps you learn.
    Main thing is - the project in itself is very useful - this is why I put it together.
    Don't know - up to you. We can let it go out like this and I would commit to fix it later. That is - the project can keep evolving.

    What do you say?
    I say - the "perfect" is the enemy of the "good"  :)
  5. Moni
    Moni avatar
    39 posts
    Member since:
    Feb 2010

    Posted 17 Sep 2010 Link to this post

    Just a hunch
    I spent some time stepping through.
    First obervation - it happens ONLY on the complex view.
    I have some others entirely written by me - no problem there.

    Now - what is this Complex View made of - these are ALL modules from the Prism Solution Template - have a look at my description on how I created this.
    This template loads a ton of things just to make things work as a demo. Part of the load are dummy data objects to feed into the demo.

    I did not touch a thing there - took as is. That is, when I restart it something is not cleaned up properly.
    This drives home my message - the goal was not really to disect the prism template project but to get right the entire communication related to your end of the story - that is TelerikTab within the Prism framework.

    That portion works well and has value.

    Anybody taking this demo project will:
    1. Have their own modules which he/she understands inside out.
    2. Would want to plug them in into a Tab with minimal code.

    The problem that comes from within the Prism template is not material.

    What do you say?

    Btw. The exact point where the problem happens is in:
    Module2 ->ModuleInit.cs->Initialize()-> this._container.Resolve<CatalogView>()
    On closing the tab the code eventually gets to:
    Module1.Controllers.MainRegionController -> CloseViewEventHandler.
    There I only close the Shell Main region which is the region associated with the TabControl.
    I do not explicitly close the Mod1_BottomLeftRegion which could be a problem because then on re-open
    The code bombs exactly on the _container.Resolve<CatalogView>
    Will see to find time to fix it. Will have to modify Module2.CatalogViewModel to subscribe to the closing event and then remove the region for the Module2 from there ... or something to that effect.
  6. Moni
    Moni avatar
    39 posts
    Member since:
    Feb 2010

    Posted 20 Sep 2010 Link to this post

    Fixed,
    Miroslav - let me know how you prefer it done.
    You put one line of code inside?
     Or I re-submit the whole thing?

    Here the fix:

    Inside -> Module1.Controllers.MainRegionController -> CloseViewEventHandler(...)

     if (view != null)
     {
       mainRegion.Remove(view);
    -------------------- Add this Line -------------------------------------------
       _regionManager.Regions.Remove("MainRegion");
    ---------------------------------------------------------------------------------
       _viewCloseTabLater = null;
     }

    This was causing the problem on subsequent click.
    The error message was:
    Message "An exception occurred while creating a region with name 'MainRegion'. The exception was: System.ArgumentException: Region with the given name is already registered: MainRegion\r\n   at ....

    I did not have to do anything in Module2.

    Let me know how you want to proceed.

  7. Miro Miroslavov
    Admin
    Miro Miroslavov avatar
    588 posts

    Posted 21 Sep 2010 Link to this post

    Hello Moni,

     Thank you for fixing the nice example.
    It will be best if you can re-submit the Code Library request and I will publish it. 

    Thank you, once again.

    Kind regards,
    Miro Miroslavov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  8. Moni
    Moni avatar
    39 posts
    Member since:
    Feb 2010

    Posted 21 Sep 2010 Link to this post

    Done.
    Have a look in the recently submitted.
    I attached a new file "PrismTelerikTab_20100921.zip"
    Project Title is:
    "A working project using nested regions in Prism4.0, TelerikTabControl, Silverlight 4.0"
    I also updated the comments inside the code and the included PDF instructions.

    Miro - thank you so much for checking things out! It's much better now.
    It should all run fine - but still - do a quick run - just in case
  9. Miro Miroslavov
    Admin
    Miro Miroslavov avatar
    588 posts

    Posted 24 Sep 2010 Link to this post

    Hello Moni,

     You are always welcome. Actually we should thank you for the example. I've also updated your Telerik point. 

    All the best,
    Miro Miroslavov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top
DevCraft banner