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

CreateOrEditTile causing app to crash

2 Answers 24 Views
LiveTileHelper
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
MasterChiefMasterChef
Top achievements
Rank 2
MasterChiefMasterChef asked on 06 Nov 2013, 04:02 PM
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 Answers, 1 is accepted

Sort by
0
Accepted
Todor
Telerik team
answered on 07 Nov 2013, 08:14 AM
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.
0
MasterChiefMasterChef
Top achievements
Rank 2
answered on 08 Nov 2013, 08:49 PM
Thanks!

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

Master Chief
Tags
LiveTileHelper
Asked by
MasterChiefMasterChef
Top achievements
Rank 2
Answers by
Todor
Telerik team
MasterChiefMasterChef
Top achievements
Rank 2
Share this question
or