Exemple #1
0
        //ADD PLANTS
        private void lbl_add_Click(object sender, EventArgs e)
        {
            this.Panel_content.Controls.Clear();
            this.lbl_currentTab.Text = "Add plants";
            string username = lbl_username.Text;

            PlantaDisplay dis = new PlantaDisplay();

            this.Panel_content.Controls.Add(dis.AddPlant(username, combobox));

            Button btn_confirm = new Button();

            btn_confirm.Click += new EventHandler(btn_confirm_Clicked);
            this.Panel_content.Controls.Add(dis.showConfirmButton(btn_confirm));

            Label lbl_addBoxTitle = new Label();

            this.Panel_content.Controls.Add(dis.showBoxTitle(lbl_addBoxTitle));

            Label lbl_NicknameTitle = new Label();

            this.Panel_content.Controls.Add(dis.showNicknameTitle(lbl_NicknameTitle));

            this.Panel_content.Controls.Add(dis.showNicknameBox(txt_nickname));
        }
Exemple #2
0
        private void btn_change_Clicked(object sender, EventArgs e)
        {
            PlantaDatabase db = new PlantaDatabase();



            string plantnickname = combobox.Text;
            string username      = lbl_username.Text;
            string waterInterval = input_interval.Text;

            try
            {
                db.ChangeUserPlant(plantnickname, username, waterInterval);
            }

            catch (Exception exp)
            {
                MessageBox.Show(exp.Message, "An error has occured (?°?°)?? ???", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            MessageBox.Show("Plant has been changed!");
            combobox.DataSource = null;
            PlantaDisplay dis = new PlantaDisplay();

            this.Panel_content.Controls.Add(dis.DeletePlant(username, combobox));
        }
Exemple #3
0
        private void lbl_ranks_Click(object sender, EventArgs e)
        {
            Panel_content.Controls.Clear();
            this.lbl_currentTab.Text = "Journal";
            string filename = lbl_username.Text + ".txt";

            Panel_content.Controls.Add(PlantaDisplay.ShowJournal(filename));
        }
Exemple #4
0
        private void lbl_about_Click(object sender, EventArgs e)
        {
            this.Panel_content.Controls.Clear();
            this.lbl_currentTab.Text = "About";
            PlantaDisplay display = new PlantaDisplay();

            this.Panel_content.Controls.Add(display.AboutPlantNation());
            this.Panel_content.Location = new System.Drawing.Point(200, 150);
        }
Exemple #5
0
        private void lbl_delete_Click(object sender, EventArgs e)
        {
            this.Panel_content.Controls.Clear();
            this.lbl_currentTab.Text = "Delete plant";
            string username = lbl_username.Text;

            PlantaDisplay dis = new PlantaDisplay();

            this.Panel_content.Controls.Add(dis.DeletePlant(username, combobox));

            Label lbl_addBoxTitle = new Label();

            this.Panel_content.Controls.Add(dis.showBoxTitle(lbl_addBoxTitle));

            Button btn_delete = new Button();

            btn_delete.Location = new Point(300, 300);
            btn_delete.Click   += new EventHandler(btn_delete_Clicked);
            this.Panel_content.Controls.Add(dis.showConfirmButton(btn_delete));
        }
Exemple #6
0
        private void lbl_change_Click_1(object sender, EventArgs e)
        {
            this.Panel_content.Controls.Clear();
            this.lbl_currentTab.Text = "Change a Plant";
            string username = lbl_username.Text;

            Label intervalbl = new Label();

            intervalbl.Location = new Point(25, 150);
            intervalbl.Text     = "New interval (days):";

            this.Panel_content.Controls.Add(intervalbl);
            this.Panel_content.Controls.Add(input_interval);

            input_interval.Visible = true;

            input_interval.Location = new Point(200, 150);

            string new_interval = input_interval.Text;


            PlantaDisplay dis = new PlantaDisplay();

            this.Panel_content.Controls.Add(dis.ChangePlant(username, combobox));

            Label lbl_addBoxTitle = new Label();

            this.Panel_content.Controls.Add(dis.showBoxTitle(lbl_addBoxTitle));

            Button btn_change = new Button();

            btn_change.Text     = "Make Changes";
            btn_change.Click   += new EventHandler(btn_change_Clicked);
            btn_change.Location = new Point(100, 200);
            this.Panel_content.Controls.Add(dis.showConfirmButton(btn_change));
        }
Exemple #7
0
 private void lbl_journal_Click(object sender, EventArgs e)
 {
     Panel_content.Controls.Clear();
     lbl_currentTab.Text = "Ranks";
     Panel_content.Controls.Add(PlantaDisplay.ShowRanks());
 }
Exemple #8
0
        private void showDashboard()
        {
            this.Panel_content.Controls.Clear();
            this.lbl_currentTab.Text = "Dashboard";
            string        fileName = lbl_username.Text;
            PlantaDisplay ui       = new PlantaDisplay();


            PlantaLibrary.UserDashboard lib = ui.showDashboard(fileName);

            List <int>    waterEmergency = lib.GetWaterEmergency();
            List <int>    waterToday     = lib.GetWaterToday();
            List <string> plantNick      = lib.GetNick();
            GroupBox      groupbox1      = new GroupBox();
            GroupBox      groupbox2      = new GroupBox();
            GroupBox      groupbox3      = new GroupBox();

            groupbox1.Location = new Point(10, 10);
            groupbox2.Location = new Point(10, 80);
            groupbox3.Location = new Point(10, 160);

            groupbox1.Size = new Size(600, 100);
            groupbox2.Size = new Size(600, 120);
            groupbox3.Size = new Size(600, 140);



            Label labelPlant1 = new Label();
            Label labelPlant2 = new Label();
            Label labelPlant3 = new Label();

            labelPlant1.Location = new Point(105, 45);
            labelPlant2.Location = new Point(105, 45);
            labelPlant3.Location = new Point(105, 45);
            labelPlant1.Font     = new Font("Segou UI Emoji", 14);
            labelPlant2.Font     = new Font("Segou UI Emoji", 14);
            labelPlant3.Font     = new Font("Segou UI Emoji", 14);
            PictureBox picBox1 = new PictureBox();
            PictureBox picBox2 = new PictureBox();
            PictureBox picBox3 = new PictureBox();

            picBox1.Location = new Point(5, 10);
            picBox2.Location = new Point(5, 10);
            picBox3.Location = new Point(5, 10);
            picBox1.SizeMode = PictureBoxSizeMode.StretchImage;
            picBox2.SizeMode = PictureBoxSizeMode.StretchImage;
            picBox3.SizeMode = PictureBoxSizeMode.StretchImage;
            picBox1.Height   = 80;
            picBox1.Width    = 80;
            picBox2.Height   = 80;
            picBox2.Width    = 80;
            picBox3.Height   = 80;
            picBox3.Width    = 80;
            Button button1 = new Button();
            Button button2 = new Button();
            Button button3 = new Button();

            button1.Location  = new Point(430, 27);
            button2.Location  = new Point(430, 43);
            button3.Location  = new Point(430, 43);
            button1.Text      = "Water me";
            button2.Text      = "Water me";
            button3.Text      = "Water me";
            button1.Size      = new Size(100, 50);
            button2.Size      = new Size(100, 50);
            button3.Size      = new Size(100, 50);
            button1.BackColor = Color.LightSkyBlue;
            button2.BackColor = Color.LightSkyBlue;
            button3.BackColor = Color.LightSkyBlue;
            button1.Click    += new EventHandler(button1_Clicked);
            button2.Click    += new EventHandler(button2_Clicked);
            button3.Click    += new EventHandler(button3_Clicked);
            int  boxLimit = 0;
            int  count    = 0;
            bool isEmpty  = !waterEmergency.Any();

            if (!isEmpty)
            {
                for (int i = 0; i < plantNick.Count; i++)
                {
                    if (waterEmergency[count] == i && count < 1)
                    {
                        labelPlant1.Text = plantNick[i];
                        groupbox1.Controls.Add(labelPlant1);
                        picBox1.Image = Properties.Resources.Sprout;
                        groupbox1.Controls.Add(picBox1);
                        groupbox1.Controls.Add(button1);
                        groupboxIndex1 = plantNick[i];
                        count++;
                    }
                }
            }

            count   = 0;
            isEmpty = !waterToday.Any();
            if (!isEmpty)
            {
                for (int i = 0; i < plantNick.Count; i++)
                {
                    if (waterToday[count] == i && boxLimit < 1)
                    {
                        labelPlant2.Text = plantNick[i];
                        groupbox2.Controls.Add(labelPlant2);
                        picBox2.Image = Properties.Resources.Plant_rank;
                        groupbox2.Controls.Add(picBox2);
                        groupbox2.Controls.Add(button2);
                        groupboxIndex2 = plantNick[i];
                        boxLimit++;
                        continue;
                    }
                    if (waterToday[count] == i && boxLimit < 1)
                    {
                        labelPlant3.Text = plantNick[i];
                        groupbox3.Controls.Add(labelPlant3);
                        picBox3.Image = Properties.Resources.Seed_rank;
                        groupbox3.Controls.Add(picBox3);
                        groupbox3.Controls.Add(button3);
                        groupboxIndex3 = plantNick[i];
                        boxLimit++;
                        continue;
                    }
                }
            }


            this.Panel_content.Controls.Add(groupbox1);
            this.Panel_content.Controls.Add(groupbox2);
            this.Panel_content.Controls.Add(groupbox3);
        }