Beispiel #1
0
        private void button_Create_Click(object sender, EventArgs e)
        {
            label_Error.Text    = "";
            label_Error.Visible = false;

            if (string.IsNullOrWhiteSpace(textBox1.Text))
            {
                label_Error.Text    = "Title can't be empty!";
                label_Error.Visible = true;
                return;
            }
            if (string.IsNullOrWhiteSpace(textBox2.Text))
            {
                label_Error.Text    = "Text can't be empty!";
                label_Error.Visible = true;
                return;
            }



            bool   isItPrivate = false;
            string type        = "Home";

            if (this.Parent.Name == "panel_PrivateNotes")
            {
                isItPrivate = true;
                type        = "Private";
            }
            int homeID = 0;

            if (mainScreen.home != null)
            {
                homeID = mainScreen.home.ID;
            }

            NotePaper notePaper = new NotePaper(new Note(mainScreen.User.Name, textBox1.Text, textBox2.Text, type, dateTimePicker1.Value, homeID, mainScreen.User.ID));

            notePaper.EnableMenuStrip();
            mainScreen.CreateANote(notePaper, isItPrivate);
            ClearControls();

            this.Hide();
        }