예제 #1
0
        private void SetLivetileImage(ScheduledTask task, LivetileData data)
        {
            try
            {
                System.Diagnostics.Debug.WriteLine("타일 전 =>" + Microsoft.Phone.Info.DeviceStatus.ApplicationCurrentMemoryUsage);

                for (int i = 0; i < ShellTile.ActiveTiles.Count(); i++)
                {
                    ShellTile tile = ShellTile.ActiveTiles.ElementAt(i);

                    if (tile.NavigationUri.ToString().Contains("calendar"))
                    {
                        List <Appointment> appList = data.DayList.Find(x => x.DateTime.ToLongDateString() == DateTime.Today.ToLongDateString()).AppointmentList;
                        int count = appList == null ? 0 : appList.Count;

                        LivetileHelper.CreateLivetileImage(data, LiveItems.Calendar);
                        tile.Update(LivetileHelper.GetCalendarLivetileData(count));
                    }
                    else if (tile.NavigationUri.ToString().Contains("weather"))
                    {
                        LivetileHelper.CreateLivetileImage(data, LiveItems.Weather);
                        tile.Update(LivetileHelper.GetWeatherLivetileData());
                    }
                    else if (tile.NavigationUri.ToString().Contains("battery"))
                    {
                        LivetileHelper.CreateLivetileImage(data, LiveItems.Battery);
                        tile.Update(LivetileHelper.GetBatteryLivetileData());
                    }
                }

                System.Diagnostics.Debug.WriteLine("타일 후 =>" + Microsoft.Phone.Info.DeviceStatus.ApplicationCurrentMemoryUsage);
                //배터리 잠금화면 업데이트
                UpdateBatteryStatus();
                System.Diagnostics.Debug.WriteLine("배터리 후 =>" + Microsoft.Phone.Info.DeviceStatus.ApplicationCurrentMemoryUsage);
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine(e.Message);
            }
#if DEBUG_AGENT
            ScheduledActionService.LaunchForTest(task.Name, TimeSpan.FromSeconds(30));
            System.Diagnostics.Debug.WriteLine(Microsoft.Phone.Info.DeviceStatus.ApplicationCurrentMemoryUsage);
#else
            IsolatedStorageSettings.ApplicationSettings[Constants.LAST_RUN_LIVETILE] = DateTime.Now;
            IsolatedStorageSettings.ApplicationSettings.Save();
#endif
        }
예제 #2
0
        /*
         * 타일을 업데이트 한다.
         */
        private void UpdateLiveTile(LivetileTemplateItem item, int appCount)
        {
            ShellTile oTile = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains(item.LiveItem.ToString().ToLower().ToString()));

            if (oTile != null)
            {
                if (item.LiveItem == LiveItems.Weather)
                {
                    oTile.Update(LivetileHelper.GetWeatherLivetileData());
                }
                else if (item.LiveItem == LiveItems.Battery)
                {
                    oTile.Update(LivetileHelper.GetBatteryLivetileData());
                }
                else
                {
                    oTile.Update(LivetileHelper.GetCalendarLivetileData(appCount));
                }
            }
        }
예제 #3
0
        public void CreateCalendarLivetile(int appointCount)
        {
            Uri tileUri = new Uri("/View/MainPage.xaml?pi=PICalendar&tile=calendar", UriKind.Relative);

            ShellTile.Create(tileUri, LivetileHelper.GetCalendarLivetileData(appointCount), false);
        }