Exemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            ConnectionFactory confac = new CloudConnectionFactory();

            Connection conn = confac.createConnection("AmazonWebServices", Connection.TypeOfMsg.Announcement);

            Random rand = new Random();

            if (descriptionBox.TextLength.Equals(0))
                MessageBox.Show("Please enter the description for your event");
            else if (imgFileLocation.TextLength > 2)
                MessageBox.Show("Please enter just two characters (eg. 6v)");
            else
            {

                Advertisement newAd = new Advertisement(rand.Next(10,1000), imgFileLocation.Text, descriptionBox.Text);

                statusLbl1.Text = "Sending Advertisement...";

                statusLbl1.Show();

                Thread.Sleep(1000);

                statusLbl1.Hide();

                statusLbl1.Text = "Advertisement Sent";

                statusLbl1.Show();

                conn.sendMessage(newAd);
            }
        }
Exemplo n.º 2
0
        //Timer Event
        private void pollingTimeReached(object sender, EventArgs e)
        {
            pollingTimer.Stop();

            if (System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable())
            {
                //Factory Method

                ConnectionFactory factory = new CloudConnectionFactory();

                Connection neededCon = factory.createConnection("AmazonWebServices", Connection.TypeOfMsg.Announcement);

                List<_2103Project.Entities.Advertisement> listOfAdv = neededCon.checkMessages();

                populateAdvertisement(listOfAdv);
            }

            pollingTimer.Start();
        }