Ejemplo n.º 1
0
        // Reloads the templates and sets the index to the first item.
        private void reloadTemplateList()
        {
            templateRichTextBox.Text = "";
            templateSelectorComboBox.Items.Clear();

            Template blank = new Template
            {
                Subject = "",
                Message = ""
            };

            templateSelectorComboBox.Items.Add(blank);

            if (!TemplateDB.Load(ref templates))
            {
                MessageBox.Show("Unable to retrieve templates from the database. Now closing program.", "Error!");
                Close();
            }

            foreach (Template template in templates)
            {
                templateSelectorComboBox.Items.Add(template);
            }

            templateSelectorComboBox.SelectedIndex = 0;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initialize and load items of templateComboBox.
        /// </summary>
        private void InitializeTemplateComboBox()
        {
            // set the default option to be "None"
            templateComboBox.Items.Clear();
            templateComboBox.Items.Add(NoneOption);
            templateComboBox.SelectedIndex = 0;

            // load templates
            if (TemplateDB.Load(ref templates))
            {
                templateComboBox.Items.AddRange(templates.ToArray());
            }
            else
            {
                ShowErrorMessageBox(DatabaseError, "Loading templates failed!");
            }
        }
Ejemplo n.º 3
0
        // Loads the templateCreator, adds all of the tags to the tag combo box from the db.
        private void templateCreator_Load(object sender, EventArgs e)
        {
            //this.MinimumSize = new Size(this.Width, this.Height);
            //this.MaximumSize = new Size(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);

            //this.AutoSize = true;
            //this.AutoSizeMode = AutoSizeMode.GrowAndShrink;

            templateSelectorComboBox.DropDownStyle = ComboBoxStyle.DropDownList;
            customTagComboBox.DropDownStyle        = ComboBoxStyle.DropDownList;

            TemplateDB.Load(ref templates);
            TagDB.Load(ref tags);

            foreach (Tag myTag in tags)
            {
                customTagComboBox.Items.Add(myTag.Name);
            }

            reloadTemplateList();
        }