Ejemplo n.º 1
0
        /// <summary>
        /// Initializes the thumbnails.
        /// </summary>
        /// <remarks>...</remarks>
        private void InitializeThumbnails()
        {
            this.ForEachHWND((current, text) => {
                var t = new TextBlock();
                t.HorizontalAlignment = HorizontalAlignment.Center;
                t.TextAlignment       = TextAlignment.Center;
                t.TextWrapping        = TextWrapping.Wrap;
                t.TextTrimming        = TextTrimming.CharacterEllipsis;
                t.MaxHeight           = 46;
                t.FontSize            = 14;
                t.Margin     = new Thickness(0, 10, 0, 0);
                t.Foreground = Brushes.White;
                t.Text       = text;
                ThumbsList.Children.Add(t);

                var thumb    = new DWMThumbnailControl(this);
                thumb.Width  = 120;
                thumb.Height = 120;
                thumb.Source = current;
                ThumbsList.Children.Add(thumb);
            });

            this.Width++;
            this.Width--;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Handles the <see cref="E:Loaded" /> event.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="RoutedEventArgs" /> instance containing the event data.</param>
        /// <remarks>...</remarks>
        private void OnLoaded(object sender, RoutedEventArgs e)
        {
            Focus();
            Activate();

            AnimationExtensions.Animate(this, OpacityProperty, 250, 1, 0.8, 0.2);
            AnimationExtensions.Animate(this, LeftProperty, 250, 2 * Left, Left, 0.9, 0.1);

            var index = 1;

            foreach (var hWnd in hWnds)
            {
                try {
                    var text  = WinAPI.GetText(hWnd);
                    var dwmtc = new DWMThumbnailControl(this)
                    {
                        ToolTip = text,
                        Width   = Width - 50,
                        Height  = Height - 50,
                        Source  = hWnd
                    };

                    ThumbnailsContainer.Children.Add(dwmtc);
                    TextTitle.Text = text;

                    if (hWnds.Count > 1 && index > 1)
                    {
                        Width = Width + dwmtc.Width;
                    }
                    else
                    {
                        Width++;
                        Width--;
                    }

                    index++;
                }
                catch /* Eat */ { }
            }
        }