CreateOrEditTile causing app to crash

3 posts, 1 answers
  1. MasterChiefMasterChef
    MasterChiefMasterChef avatar
    152 posts
    Member since:
    Jan 2013

    Posted 06 Nov 2013 Link to this post

    Hi,

    When I create a live tile, everything works fine. Unfortunately, if the button is pressed twice, no tile is created. I know better than to press the button twice in a row, but my users don't. I'm just trying to avoid the crashes that I keep getting reported on my app. This is present in your 'Telerik Examples' app as well. If you press the 'pin to start' button twice, no tile will be pinned to the start. Is there any way to get around this error?

    Master Chief
  2. Answer
    Todor
    Admin
    Todor avatar
    778 posts

    Posted 07 Nov 2013 Link to this post

    Hello Master Chief,

    Thank you for writing.

    This is indeed an interesting scenario which can be also reproduced with the native method ShellTile.Create. We use this method internally and obviously when the tile creation process is in progress a new process can't be initiated. Here's how you can workaround this:

    private bool isTileUpdateInProgress = false;
     
    private void Button_Click(object sender, RoutedEventArgs e)
    {
        if (isTileUpdateInProgress)
        {
            return;
        }
        isTileUpdateInProgress = true;
     
        // Create or update your tile here
     
        Dispatcher.BeginInvoke(() =>
        {
            isTileUpdateInProgress = false;
        });
    }

    I hope this information helps.
     
    Regards,
    Todor
    Telerik
    Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
  3. DevCraft banner
  4. MasterChiefMasterChef
    MasterChiefMasterChef avatar
    152 posts
    Member since:
    Jan 2013

    Posted 08 Nov 2013 Link to this post

    Thanks!

    I tried doing something very similar to this, with no success. This version you sent me works perfectly!

    Master Chief
Back to Top