Exemplo n.º 1
0
 private void btnSaveChanges_Click(object sender, EventArgs e)
 {
     changed = false;
     lName.Text.Trim();
     lName.Text = Program.p.ReplaceMultispaces(lName.Text);
     if (lDescription.Text == "" || lName.Text == "" || lName.Text == " " || lName.Text == "Название задания" || lDescription.Text == "Описание задания")
     {
         MessageBox.Show("Заполнены не все поля");
     }
     else if (!error)
     {
         string phenomenas = "";
         if (pnlPhenomenas.Controls.Count!=0)
         {
             foreach (PhenomenaItem phenomena in pnlPhenomenas.Controls)
             {
                 var p = phenomena.lPhenomena;
                 if (p.Checked) {
                     phenomenas += p.Text + " - ";
                 }
             }
             if (phenomenas == "")
             {
                 phenomenas = "No Phenomenas";
             }
             string currentModule = Program.p.currentModule._filename;
             NewTask newTask = new NewTask(lName.Text, lDescription.Text, pbTask.RectangleToScreen(pbTask.ClientRectangle), oldTaskName, currentModule, phenomenas);
             oldTaskName = lName.Text;
             pnlEdited.Visible = true;
             timer1.Enabled = true;
             btnSaveChanges.Enabled = false;
             btnSaveChanges.BackColor = Color.FromArgb(226, 226, 226);
         }
         else
         {
             string currentModule = Program.p.currentModule._filename;
             NewTask newTask = new NewTask(lName.Text, lDescription.Text, pbTask.RectangleToScreen(pbTask.ClientRectangle), oldTaskName, currentModule, phenomenas);
             oldTaskName = lName.Text;
             pnlEdited.Visible = true;
             timer1.Enabled = true;
             btnSaveChanges.Enabled = false;
             btnSaveChanges.BackColor = Color.FromArgb(226, 226, 226);
         }
     }
 }
Exemplo n.º 2
0
        private void btnAddTask_Click(object sender, EventArgs e)
        {
            changed = false;
            tbTaskName.Text.Trim();
            tbTaskName.Text = Program.p.ReplaceMultispaces(tbTaskName.Text);
            if (tbGiven.Text == "" || tbTaskName.Text == "" || tbTaskName.Text == " " || tbTaskName.Text == "Название задания" || tbGiven.Text == "Описание задания")
            {
                MessageBox.Show("Заполнены не все поля");
            }
            else
            {
                if (!error)
                {
                    string phenomenas = "";
                    foreach (var phenomena in pnlPhenomenas.Controls)
                    {
                        var p = (phenomena as PhenomenaItem).lPhenomena;
                        if (p.Checked) {
                            phenomenas += p.Text + " - ";
                            p.Checked = false;
                        }

                    }
                    if (phenomenas==null)
                    {
                        phenomenas = "No Phenomenas";
                    }
                    NewTask newTask = new NewTask(tbTaskName.Text, tbGiven.Text, pbImage.RectangleToScreen(pbImage.ClientRectangle),phenomenas);
                    pnlAdded.Visible = true;
                    timer1.Enabled = true;
                    tbGiven.Clear();
                    tbTaskName.Clear();
                    pbImage.Image = Properties.Resources.iconimage;
                    pbImage.SizeMode = PictureBoxSizeMode.CenterImage;
                    Program.p.currentTaskFilename = tbTaskName.Text;
                }
            }
        }