Ejemplo n.º 1
0
        void btnSave_Click(object sender, EventArgs e)
        {
            var shiftColors = new Color[14];

            shiftColors[0]  = ShiftSkinData.LeftTopCornerColor;
            shiftColors[1]  = ShiftSkinData.TitleBarColor;
            shiftColors[2]  = ShiftSkinData.RightTopCornerColor;
            shiftColors[3]  = ShiftSkinData.LeftSideColor;
            shiftColors[4]  = ShiftSkinData.RightSideColor;
            shiftColors[5]  = ShiftSkinData.LeftBottomCornerColor;
            shiftColors[6]  = ShiftSkinData.BottomSideColor;
            shiftColors[7]  = ShiftSkinData.RightBottomCornerColor;
            shiftColors[8]  = ShiftSkinData.BtnCloseColor;
            shiftColors[9]  = ShiftSkinData.BtnMaxColor;
            shiftColors[10] = ShiftSkinData.BtnMinColor;
            shiftColors[11] = ShiftSkinData.BtnCloseHoverColor;
            shiftColors[12] = ShiftSkinData.BtnMaxHoverColor;
            shiftColors[13] = ShiftSkinData.BtnMinHoverColor;

            using (var fobj = File.OpenWrite(@"C:\Users\Public\Documents\Skin.whoa"))
                Whoa.Whoa.SerialiseObject(fobj, shiftColors);

            ShiftWM.StartInfoboxSession(
                "Saved Skin",
                "Saved Skin to C:\\Users\\Public\\Documents\\Skin.whoa",
                InfoboxTemplate.ButtonType.Ok);
        }
Ejemplo n.º 2
0
        private void btnLoad_Click(object sender, EventArgs e)
        {
            var shiftColors = new Color[14];

            using (var fobj = File.OpenRead(@"C:\Users\Public\Documents\Skin.whoa"))
                shiftColors = Whoa.Whoa.DeserialiseObject <Color[]>(fobj);

            ShiftSkinData.LeftTopCornerColor     = shiftColors[0];
            ShiftSkinData.TitleBarColor          = shiftColors[1];
            ShiftSkinData.RightTopCornerColor    = shiftColors[2];
            ShiftSkinData.LeftSideColor          = shiftColors[3];
            ShiftSkinData.RightSideColor         = shiftColors[4];
            ShiftSkinData.LeftBottomCornerColor  = shiftColors[5];
            ShiftSkinData.BottomSideColor        = shiftColors[6];
            ShiftSkinData.RightBottomCornerColor = shiftColors[7];
            ShiftSkinData.BtnCloseColor          = shiftColors[8];
            ShiftSkinData.BtnMaxColor            = shiftColors[9];
            ShiftSkinData.BtnMinColor            = shiftColors[10];
            ShiftSkinData.BtnCloseHoverColor     = shiftColors[11];
            ShiftSkinData.BtnMaxHoverColor       = shiftColors[12];
            ShiftSkinData.BtnMinHoverColor       = shiftColors[13];

            button5_Click(sender, e);
            ShiftWM.StartInfoboxSession(
                "Loaded Skin",
                "Loaded Skin from C:\\Users\\Public\\Documents\\Skin.whoa",
                InfoboxTemplate.ButtonType.Ok);
        }
Ejemplo n.º 3
0
        void Button1_Click(object sender, EventArgs e)
        {
            var demo = new ShiftDemo();

            ShiftWM.Init(demo, textBox1.Text, null);
            ShiftWM.StartInfoboxSession(textBox1.Text, textBox2.Text, InfoboxTemplate.ButtonType.Ok);
        }
Ejemplo n.º 4
0
        Color SetColor()
        {
            _colorType1 = int.Parse(redUpDown.Value.ToString(CultureInfo.InvariantCulture));
            _colorType2 = int.Parse(greenUpDown.Value.ToString(CultureInfo.InvariantCulture));
            _colorType3 = int.Parse(blueUpDown.Value.ToString(CultureInfo.InvariantCulture));
            try
            {
                _finalColor = Color.FromArgb(_colorType1, _colorType2, _colorType3);


                foreach (var window in ShiftWM.Windows)
                {
                    window.Invoke(new Action(() => window.titleBar.BackColor = _finalColor));
                }


                ShiftWM.StartInfoboxSession(
                    "Success!",
                    $"Changed color to:\r\n{_colorType1}, {_colorType2}, {_colorType3}.",
                    InfoboxTemplate.ButtonType.Ok);
            }
            catch (Exception)
            {
                ShiftWM.StartInfoboxSession("Error!", "An error occured while setting the color.", InfoboxTemplate.ButtonType.Ok);
            }
            return(_finalColor);
        }
Ejemplo n.º 5
0
        private void gameTimer_Tick(object sender, EventArgs e)
        {
            ball.Top  += (int)ballY;
            ball.Left += (int)ballX;

            if (ball.Bottom > ClientSize.Height || ball.Top < 0)
            {
                ballY = -ballY;
            }
            if (ball.Right > ClientSize.Width || ball.Left < 0)
            {
                ballX = -ballX;
            }
            if (ball.Bounds.IntersectsWith(playerPaddle.Bounds))
            {
                ballY = -ballY;
            }
            if (goRight)
            {
                playerPaddle.Left += 8;
            }
            if (goLeft)
            {
                playerPaddle.Left -= 8;
            }
            if (playerPaddle.Left < 1)
            {
                goLeft = false;
            }
            if (playerPaddle.Left + playerPaddle.Width > this.Width)
            {
                goRight = false;
            }

            for (int j = 0; j < rows; j++)
            {
                for (int i = 0; i < col; i++)
                {
                    if (ball.Bounds.IntersectsWith(blocks[j, i].Bounds) && blocks[j, i].Visible)
                    {
                        ballY = -ballY;
                        blocks[j, i].Visible = false;
                    }
                }
            }
            if (ball.Top + ball.Height > ClientSize.Height)
            {
                gameTimer.Stop();
                var infoBox = ShiftWM.StartInfoboxSession("Breakout - You Lose! ", "It appears that you have lost the game, meaning\nall codepoints won were lost. Would you\nlike to try again?", InfoboxTemplate.ButtonType.YesNo);
                ShiftWM.StartInfoboxSession(null, infoBox.isOK.ToString(), InfoboxTemplate.ButtonType.Ok);
                infoBox.btnOpt1.Click += InfoboxYes;
                infoBox.btnOpt2.Click += InfoboxYes;
            }
        }
Ejemplo n.º 6
0
 private void shiftButton1_Click(object sender, EventArgs e)
 {
     ShiftWM.StartInfoboxSession("Test", "lol", InfoboxTemplate.ButtonType.Ok);
 }