Ejemplo n.º 1
0
        private void FrmViewInbox_Load(object sender, EventArgs e)
        {
            //new form
            Form f = new Form();
            //define the size of the form
            f.Size = new Size(400, 200);
            //make no border style
            f.FormBorderStyle = FormBorderStyle.None;
            //don't minimize the box
            f.MinimizeBox = false;
            //change the background colour
            f.BackColor = System.Drawing.Color.DarkBlue;
            //change the text in the form
            f.Text = "Just Loading";
            //don't maximise box
            f.MaximizeBox = true;
            //initalise the new resource manager
            ResourceManager rm = Resources.ResourceManager;
            //add the bitmap image
            Image im = (Bitmap)rm.GetObject("Spinning_Gif");
            //initalise the picturebox
            PictureBox pb = new PictureBox();
            //fill the dock
            pb.Dock = DockStyle.Fill;
            pb.Image = im;
            pb.Location = new Point(5, 5);
            //show the form and add the controls.
            f.Controls.Add(pb);
            f.Show();
            //this protects us for any internet connection outages
            bool Result = CheckForInternetConnection();
            //this runs if the internet connection is all ok
            if (Result == true)
            {
                //create instance of the EmailCollection
                clsEmailCollection Emails = new clsEmailCollection();

                //this will add new emails from the server online
                Emails.UpdateEmails();

                LoadEmails();
                f.Close();
            }
            else
            {
                LoadEmails();
                //this runs if the internet connection is not good.
                MessageBox.Show("You must have an active internet connection to retrieve latest emails.");
                f.Close();
            }
        }
        public void CheckIfUpdatedEmails()
        {
            clsEmailCollection Emails = new clsEmailCollection();

            Emails.UpdateEmails();

        }