示例#1
0
        /// <summary>
        /// Edit a recurrence rule
        /// </summary>
        /// <param name="sender">The sender of the event</param>
        /// <param name="e">The event parameters</param>
        private void btnEditRRule_Click(object sender, EventArgs e)
        {
            if(lbRRules.SelectedIndex == -1)
            {
                MessageBox.Show("Select a recurrence rule to edit");
                return;
            }

            using(RecurrencePropertiesDlg dlg = new RecurrencePropertiesDlg())
            {
                try
                {
                    Recurrence r = rRules[lbRRules.SelectedIndex].Recurrence;
                    dlg.SetRecurrence(r);

                    if(dlg.ShowDialog() == DialogResult.OK)
                    {
                        // Update the recurrence rule in the collection and the list box
                        dlg.GetRecurrence(r);
                        lbRRules.Items[lbRRules.SelectedIndex] = r.ToString();
                    }
                }
                catch(Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
            }
        }
示例#2
0
        /// <summary>
        /// Edit the recurrence pattern using the recurrence editor dialog box
        /// </summary>
        /// <param name="sender">The sender of the event</param>
        /// <param name="e">The event arguments</param>
        private void btnDesign_Click(object sender, EventArgs e)
        {
            using(RecurrencePropertiesDlg dlg = new RecurrencePropertiesDlg())
            {
                try
                {
                    Recurrence r = new Recurrence(txtRRULE.Text);
                    r.StartDateTime = dtpStartDate.Value;

                    dlg.SetRecurrence(r);

                    if(dlg.ShowDialog() == DialogResult.OK)
                    {
                        dlg.GetRecurrence(r);
                        txtRRULE.Text = r.ToString();
                    }
                }
                catch(Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
            }
        }
示例#3
0
        //=====================================================================

        /// <summary>
        /// Add a recurrence rule
        /// </summary>
        /// <param name="sender">The sender of the event</param>
        /// <param name="e">The event parameters</param>
        private void btnAddRRule_Click(object sender, EventArgs e)
        {
            using(RecurrencePropertiesDlg dlg = new RecurrencePropertiesDlg())
            {
                if(dlg.ShowDialog() == DialogResult.OK)
                {
                    // Add the recurrence rule to the collection and the list box using the appropriate type
                    if(!editsExceptions)
                    {
                        RRuleProperty rr = new RRuleProperty();
                        dlg.GetRecurrence(rr.Recurrence);
                        rRules.Add(rr);
                        lbRRules.Items.Add(rr.Recurrence.ToString());
                    }
                    else
                    {
                        ExRuleProperty er = new ExRuleProperty();
                        dlg.GetRecurrence(er.Recurrence);
                        rRules.Add(er);
                        lbRRules.Items.Add(er.Recurrence.ToString());
                    }
                }
            }

            this.SetButtonStates();
        }