Exemplo n.º 1
0
        /// <summary>
        /// Gets the task preview image
        /// </summary>
        protected override void GetPreview()
        {
            // if window is minimized, then don't get it's thumbnail
            if (false && !WindowsTaskManager.GetWindowBounds(Handle).IntersectsWith(System.Windows.Forms.Screen.PrimaryScreen.Bounds))
            {
                return;
            }

            // getting the screenshot
            try
            {
                using (Bitmap Shot = WindowsTaskManager.GetWindowBitmap(Handle))
                {
                    // thumbnailing not needed

                    /*using(Bitmap ShotThumb=(Bitmap)ImageHelper.GetAspectThumbnail(Shot, new Size(Global.Configuration.Appearance.IconMagnifiedSize, Global.Configuration.Appearance.IconMagnifiedSize)))
                     * {
                     *      SetBackground(ShotThumb);
                     * }*/
                    SetBackground(Shot);
                }
                Compose();
            }
            catch (Exception) {}
        }
Exemplo n.º 2
0
        private void LoadExcludedTasks()
        {
            // load the exclusion list
            ExcludedWindow[] ExclusionList = WindowsTaskManager.LoadExcludedClassWindows(System.IO.Path.Combine(System.IO.Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath), @"profiles\" + System.Environment.UserName + @"\ExcludedTasks.xml"));

            if (ExclusionList == null)
            {
                return;
            }

            // actually catalog them
            int i = 0;

            foreach (ExcludedWindow window in ExclusionList)
            {
                TaskItemControl tic = new TaskItemControl();

                tic.ProcessName = window.ProcessName;
                tic.ClassName   = window.ClassName;

                // try to find a currently running window that matches this spec
                IntPtr FoundWindow = FindFirstWindowLike(window);
                if (FoundWindow != IntPtr.Zero)
                {
                    tic.WindowTitle = WindowsTaskManager.GetWindowText(FoundWindow);
                    using (Bitmap shot = WindowsTaskManager.GetWindowBitmap(FoundWindow))
                    {
                        tic.WindowScreenshot = ImageHelper.GetAspectThumbnail(shot, new Size(64, 64));
                    }
                }
                else
                {
                    tic.WindowTitle = System.IO.Path.GetFileNameWithoutExtension(window.ProcessName);
                }

                // set this properties
                tic.Width   = this.TasksListPanel.Width;
                tic.Anchor |= AnchorStyles.Right;
                tic.Top     = tic.Height * i;

                // hook up events
                tic.RemoveLinkClicked += new EventHandler(tic_RemoveLinkClicked);

                this.TasksListPanel.Controls.Add(tic);
                i++;
            }
        }