示例#1
0
        void OnWindowItemInfoChanged(DependencyPropertyChangedEventArgs e)
        {
            if (!processWindowItemInfoChanged || ActualWindow == null)
            {
                return;
            }
            TaskbarItemInfo itemInfo = (TaskbarItemInfo)e.NewValue;

            if (itemInfo == null)
            {
                itemInfo = new TaskbarItemInfo();
                TaskbarInfoApplicator.SetTaskbarItemInfo(ActualWindow, itemInfo);
            }
            ItemInfo = itemInfo;
        }
示例#2
0
        protected override void OnActualWindowChanged(Window oldWindow)
        {
            if (oldWindow != null)
            {
                oldWindow.SizeChanged -= OnWindowSizeChanged;
                oldWindow.Loaded      -= OnWindowLoaded;
            }
            processWindowItemInfoChanged = false;
            Window window = ActualWindow;

            if (window == null)
            {
                BindingOperations.ClearBinding(this, WindowItemInfoProperty);
                ItemInfo = new TaskbarItemInfo();
                return;
            }
            if (window.TaskbarItemInfo == null)
            {
                TaskbarInfoApplicator.SetTaskbarItemInfo(window, ItemInfo);
            }
            else
            {
                window.TaskbarItemInfo.ProgressState       = ItemInfo.ProgressState;
                window.TaskbarItemInfo.ProgressValue       = ItemInfo.ProgressValue;
                window.TaskbarItemInfo.Description         = ItemInfo.Description;
                window.TaskbarItemInfo.Overlay             = ItemInfo.Overlay;
                window.TaskbarItemInfo.ThumbButtonInfos    = ItemInfo.ThumbButtonInfos;
                window.TaskbarItemInfo.ThumbnailClipMargin = ItemInfo.ThumbnailClipMargin;
                ItemInfo = window.TaskbarItemInfo;
            }
            if (window.TaskbarItemInfo != null)
            {
                BindingOperations.SetBinding(this, WindowItemInfoProperty, new Binding("TaskbarItemInfo")
                {
                    Source = window, Mode = BindingMode.TwoWay, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged
                });
                processWindowItemInfoChanged = true;
            }
            window.SizeChanged -= OnWindowSizeChanged;
            window.SizeChanged += OnWindowSizeChanged;
            window.Loaded      -= OnWindowLoaded;
            window.Loaded      += OnWindowLoaded;
            OnWindowSizeChanged(Window, null);
        }