Example #1
0
        private void Update(object sender, EventArgs e)
        {
            List <Window> NewWindows = new List <Window>(Win32.GetDesktopWindowsTitles());

            foreach (Window w in NewWindows.Except(CurrentWindows).ToList())
            {
                WindowBar b  = new WindowBar(w, this);
                Expander  ex = BuildExpander(b);
                ex.Name = w.name;

                if (!pages.ContainsKey(w.group))
                {
                    AddPage(w.group);
                }

                pages[w.group].panel.Controls.Add(ex);
            }

            foreach (Window w in CurrentWindows.Except(NewWindows).ToList())
            {
                pages[w.group].panel.Controls.RemoveByKey(w.name);
            }

            foreach (string wp in pages.Keys)
            {
                if (pages[wp].panel.Controls.Count == 0)
                {
                    pages.Remove(wp);
                }
            }

            CurrentWindows = NewWindows;
        }
Example #2
0
        private Expander BuildExpander(WindowBar b)
        {
            Expander expander = new Expander();

            expander.Size        = new Size(250, 400);
            expander.Left        = 10;
            expander.Top         = 10;
            expander.BorderStyle = BorderStyle.FixedSingle;

            ExpanderHelper.CreateLabelHeader(expander, b.window.handle.ToString() + " -- " + b.window.name, backColor: SystemColors.ActiveBorder);

            Label labelContent = new Label();

            labelContent.Size = new System.Drawing.Size(expander.Width, 80);
            expander.Content  = b;
            expander.Toggle();
            return(expander);
            // this.Controls.Add(expander);
        }