async void AnimateBackground()
        {
            while (true)
            {
                // calculate positions using Law of sines
                var x = BackgroundScale * (float)Math.Sin(MathHelper.DegreesToRadians(90 - BackgroundRotationX));
                var y = BackgroundScale * (float)Math.Sin(MathHelper.DegreesToRadians(BackgroundRotationX)) + FlightHeight;

                var moveTo = x + 1f; //a small adjusment to hide that gap between two tiles
                var h      = (float)Math.Tan(MathHelper.DegreesToRadians(BackgroundRotationX)) * moveTo;
                await Task.WhenAll(FrontTile.RunActionsAsync(new MoveBy(1 / BackgroundSpeed, new Vector3(0, -moveTo, -h))),
                                   RearTile.RunActionsAsync(new MoveBy(1 / BackgroundSpeed, new Vector3(0, -moveTo, -h))));

                //switch tiles
                var tmp = FrontTile;
                FrontTile = RearTile;
                RearTile  = tmp;

                RearTile.Position = new Vector3(0, x, y);
            }
        }
        private void SaveImageForeground(bool failed, string backcontent)
        {
            if (IsolatedStorageSettings.ApplicationSettings.Contains("oldtilestyle") && (bool)IsolatedStorageSettings.ApplicationSettings["oldtilestyle"])
            {
                OldSmallTile.SaveTile(failed, _balance);
            }
            else
            {
                SmallTile.SaveTile(failed, _balance);
            }
#if (DEBUG)
            Debug.WriteLine("Live tile: Small image created");
#endif

            FrontTile.SaveTile(failed, _balance);
#if (DEBUG)
            Debug.WriteLine("Live tile: Front image created");
#endif
            BackTile.SaveTile(failed, _balance, backcontent);
#if (DEBUG)
            Debug.WriteLine("Live tile: Back image created");
#endif
        }