Exemple #1
0
        private void BtnSave_Click(object sender, EventArgs e)
        {
            if (TxtBoxTitle.Text == "")
            {
                LblInputError.Font    = new Font("Microsoft Sans Serif", 14);
                LblInputError.Text    = "Title field can't be empty";
                LblInputError.Visible = true;
                return;
            }

            if (imgLoc == "")
            {
                LblInputError.Font    = new Font("Microsoft Sans Serif", 12);
                LblInputError.Text    = "You have to choose an image";
                LblInputError.Visible = true;
                return;
            }

            try
            {
                DataAccess.SaveImage(TxtBoxTitle.Text, imgLoc);
                Meme.ShowMeme(DataAccess.CountAllMemes());
                Close();
            }
            catch
            {
                LblInputError.Font    = new Font("Microsoft Sans Serif", 14);
                LblInputError.Text    = "No internet connection!";
                LblInputError.Visible = true;
            }
        }
Exemple #2
0
        private void ShowAllMemes()
        {
            int allMemes = DataAccess.CountAllMemes();

            for (int i = 0; i < allMemes; i++)
            {
                Meme.ShowMeme(i + 1);
            }
        }