Exemple #1
0
 /// <summary> GetWindowsCallback(IntPtr, ref ArrayList)
 /// The Hook used by EnumWindows in GetWindows,
 /// Adds prominent Windows to the array
 /// which GetWindows returns
 /// </summary>
 /// <param name="hndl">The Handle being handled this instance</param>
 /// <param name="rtrn">The ArrayList that will become GetWindows return-Array</param>
 /// <returns></returns>
 internal static bool      GetWindowsCallback(IntPtr hndl, ref ArrayList rtrn)
 {
     if (IsProminentWindow(hndl))
     {
         APPDAT PromApp = new APPDAT(hndl);
         rtrn.Add(PromApp);
     }
     return(true);
 }
Exemple #2
0
        /// <summary> Draw(Graphics, APPDAT[], APPDAT[], ref FourPoing, ref FourPoint)
        /// Redraws the GUI using data from the console.
        /// </summary>
        /// <param name="graphic"> The graphic object being used to draw the GUI</param>
        /// <param name="free"> The APPDAT[] representing the Free-Apps.</param>
        /// <param name="decks"> The APPDAT[][] representing the Decked-Apps</param>
        /// <param name="position"> The FourPoint used to represent the cursor position</param>
        /// <param name="saved"> The FourPoint used to tell the cursor position at swap-call</param>
        internal void Draw(Graphics graphic, APPDAT[] free, Deck[] decks, ref FourPoint position, ref FourPoint saved)
        {
            bool DrawDeck = position.X1 != decks.Length;

            APPDAT[] CrntDeck;
            if (DrawDeck)
            {
                CrntDeck = decks[position.X1].apps;
            }
            else
            {
                CrntDeck = new APPDAT[0];
            }

            GraphicsPath path = new GraphicsPath();

            //Paint BG, should cover up anything that used to be there.
            graphic.DrawImage(this.bgImage, new Point(0, 0));
            switch (state)
            {
            //Default Case is so straight forward.
            case GUIstate.Default:
                DrawRow0(graphic, free, position.X0, count);
                DrawRow1(graphic, decks.Length, position.X1);
                if (DrawDeck)
                {
                    DrawRow2(graphic, CrntDeck, position.X2, count);
                }
                DrawCursor(graphic, Color.Black, position.Y);
                break;

            //Unlike the swapping case, which is radically different in a million ways, and looks like the ugliest code ever.
            case GUIstate.Swapping:
                Color theBG = Color.Transparent;
                switch (saved.Y)
                {
                case 0:
                    theBG = free[saved.X0].iconBG;
                    DrawRow0b(graphic, free, ref position, ref saved, count, theBG, free[saved.X0].icon);
                    DrawRow1b(graphic, decks.Length, ref position, ref saved, theBG, free[saved.X0].icon);
                    if (DrawDeck)
                    {
                        DrawRow2b(graphic, CrntDeck, ref position, ref saved, count, theBG, free[saved.X0].icon);
                    }
                    break;

                case 1:
                    DrawRow0b(graphic, free, ref position, ref saved, count, theBG, deckImg);
                    DrawRow1b(graphic, decks.Length, ref position, ref saved, theBG, deckImg);
                    if (DrawDeck)
                    {
                        DrawRow2b(graphic, CrntDeck, ref position, ref saved, count, theBG, deckImg);
                    }
                    break;

                case 2:
                    theBG = decks[saved.X1].apps[saved.X2].iconBG;
                    DrawRow0b(graphic, free, ref position, ref saved, count, theBG, decks[saved.X1].apps[saved.X2].icon);
                    DrawRow1b(graphic, decks.Length, ref position, ref saved, theBG, decks[saved.X1].apps[saved.X2].icon);
                    if (DrawDeck)
                    {
                        DrawRow2b(graphic, CrntDeck, ref position, ref saved, count, theBG, decks[saved.X1].apps[saved.X2].icon);
                    }
                    break;
                }
                DrawCursor(graphic, Color.Blue, position.Y);
                break;
            }
            if (this.state == GUIstate.Default)
            {
                switch (position.Y)
                {
                case 0:
                    DrawWindowText(graphic, free[position.X0].windowText, Color.Black);
                    break;

                case 1:
                    if (position.X1 == decks.Length)
                    {
                        DrawWindowText(graphic, "New Deck", Color.Black);
                    }
                    else
                    {
                        DrawWindowText(graphic, "Deck", Color.Black);
                    }
                    break;

                case 2:
                    DrawWindowText(graphic, decks[position.X1].apps[position.X2].windowText, Color.Black);
                    break;
                }
            }
            else if (this.state == GUIstate.Swapping)
            {
                switch (saved.Y)
                {
                case 0:
                    DrawWindowText(graphic, free[saved.X0].windowText, Color.Black);
                    break;

                case 1:
                    DrawWindowText(graphic, "Deck", Color.Black);
                    break;

                case 2:
                    DrawWindowText(graphic, decks[saved.X1].apps[saved.X2].windowText, Color.Black);
                    break;
                }
            }
        }