Exemple #1
0
        public DialogueForm(OverlayForm parent, HomeForm homeForm, string theme, int timerValue)
        {
            //set parent form
            OVERLAYFORM = parent;
            //set current form
            DIALOGUEFORM = this;

            InitializeComponent();

            //setstyle
            DIALOGUEFORM.BackColor = Color.FromName(theme);
            //set time
            timeLeft            = timerValue;
            messageLabel.Text   = homeForm.CONFIG_FILE.timeoutText;
            countdownLabel.Text = timeLeft + " seconds";

            Font tempFont = new Font("Arial", homeForm.CONFIG_FILE.timeoutFontSize);

            messageLabel.Font   = tempFont;
            countdownLabel.Font = tempFont;
            ContinueButton.Font = tempFont;

            DIALOGUEFORM.Size   = new Size(homeForm.CONFIG_FILE.timeoutWidth, homeForm.CONFIG_FILE.timeoutHeight);
            messageLabel.Size   = new Size(DIALOGUEFORM.Width, messageLabel.Height);
            countdownLabel.Size = new Size(DIALOGUEFORM.Width, countdownLabel.Height);
            ContinueButton.Size = new Size(DIALOGUEFORM.Width / 3, DIALOGUEFORM.Height / 6);

            DIALOGUEFORM.CenterToScreen();
            messageLabel.Location   = new Point((DIALOGUEFORM.Width / 2) - (messageLabel.Width / 2), (DIALOGUEFORM.Height / 6) * 1);
            countdownLabel.Location = new Point((DIALOGUEFORM.Width / 2) - (countdownLabel.Width / 2), (DIALOGUEFORM.Height / 6) * 2);
            ContinueButton.Location = new Point((DIALOGUEFORM.Width / 2) - (ContinueButton.Width / 2), (DIALOGUEFORM.Height / 6) * 4);
        }
Exemple #2
0
        private bool ButtonSetup()
        {
            //initialise button list and set as invisible
            BUTTONLIST = new PictureBox[CONFIG_FILE.numOfButtons];
            for (int i = 0; i < BUTTONLIST.Length; i++)
            {
                BUTTONLIST[i] = new PictureBox
                {
                    Name      = "AppButton" + i,
                    BackColor = Color.White,
                    SizeMode  = PictureBoxSizeMode.StretchImage
                };
                BUTTONLIST[i].Click += ButtonClick;
                BUTTONLIST[i].Paint += ButtonText_Paint;
                HOMEFORM.Controls.Add(BUTTONLIST[i]);
            }

            //setup all app buttons
            Image image;

            for (int i = 0; i < CONFIG_FILE.numOfButtons; i++)
            {
                ButtonConfig temp = CONFIG_FILE.appButtonsConfig[i];
                //get image from path
                try { image = Image.FromFile(Path.Combine(CONFIG_FILE.resourceFolder, temp.backgroundImageName)); }
                catch { image = null; }
                BUTTONLIST[i].Image = image;
            }

            //create home button from config
            try { OVERLAYFORM = new OverlayForm(HOMEFORM); }
            catch { return(true); }

            return(false);
        }
Exemple #3
0
        public OverlayForm(HomeForm parent)
        {
            //get home screen object
            HOMEFORM = parent;
            //set current form as object
            OVERLAYFORM = this;

            InitializeComponent();

            HomeConfig temp = HOMEFORM.CONFIG_FILE.homeButtonConfig;

            //set home button image
            HomeButton.Image  = Image.FromFile(Path.Combine(HOMEFORM.CONFIG_FILE.resourceFolder, temp.backgroundImageName));
            HomeButton.Click += HomeButton_Click;
            HomeButton.Paint += ButtonText_Paint;

            //set button size
            OVERLAYFORM.Size = new Size(temp.buttonWidth, temp.buttonHeight);

            HomeButton.Size = new Size(temp.buttonWidth, temp.buttonHeight);
            //move home button to position
            Rectangle workingArea = Screen.GetWorkingArea(OVERLAYFORM);

            if (temp.buttonPosition == "TOPRIGHT")
            {
                OVERLAYFORM.Location = new Point(workingArea.Right - temp.buttonWidth - temp.buttonPaddingHorizontal, workingArea.Top + temp.buttonPaddingVertical);
            }
            else if (temp.buttonPosition == "TOPLEFT")
            {
                OVERLAYFORM.Location = new Point(workingArea.Left + temp.buttonPaddingHorizontal, workingArea.Top + temp.buttonPaddingVertical);
            }
            else if (temp.buttonPosition == "BOTTOMRIGHT")
            {
                OVERLAYFORM.Location = new Point(workingArea.Right - temp.buttonWidth - temp.buttonPaddingHorizontal, workingArea.Bottom - temp.buttonHeight - temp.buttonPaddingVertical);
            }
            else if (temp.buttonPosition == "BOTTOMLEFT")
            {
                OVERLAYFORM.Location = new Point(workingArea.Left + temp.buttonPaddingHorizontal, workingArea.Bottom - temp.buttonHeight - temp.buttonPaddingVertical);
            }

            //timeout config
            TIMEOUT = HOMEFORM.CONFIG_FILE.timeoutTime;
            MAXIDLE = HOMEFORM.CONFIG_FILE.idleTimeout / IDLEINTERVAL;

            //set idle check hooks
            _proc       = HookCallback;
            kh.KeyDown += Kh_KeyDown;
            _hookID     = SetHook(_proc);
        }