void source_GetEntriesCompleted(object sender, GetEntriesCompletedEventArgs args) { #if DEBUG DebugUtility.DebugOutputMemoryUsage("Beginning Entries Completed Handler"); #endif source = null; System.GC.Collect(); System.GC.WaitForPendingFinalizers(); System.GC.Collect(); service = new PhoneTileUpdateService(); var tileContacts = new List <BirthdayContact>(); if (args.Contacts.Any()) { tileContacts = args.Contacts.OrderBy(it => it.DaysUntil).Take(3).ToList(); } //var count = args.Contacts.Where(it => it.DaysUntil == 0).Count(); var count = 0; args.Contacts = null; System.GC.Collect(); System.GC.WaitForPendingFinalizers(); System.GC.Collect(); service.UpdateTileSynchronous(tileContacts, count, UpdateTileCompleted); }
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { try { #if !AGENT var source = KernelService.Kernel.Get <IBirthdaySource>(); #else var source = new PhoneBirthdaySource(); #endif var picture = source.GetContactPicture(value.ToString()); if (picture != null) { MemoryStream s = new MemoryStream(picture, true); BitmapImage imgSource = new BitmapImage(); imgSource.SetSource(s); return(imgSource); } } catch (Exception ex) { var msg = ex.Message; } return(new BitmapImage()); }
/// <summary> /// Agent that runs a scheduled task /// </summary> /// <param name="task"> /// The invoked task /// </param> /// <remarks> /// This method is called when a periodic or resource intensive task is invoked /// </remarks> protected override void OnInvoke(ScheduledTask task) { #if DEBUG AgentExitReason reason = task.LastExitReason; DebugUtility.SaveDiagnostics(new Diagnostics() { DeviceUniqueId = DebugUtility.GetDeviceUniqueID(), AgentExitReason = reason.ToString() }); Debug.WriteLine("Agent Last Exited for Reason: " + reason.ToString()); DebugUtility.DebugStartStopwatch(); DebugUtility.DebugOutputMemoryUsage("Scheduled Task Initial Memory Snapshot"); #endif source = new PhoneBirthdaySource(); source.GetEntriesCompleted += source_GetEntriesCompleted; source.BeginGetAllEntries(); }