示例#1
0
        private void btn_add_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(tbKeyNoteText.Text))
            {
                //TaskDialog.Show("Keynote", "Category Code cannot be empty");
                MessageBox.Show("Keynote cannot be empty");
            }
            else
            {
                this.KeyNoteText = tbKeyNoteText.Text;
                if (tbSpecSection.Text != "")
                {
                    //Spec
                    this.SpecSection = tbSpecSection.Text;
                    this.FullKeyText = this.KeyNoteText + "-" + this.SpecSection;
                }
                else
                {
                    this.FullKeyText = this.KeyNoteText;
                }
                this.Key = this.ParentKey + "." + this.keyEnd.ToString("D2");

                KeynoteEntry newKey = new KeynoteEntry(this.Key, this.ParentKey, this.FullKeyText);
                this.FullKey = newKey;

                Command.keynotes.Add(new KeyNote(newKey));
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
        }
示例#2
0
        //public bool IsACategory { get; set; }

        public KeyNote(KeynoteEntry key)
        {
            this.Key       = key.Key;
            this.ParentKey = key.ParentKey;
            KeyEndExtraction(this.Key);
            KeyNoteTextExtraction(key.KeynoteText);
        }
示例#3
0
        private void ShowAddForm(int lastNote)
        {
            addDialog = new AddNote(comboBox1.SelectedValue.ToString(), lastNote);
            var result = addDialog.ShowDialog();

            if (result == DialogResult.OK)
            {
                KeynoteEntry addedKey = addDialog.FullKey;
                myKeyNoteList.Add(new KeyNote(addedKey));
            }
        }
示例#4
0
        private void btn_add_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(tbCategoryText.Text))
            {
                //TaskDialog.Show("Keynote", "Category Code cannot be empty");
                MessageBox.Show("Category cannot be empty");
            }
            else
            {
                if (string.IsNullOrWhiteSpace(tbCategoryCode.Text))
                {
                    //TaskDialog.Show("Keynote", "Category Code cannot be empty");
                    MessageBox.Show("Category Code cannot be empty");
                }
                else
                {
                    bool catCodeExists = false;
                    foreach (Category c in Command.categories)
                    {
                        if (c.Key == tbCategoryCode.Text)
                        {
                            catCodeExists = true;
                        }
                    }
                    if (catCodeExists == false)
                    {
                        this.KeynoteCategory = tbCategoryText.Text;
                        this.CategoryCode    = tbCategoryCode.Text;

                        KeynoteEntry newCategory = new KeynoteEntry(this.CategoryCode, this.KeynoteCategory);
                        Command.categories.Add(new Category(newCategory));

                        this.DialogResult = DialogResult.OK;
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("Category Code is already in use. \n Please chose a unique Category Code.");
                    }
                }
            }
        }
示例#5
0
 public Category(KeynoteEntry key)
 {
     this.Key           = key.Key;
     this.CategoryTitle = key.KeynoteText;
 }