Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic creating my own Recurrence form (Read 2994 times)
ricardo
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 12
Joined: Mar 5th, 2013
creating my own Recurrence form
May 9th, 2013 at 4:02pm
Print Post  
Hi

I created my own recurrence form, but I have a problem with weekly intervals, the DaysOfWeek values is always None, can you check why my code is not working?
here is the code:

  recurrence.Pattern = RecurrencePattern.Weekly;
                    recurrence.Weeks = Convert.ToInt32(txtWeeks.Text);
                    recurrence.DaysOfWeek = DaysOfWeek.None;
                    if (radMonthlyDay01.IsChecked == true)
                    {
                        recurrence.DaysOfWeek = recurrence.DaysOfWeek | DaysOfWeek.Monday;
                    }
                    if (radMonthlyDay02.IsChecked == true)
                    {
                        recurrence.DaysOfWeek = recurrence.DaysOfWeek | DaysOfWeek.Tuesday;
                    }
                    if (radMonthlyDay03.IsChecked == true)
                    {
                        recurrence.DaysOfWeek = recurrence.DaysOfWeek | DaysOfWeek.Wednesday;
                    }
                    if (radMonthlyDay04.IsChecked == true)
                    {
                        recurrence.DaysOfWeek = recurrence.DaysOfWeek | DaysOfWeek.Thursday;
                    }
                    if (radMonthlyDay05.IsChecked == true)
                    {
                        recurrence.DaysOfWeek = recurrence.DaysOfWeek | DaysOfWeek.Friday;
                    }
                    if (radMonthlyDay06.IsChecked == true)
                    {
                        recurrence.DaysOfWeek = recurrence.DaysOfWeek | DaysOfWeek.Saturday;
                    }
                    if (radMonthlyDay07.IsChecked == true)
                    {
                        recurrence.DaysOfWeek = recurrence.DaysOfWeek | DaysOfWeek.Sunday;
                    }


is there any method to assign values individually accumulating them?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: creating my own Recurrence form
Reply #1 - May 9th, 2013 at 5:43pm
Print Post  
Hi,

I think the DaysOfWeek property setter doesn't let you assign the None value to it at all and just returns, are you sure it shows None? You will have to accumulate the bits in a separate enum DaysOfWeek variable, and assign the final result to the property. Otherwise any bits that were set in the previous property value will remain, and your code will just be adding new ones (so you might be seeing the All value actually?).

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint