TileManager.cs 1.72 KB
Newer Older
1 2 3 4 5 6 7
using Microsoft.Phone.Shell;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

8
namespace Linphone.Agents
9
{
10 11 12
    /// <summary>
    /// Utility class used to handle everything that is Tile related
    /// </summary>
13 14 15
    public class TileManager
    {
        private static TileManager singleton;
16 17 18
        /// <summary>
        /// Static instance to access the class.
        /// </summary>
19 20 21 22 23 24 25 26 27 28 29
        public static TileManager Instance
        {
            get
            {
                if (TileManager.singleton == null)
                    TileManager.singleton = new TileManager();

                return TileManager.singleton;
            }
        }

30 31 32
        /// <summary>
        /// Public constructor.
        /// </summary>
33 34 35 36 37
        public TileManager()
        {

        }

38
        /// <summary>
39
        /// Displays the number of missed call and unread messages on the live tile and on the lock screen
40
        /// </summary>
41 42
        /// <param name="missedCalls">Number of missed calls + number of unread messages</param>
        public void UpdateTileWithMissedCallsAndUnreadMessages(int count)
43 44
        {
            ShellTile tile = ShellTile.ActiveTiles.FirstOrDefault();
45 46 47 48 49 50
            if (tile != null)
            {
                var data = new IconicTileData();
                data.Count = count;
                tile.Update(data);
            }
51 52
        }

53 54 55
        /// <summary>
        /// Delete the missed call display from the live tile and the lock screen
        /// </summary>
56
        public void RemoveCountOnTile()
57
        {
58
            UpdateTileWithMissedCallsAndUnreadMessages(0);
59 60 61
        }
    }
}