示例#1
0
        private void buttonCheck_MouseClick(object sender, MouseEventArgs e)
        {
            var our_date = new CheckTemp(textBoxCity.Text, 0);

            if (!our_date.downloadJson())
            {
                return;
            }
            setLabels(our_date.Data);
        }
示例#2
0
 public IfThenActions(CheckTemp _checker, SendEmail _sender, string _name)
 {
     Name = _name;
     if (String.IsNullOrEmpty(Name))
     {
         Name = "Is temperature higher than " + _checker.Temp + "? Send it to " + _sender.Email;
     }
     checker      = _checker;
     sender       = _sender;
     con_act_type = Type.CheckSend;
 }
示例#3
0
 public IfThenActions(CheckTemp _checker, ShowOnBrowser _show, string _name)
 {
     Name = _name;
     if (String.IsNullOrEmpty(Name))
     {
         Name = "Is temperature higher than " + _checker.Temp + "? Show me it";
     }
     checker      = _checker;
     show         = _show;
     con_act_type = Type.CheckShow;
 }
示例#4
0
 private void textBoxCity_KeyPress(object sender, KeyPressEventArgs e)
 {
     if (e.KeyChar == (char)Keys.Enter)
     {
         e.Handled = true;
         var our_date = new CheckTemp(textBoxCity.Text, 0);
         if (!our_date.downloadJson())
         {
             return;
         }
         setLabels(our_date.Data);
     }
 }
示例#5
0
        private void buttonMake_Click(object sender, EventArgs e)
        {
            if (znajdzNaStronie.Visible && wyslijMaila.Visible)
            {
                var find = new FindOnWebsite(znajdzNaStronie.Url, znajdzNaStronie.MatchWord);
                var send = new SendEmail(wyslijMaila.Subject, wyslijMaila.Email, "Client");

                var con_act = new IfThenActions(find, send, textBoxName.Text);

                if (!send.AddressOK)
                {
                    logger.Write("buttonMake_Click", "Błąd adresu email");
                    Debug.WriteLine("Error: Email address corrupt");
                    return;
                }
                //
                list.Add(con_act);

                // dodanie akcji do bazy danych
                var db = new JTTTDBContext();
                db.IfThatActions.Add(con_act);
                db.SaveChanges();

                updateList();
            }
            else if (znajdzNaStronie.Visible && comboBoxTHEN.Text == "Wyświetl w przeglądarce")
            {
                var find = new FindOnWebsite(znajdzNaStronie.Url, znajdzNaStronie.MatchWord);
                var show = new ShowOnBrowser(find);

                var con_act = new IfThenActions(find, show, textBoxName.Text);

                //
                list.Add(con_act);

                // dodanie akcji do bazy danych
                var db = new JTTTDBContext();
                db.IfThatActions.Add(con_act);
                db.SaveChanges();

                updateList();
            }
            else if (sprawdzPogode1.Visible && wyslijMaila.Visible)
            {
                var checker = new CheckTemp(sprawdzPogode1.City, sprawdzPogode1.Temp);
                var send    = new SendEmail(wyslijMaila.Subject, wyslijMaila.Email, "Client");

                var con_act = new IfThenActions(checker, send, textBoxName.Text);

                if (!send.AddressOK)
                {
                    logger.Write("buttonMake_Click", "Błąd adresu email");
                    Debug.WriteLine("Error: Email address corrupt");
                    return;
                }
                //
                list.Add(con_act);

                // dodanie akcji do bazy danych
                var db = new JTTTDBContext();
                db.IfThatActions.Add(con_act);
                db.SaveChanges();

                updateList();
            }
            else if (sprawdzPogode1.Visible && comboBoxTHEN.Text == "Wyświetl w przeglądarce")
            {
                var checker = new CheckTemp(sprawdzPogode1.City, sprawdzPogode1.Temp);
                var show    = new ShowOnBrowser();

                var con_act = new IfThenActions(checker, show, textBoxName.Text);

                //
                list.Add(con_act);

                // dodanie akcji do bazy danych
                var db = new JTTTDBContext();
                db.IfThatActions.Add(con_act);
                db.SaveChanges();

                updateList();
            }
            else
            {
                MessageBox.Show("Nie wybrano akcji lub warunku.", "Błąd", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }