Exemple #1
0
        /// <summary>
        /// Constructor of AppHistoryInformationPage
        /// </summary>
        /// <param name="infoType">The type of information to show</param>
        public AppHistoryInformationPage(QueryType infoType)
        {
            log = new LogImplementation();
            try
            {
                InitializeComponent();

                // Initialize StatisticsInfo list
                statsInfo = new List <StatsInfoItem>();

                // Query application history
                appHistoryAPIs = new AppHistoryImplementation();
                Query(infoType);

                // Set the item source of list view
                appHistoryInformationList.ItemsSource = statsInfo;
            }
            catch (Exception e)
            {
                log.Log(e.Message);
            }
        }
        /// <summary>
        /// Constructor of AppHistoryInformationPage
        /// </summary>
        /// <param name="title">The title of the content page to present</param>
        public AppHistoryInformationPage(string title)
        {
            try
            {
                InitializeComponent();

                // Set the title of this content page
                this.Title = title;

                // Initialize StatisticsInfo list
                statsInfo = new List <StatsInfoItem>();

                // Query application history
                appHistoryAPIs = DependencyService.Get <IAppHistoryAPIs>();

                if (title.Equals("Top 5 recently used applications"))
                {
                    Query(QueryType.RecentlyUsedApplications);
                }
                else if (title.Equals("Top 10 frequently used applications"))
                {
                    Query(QueryType.FrequentlyUsedApplications);
                }
                else if (title.Equals("Top 10 battery consuming applications"))
                {
                    Query(QueryType.BatteryConsumingApplications);
                }



                // Set the item source of list view
                appHistoryInformationList.ItemsSource = statsInfo;
            }
            catch (Exception e)
            {
                DependencyService.Get <ILog>().Log(e.Message.ToString());
            }
        }