Update, Not Updating

17 posts, 0 answers
  1. Matthew
    Matthew avatar
    32 posts
    Member since:
    Oct 2011

    Posted 24 Mar 2012 Link to this post

    Below is the method, when it first pins the tile it creates just fine, but on a second run of the Pin method, where the datacontext has new data and the info on the hubtileview should be updated it only updates every second or third run.

    Am i miss-understanding something? Should it NOT update every time like i expect? I've been through your source too to make sure that it should be and from what I've gathered I don't see any reason not.

    Is there something OS specific that's keeping it from happening? I can email you guys with the HubTileView (and the VM represented by the 'this' keyword) if necessary, but I don't want to post it here... Suffice it to say though, it's more basic than your new HubTile implementation. :-)

    Code:

    private void Pin()
    {
        var hubItem = new HubItemView();
     
        hubItem.DataContext = this;
     
        var uri = UriMappings.Instance.MapUri(new Uri(string.Format("/List/{0}", Id), UriKind.Relative));
     
        LiveTileHelper.CreateOrUpdateTile(new RadExtendedTileData { VisualElement = hubItem }, uri);
    }
  2. Matthew
    Matthew avatar
    32 posts
    Member since:
    Oct 2011

    Posted 25 Mar 2012 Link to this post

    OK, I've got this partially fixed on my end (I had a value, Count, that I wasn't updating).

    But one more thing, I've attempted to update the tile when the user presses the Back button (OnNavigateFrom) and the rendering of the tile is all off: no background color on the tile and the layout is WAY off.

    I guess my question now is, if you've got a Count property that changes frequently, and you want the pinned tile to reflect that, what's the best practice to do this?
  3. DevCraft banner
  4. Todor
    Admin
    Todor avatar
    778 posts

    Posted 28 Mar 2012 Link to this post

    Hello Matthew,

    Thank you for your questions.

    You should be able to update the tile when the user presses the back button. I have attached a sample solution to illustrate how I tested it and it seems all right on our side. Could you please have a look and see if there is something more specific in you scenario which could be the cause for the incorrect rendering?

    And if you want the tile to update frequently and you want this update to be not related to any user interaction (like button click, navigation to some page, etc.), you can use a BackgroundAgent like PeriodicTask. In our online documentation you can see an example of how to use the LiveTileHelper from inside a PeriodicTask.

    I hope this helps. Let me know if you need additional assistance.

    Greetings,
    Todor
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  5. Matthew
    Matthew avatar
    32 posts
    Member since:
    Oct 2011

    Posted 30 Mar 2012 Link to this post

    Sorry it took me so long to get back to you. Yes, I was able to get the live tile to update with the 'Back' button. I was also able to get it to work when the user pressed the 'Start' button too.

    What was causing me an issue was that in the first situation I had to use the Dispatcher to marshal the update back into the UI thread. On the latter, if I used the Dispatcher, the layout came out all screwy. So, the solution was, Back? Dispatcher, Start? no Dispatcher.

    Make sense?
  6. Todor
    Admin
    Todor avatar
    778 posts

    Posted 02 Apr 2012 Link to this post

    Hello Matthew,

    Thank you for getting back to us.

    Could you please have a look at the project that I sent you in the previous post? It updates the tile on both Back and Start buttons pressed and there is no need for Dispatcher at all. I’d like to ask you what is different in your scenario that causes the need of dispatcher in only one of the cases and sending a sample solution that illustrates the issue will be highly appreciated.

    Please note that you will need to open a new support ticket in order to be able to attach a solution if you decide to do so.

    All the best,
    Todor
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  7. Matthew
    Matthew avatar
    32 posts
    Member since:
    Oct 2011

    Posted 03 Apr 2012 Link to this post

    Well, the key differences between your project and what I'm doing is that you're using a control (your page) that has already had a layout pass and has been loaded. I'm doing something simliar to the snippet below (which doesn't work in any back or start scenario, it's just for example).

    protected override void OnNavigatedFrom(NavigationEventArgs e)
    {
        var itemView = new RadHubTile();
     
        itemView.Title = "testing...";
        itemView.Message = "more testing...";
     
        LiveTileHelper.CreateOrUpdateTile(
            new RadExtendedTileData
            {
                VisualElement = itemView,
            }, new Uri("/MainPage.xaml", UriKind.RelativeOrAbsolute));
     
        base.OnNavigatedFrom(e);
    }
  8. Todor
    Admin
    Todor avatar
    778 posts

    Posted 06 Apr 2012 Link to this post

    Hello Matthew,

    What you are experiencing is not actually the common case when using LiveTileHelper with a control. Generally you can use a UIElement even if it hasn't had a layout pass yet. However the RadHubTile is a control, whose internal logic requires the control to be loaded and this is why you can't use it in the LiveTileHelper if it is not the VisualTree. I have attached a new sample that illustrates how you can create the tile on both Back and Windows buttons but by using a custom control, which you can easily create and add the necessary information.

    I hope this information helps. Don't hesitate to write us back if you have other questions.

    Greetings, Todor
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  9. Matthew
    Matthew avatar
    32 posts
    Member since:
    Oct 2011

    Posted 14 Apr 2012 Link to this post

    OK, I've got the steps to recreate the issue and it's with your 'Tasks' application on the marketplace.

    First, 'pin to start' a Project with one uncompleted Task
    Second, Tap the Pinned Tile
    Third, Complete the Task
    Forth, Press the hardware back button.

    See the issue now?
  10. Todor
    Admin
    Todor avatar
    778 posts

    Posted 17 Apr 2012 Link to this post

    Hello Matthew,

    Thank you for getting back to us.

    Actually, what you are saying is a different scenario. What we have been discussing so far was that when HubTile was not loaded it couldn't be used in the LiveTileHelper. In the Tasks application we don't have a HubTile, but when we follow the steps you provided we run into another issue. We are currently working on it and will have a fix soon.

    Thank you for your report. I have added some telerik points to your account for your cooperation.

    Regards,
    Todor
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  11. Matthew
    Matthew avatar
    32 posts
    Member since:
    Oct 2011

    Posted 17 Apr 2012 Link to this post

    Actually when you perform the steps on the tasks app you see my exact issue. The text is improperly laid out on the left side of the tile (all smashed together for lack of a more technical term) and the background color is black.

    That's been my issue all along with the LiveTileHelper. Maybe I've poorly communicated that.

    Glad to hear that you guys see it now, either way.
  12. Todor
    Admin
    Todor avatar
    778 posts

    Posted 19 Apr 2012 Link to this post

    Hi Matthew,

    I am glad to hear that we are on the same page already and we know exactly what we are looking for. We need a little more time to find out the exact cause of this issue and to fix it. As soon as we are ready, I'll let you know what you need to do to make it work on your side.

    Thank you for understanding.

    Regards,
    Todor
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  13. Mike
    Mike avatar
    13 posts
    Member since:
    Dec 2010

    Posted 26 Jun 2012 Link to this post

    I am having the same issue with the LiveTileHelper improperly updating. I will see the output of the tile vertically aligned on the left of the tile with an all black background.

    This happens with I call UpdateTile and then within 5 seconds click the phone back button, otherwise it works great.

    Please let me know the solution to this issue or if there is a work around ASAP.

    Thanks,
    Mike
  14. Valentin.Stoychev
    Admin
    Valentin.Stoychev avatar
    2198 posts

    Posted 27 Jun 2012 Link to this post

    Hello,

    Please send us the code you are using, so we can debug it on our end. There are some special cases that need an additional code to be placed when generating the bitmap for the tile. In short, you may need to call UpdateLayout() on the UI element we are taking snapshot of.

    Please send us the code you are using and we will advise you.

    Regards, Valentin.Stoychev
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  15. Mike
    Mike avatar
    13 posts
    Member since:
    Dec 2010

    Posted 27 Jun 2012 Link to this post

    Valentin,

    Calling UpdateLayout() on the front and back UserControls prior to assigning them to the RadExtendedTileData fixes the problem.

    I can not upload my code as I can not create a support ticket, my 1 year support has expired.  If you would like to review the code please open and forward me a ticket and instructions.

    Thanks so much for your quick reply, this issue was causing me significant headache.  To be honest, I would not be surprised at all it turns out to be an obscure issue with my app as it's very large and very complicated and I could not recreate the bug in creating simple test projects.  It may also be a platform issue with WP7 as the timing of hitting the back or home button causes the issue to appear.

    Possibly the UI thread is failing to render the controls in time due to significant processing queued on the thread.  In my app I am upading a local SQL CE 3.5 DB while also calling 7 web services (which are on async background threads but queue their call backs on the UI thread).  I am not performing any processing in Application_Deactivated or Closing, other than disposing of a Mutex to indicate the app is no longer running.

    Thanks,
    Mike
  16. Valentin.Stoychev
    Admin
    Valentin.Stoychev avatar
    2198 posts

    Posted 28 Jun 2012 Link to this post

    Hi,

    I'm glad your problem is solved now. Please let us know if you need anything help from us.

    All the best, Valentin.Stoychev
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  17. Steve
    Steve avatar
    2 posts
    Member since:
    Apr 2012

    Posted 28 Nov 2012 Link to this post

    Hi Valentin,

    Has the garbled live tile been fixed in the Q3 version of the tools or do you still need to call UpdateLayout? I'm seeing this every now and then in my app on the Q2 release. I'm using a custom control that is not a page (similar to what Mike was doing).

    Thanks,
    Steve
  18. Lancelot
    Lancelot avatar
    251 posts
    Member since:
    Jul 2012

    Posted 28 Nov 2012 Link to this post

    Hi Steve,

    Yes, at the current time you still need to use the UpdateLayout() method.

    Lancelot
Back to Top
DevCraft banner