Пример #1
0
        /// <summary>
        /// Freeze a hub tile.
        /// </summary>
        /// <param name="tile">The hub tile to be frozen.</param>
        public static void FreezeHubTile(HubTile tile)
        {
            WeakReference wref = new WeakReference(tile, TrackResurrection);

            AddReferenceToFrozenPool(wref);
            RemoveReferenceFromEnabledPool(wref);
            RemoveReferenceFromStalledPipeline(wref);
        }
Пример #2
0
        /// <summary>
        /// Remove all references of a hub tile before finalizing it.
        /// </summary>
        /// <param name="tile">The hub tile that is to be finalized.</param>
        internal static void FinalizeReference(HubTile tile)
        {
            WeakReference wref = new WeakReference(tile, TrackResurrection);

            HubTileService.RemoveReferenceFromEnabledPool(wref);
            HubTileService.RemoveReferenceFromFrozenPool(wref);
            HubTileService.RemoveReferenceFromStalledPipeline(wref);
        }
Пример #3
0
        /// <summary>
        /// Removes the frozen image from the enabled image pool or the stalled image pipeline.
        /// Adds the non-frozen image to the enabled image pool.
        /// </summary>
        /// <param name="obj">The dependency object.</param>
        /// <param name="e">The event information.</param>
        private static void OnIsFrozenChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
        {
            HubTile tile = (HubTile)obj;

            if ((bool)e.NewValue)
            {
                HubTileService.FreezeHubTile(tile);
            }
            else
            {
                HubTileService.UnfreezeHubTile(tile);
            }
        }
Пример #4
0
        /// <summary>
        /// Prevents the hub tile from transitioning into a Semiexpanded or Collapsed visual state if the title is not set.
        /// </summary>
        /// <param name="obj">The dependency object.</param>
        /// <param name="e">The event information.</param>
        private static void OnTitleChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
        {
            HubTile tile = (HubTile)obj;

            if (string.IsNullOrEmpty((string)e.NewValue))
            {
                tile._canDrop = false;
                tile.State    = ImageState.Expanded;
            }
            else
            {
                tile._canDrop = true;
            }
        }
Пример #5
0
        /// <summary>
        /// Add a reference to a newly instantiated hub tile.
        /// </summary>
        /// <param name="tile">The newly instantiated hub tile.</param>
        internal static void InitializeReference(HubTile tile)
        {
            WeakReference wref = new WeakReference(tile, TrackResurrection);

            if (tile.IsFrozen)
            {
                AddReferenceToFrozenPool(wref);
            }
            else
            {
                AddReferenceToEnabledPool(wref);
            }

            RestartTimer();
        }
Пример #6
0
        /// <summary>
        /// Prevents the hub tile from transitioning into a Flipped visual state if neither the notification alert nor the message are set.
        /// </summary>
        /// <param name="obj">The dependency object.</param>
        /// <param name="e">The event information.</param>
        private static void OnBackContentChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
        {
            HubTile tile = (HubTile)obj;

            // If there is a new notification or a message, the hub tile can flip.
            if ((!(string.IsNullOrEmpty(tile.Notification)) && tile.DisplayNotification) ||
                (!(string.IsNullOrEmpty(tile.Message)) && !tile.DisplayNotification))
            {
                tile._canFlip = true;
            }
            else
            {
                tile._canFlip = false;
                tile.State    = ImageState.Expanded;
            }
        }
Пример #7
0
        /// <summary>
        /// Add a reference to a newly instantiated hub tile.
        /// </summary>
        /// <param name="tile">The newly instantiated hub tile.</param>
        internal static void InitializeReference(HubTile tile)
        {
            WeakReference wref = new WeakReference(tile, TrackResurrection);
            if (tile.IsFrozen) {
                AddReferenceToFrozenPool(wref);
            } else {
                AddReferenceToEnabledPool(wref);
            }

            RestartTimer();
        }
Пример #8
0
 /// <summary>
 /// Remove all references of a hub tile before finalizing it.
 /// </summary>
 /// <param name="tile">The hub tile that is to be finalized.</param>
 internal static void FinalizeReference(HubTile tile)
 {
     WeakReference wref = new WeakReference(tile, TrackResurrection);
     HubTileService.RemoveReferenceFromEnabledPool(wref);
     HubTileService.RemoveReferenceFromFrozenPool(wref);
     HubTileService.RemoveReferenceFromStalledPipeline(wref);
 }
Пример #9
0
        /// <summary>
        /// Unfreezes a hub tile and restarts the timer if needed.
        /// </summary>
        /// <param name="tile">The hub tile to be unfrozen.</param>
        public static void UnfreezeHubTile(HubTile tile)
        {
            WeakReference wref = new WeakReference(tile, TrackResurrection);
            AddReferenceToEnabledPool(wref);
            RemoveReferenceFromFrozenPool(wref);
            RemoveReferenceFromStalledPipeline(wref);

            RestartTimer();
        }