Problem with adding appointments to Outlookcalendar

Nov 30, 2009 at 8:07 PM

Hi there,

I'm very happy that I found your project:) It is excactly what I am looking for. I need an Outlookstyle scheduler for a website, that I am building. I have a few problems getting appointments in the Scheduler. I have an eventhandler in which I am trying to add appointments to my Scheduler. What am I doing wrong??

   private void Button_Click(object sender, RoutedEventArgs e)
        {
            myCalendar.CurrentDateView = SLControlLibrary.Resources.Controls.Calendar.OutlookCalendar.Common.Enumerations.DateView.FullWeek;

            Appointment appointment = new Appointment();
            appointment.Desc = "Massage";
            appointment.EndDate = DateTime.Now.Date;
            appointment.EndTime = new TimeSpan(16, 0, 0);
            appointment.StartDate = new DateTime(2009, 11, 23, 15, 30, 0);
            appointment.StartTime = new TimeSpan(15, 30, 0);
            SolidColorBrush brush = new SolidColorBrush(Colors.Red);
            appointment.Value = new AppointmentValue(1, SLControlLibrary.Resources.Controls.Calendar.OutlookCalendar.Common.Enumerations.AppointmentValueOptions.Normal, brush);
            myCalendar.Appointments.Add(appointment);

            MessageBox.Show(string.Format("Appointment added!\nNow there is {0} appointments in calendar!", myCalendar.Appointments.Count));
        }

 

<font size="2">

Best Regards

</font>

 

Coordinator
Nov 30, 2009 at 9:14 PM

I am glad that you like the control.  Unfortunely there is not a mechanism that will allow you add appointments externally as of yet.  You have to use the interface to invoke the interal events that create a new appointment.  If you double click on any of the day items this will popup an empty appointment which will allow you to create it and save it to the local xml file that holds all of the appointments.  I did find a bug while researching this for you.  You need to modify ucEditAppointment in the following way.  There is an "if" statement that checks to see if the CurrentAppointment.ID > 0 and the updates the UI accordingly to the right appointment; however, there needs to be an "else" statement that sets the CurrentAppointment.IsNewAppointment boolean to true.

if (CurrentAppointment.ID > 0)
{
      int index = 0;
      foreach (AppointmentValue _Value in Provider.AppointmentValueList)
      {
              if (_Value.ID == CurrentAppointment.Value.ID)
                      break;

              index++;
       }

       cboImportance.SelectedIndex = index;
}
else
       CurrentAppointment.IsNewAppointment = true;

This will allow for new appointments to be created on the fly.  I havent had much time to work on the Calendar lately; however, I can try and add some functionality to give you the ability to insert appointments on the fly like you were wanting to do.  If you would like to attempt it, all you would have to do is tie in a new event handler in the ucCalendar class like the Content_AddAppointment_Clicked and the Appointment_Submited events and it should work.

Thanks again for the interest in the control and let me know if there is anything else I can help with,

Dixxieonmymind

Nov 30, 2009 at 10:30 PM
Edited Nov 30, 2009 at 10:32 PM
Hi - thanks for the swift response:)
 
I can't seem to get any appointments into the calendar at all. The xDoc var is null in the SaveXML method´- am I missing something--?. I will look into that tomorrow.
 
dotPer
Coordinator
Dec 1, 2009 at 1:43 PM

Without knowing exactly how you have your application configured this will be a little challenging to debug.  In the demo application that I have on Codeplex there is a SLControllibrary.Demo that host the control library.  This demo project creates a .xap file that is then pushed to a "ASP.Net" application's ClientBin folder.  In this ClientBin folder there needs to be an AppointmentOptions.xml file which is where all the appointment information is stored.  If you want the application to run as I have created then there also needs to be a webservice or handler in the ASP.Net application as well called "FileUpload" that handles the saving of the file.  If you look at the structure of the application from the one I have created here on CodePlex then you should see what I am talking about.  Let me know if I can help any further, or my explination was not clear.

Thanks,

Dixxieonmymind

Dec 15, 2009 at 9:15 PM
Hey,
 
Thanks for the quick response. (And sorry for mine VERY slow one;-)).
An idea is maybe to derive interfaces from AppointmentProvider and OptionsDataProvider. Then it would be simple to make your own one implementation.
 
Thanks for a great product.
 
Happy holidays
Per

2009/11/30 dotper <notifications@codeplex.com>

From: dotper

Hi there,

I'm very happy that I found your project:) It is excactly what I am looking for. I need an Outlookstyle scheduler for a website, that I am building. I have a few problems getting appointments in the Scheduler. I have an eventhandler in which I am trying to add appointments to my Scheduler. What am I doing wrong??

   private void Button_Click(object sender, RoutedEventArgs e)
        {
            myCalendar.CurrentDateView = SLControlLibrary.Resources.Controls.Calendar.OutlookCalendar.Common.Enumerations.DateView.FullWeek;

            Appointment appointment = new Appointment();
            appointment.Desc = "Massage";
            appointment.EndDate = DateTime.Now.Date;
            appointment.EndTime = new TimeSpan(16, 0, 0);
            appointment.StartDate = new DateTime(2009, 11, 23, 15, 30, 0);
            appointment.StartTime = new TimeSpan(15, 30, 0);
            SolidColorBrush brush = new SolidColorBrush(Colors.Red);
            appointment.Value = new AppointmentValue(1, SLControlLibrary.Resources.Controls.Calendar.OutlookCalendar.Common.Enumerations.AppointmentValueOptions.Normal, brush);
            myCalendar.Appointments.Add(appointment);

            MessageBox.Show(string.Format("Appointment added!\nNow there is {0} appointments in calendar!", myCalendar.Appointments.Count));
        }

 

<font size="2">

Best Regards

</font>

 

Read the full discussion online.

To add a post to this discussion, reply to this email (SLCalendarControl@discussions.codeplex.com)

To start a new discussion for this project, email SLCalendarControl@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com




--
Med venlig hilsen
Per Lund

Feb 24, 2010 at 11:31 PM

This a great control, you must have spent quite a while working on it. I'm particularly interested in the Outlook Calendar, am trying to modify it to get it to

1- Modify an existing appointment

2- Delete an existing appointment

Which the current version doesn't let you do. It would make it easier to work with if the Outlook part was isolated , there so much code to go through right now.

Coordinator
Feb 25, 2010 at 6:58 PM

Thanks for the great comments.  I have put a lot of effort into this control library and have since taken it to the next level.  I have decoupled a lot of the projects and have made them as independent of each other as I can.  I removed the ability to modify/delete an existing appointment while I was working on getting some of the other features to work; however, I have added back the abilities but have not released another version on codeplex.  I have added some more controls to the library as well.  I have a live working demo of the entire control library at http://www.xxdisclaimerxx.info/demo.  This is where I will display all of my controls from now on.  I do not know if I will release anymore projects on codeplex for a while.  I will continue to try and help as much as I can on specific issues.  Just let me know how I can help.