How to generate an event every time an appointment is starting without opening a reminder alarm window

8 posts, 0 answers
  1. Rafael
    Rafael avatar
    10 posts
    Member since:
    Dec 2015

    Posted 17 Jan Link to this post

    Hi I am wraiting an application where I need to do something at the begining of every appointment using the radscheduler.

    How can I have an event every time that an appointment is starting without opening the alarm window of the radremainder?

     Thanks for the help

     

  2. Dess
    Admin
    Dess avatar
    1609 posts

    Posted 18 Jan Link to this post

    Hello Rafael,

    Thank you for writing.

    You can use the RadSchedulerReminder.AlarmFormShowing event to detect when the alarm window is opened and set its Opacity to 0​ in order to prevent displaying it and perform the desired action.
    RadSchedulerReminder schedulerReminder = new RadSchedulerReminder();
     
    public Form1()
    {
        InitializeComponent();
     
        schedulerReminder.AlarmFormShowing+=schedulerReminder_AlarmFormShowing;
     
        schedulerReminder.AssociatedScheduler = this.radScheduler1;
        schedulerReminder.StartReminderInterval = System.DateTime.Now;
        schedulerReminder.EndReminderInterval = System.DateTime.Now.AddDays(1);
     
        DateTime dtStart = DateTime.Now.AddMinutes(1);
        DateTime dtEnd = dtStart.AddHours(1);
        Appointment appointment = new  Appointment();
        appointment.Start = dtStart;
        appointment.End = dtEnd;
        appointment.Summary = "Appointment description";
        this.radScheduler1.Appointments.Add(appointment);
        appointment.Reminder = TimeSpan.FromSeconds(55);
     
     
        Appointment recurringAppointment = new Appointment();
        recurringAppointment.Start = dtStart.AddDays(-1);
        recurringAppointment.Duration = TimeSpan.FromHours(3);
        recurringAppointment.Summary = "Recurring Appointment";
     
        this.radScheduler1.Appointments.Add(recurringAppointment);
        recurringAppointment.RecurrenceRule = new HourlyRecurrenceRule(System.DateTime.Now.AddDays(-1), 2, 20);
        recurringAppointment.Reminder = TimeSpan.FromSeconds(55);
     
        schedulerReminder.StartReminder();
    }
     
    private void schedulerReminder_AlarmFormShowing(object sender, RadAlarmFormShowingEventArgs e)
    {
        ((RadAlarmForm)e.AlarmForm).Opacity = 0;
    }

    I hope this information helps. Should you have further questions I would be glad to help.
     
    Regards,
    Dess
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Rafael
    Rafael avatar
    10 posts
    Member since:
    Dec 2015

    Posted 18 Jan in reply to Dess Link to this post

    Hi Dess,

    thanks for your help. I am writing the application in VB. I am getting an error saying that opacity Is not a member of 'Telerik.WinControls.UI.IAlarmForm'

    Please advice 

     

  5. Dess
    Admin
    Dess avatar
    1609 posts

    Posted 18 Jan Link to this post

    Hello Rafael,

    Thank you for writing back. 

    It is necessary to cast the RadAlarmFormShowingEventArgs.AlarmForm property to RadAlarmForm, not IAlarmForm in order to access the Opacity property. Here is the code in VB.NET: 
    Private schedulerReminder As New RadSchedulerReminder()
     
    Public Sub New()
        InitializeComponent()
     
        AddHandler schedulerReminder.AlarmFormShowing, AddressOf schedulerReminder_AlarmFormShowing
     
        schedulerReminder.AssociatedScheduler = Me.RadScheduler1
        schedulerReminder.StartReminderInterval = System.DateTime.Now
        schedulerReminder.EndReminderInterval = System.DateTime.Now.AddDays(1)
        Dim dtStart As DateTime = DateTime.Now.AddMinutes(1)
        Dim dtEnd As DateTime = dtStart.AddHours(1)
        Dim appointment As New Appointment()
        appointment.Start = dtStart
        appointment.[End] = dtEnd
        appointment.Summary = "Appointment description"
        Me.RadScheduler1.Appointments.Add(appointment)
        appointment.Reminder = TimeSpan.FromSeconds(55)
        Dim recurringAppointment As New Appointment()
        recurringAppointment.Start = dtStart.AddDays(-1)
        recurringAppointment.Duration = TimeSpan.FromHours(3)
        recurringAppointment.Summary = "Recurring Appointment"
        Me.RadScheduler1.Appointments.Add(recurringAppointment)
        recurringAppointment.RecurrenceRule = New HourlyRecurrenceRule(System.DateTime.Now.AddDays(-1), 2, 20)
        recurringAppointment.Reminder = TimeSpan.FromSeconds(55)
        schedulerReminder.StartReminder()
    End Sub
     
    Private Sub schedulerReminder_AlarmFormShowing(sender As Object, e As RadAlarmFormShowingEventArgs)
        DirectCast(e.AlarmForm, RadAlarmForm).Opacity = 0
        Console.WriteLine("alarm window is shown")
    End Sub
     
    I hope this information helps. If you have any additional questions, please let me know.

    Regards,
    Dess
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  6. Rafael
    Rafael avatar
    10 posts
    Member since:
    Dec 2015

    Posted 19 Jan in reply to Dess Link to this post

    Hi Dess I got it working, but I have a question. If I put a break point on the event were we set the opacity to 0, the event gets fired a lot of times even before the remainder takes place. Do you know why? How can I distinguish from a real remainder event? How can I get for example the appointment data?

     

    Thanks for your help

  7. Dess
    Admin
    Dess avatar
    1609 posts

    Posted 20 Jan Link to this post

    Hello Rafael,

    Thank you for writing back. 
     
    The RadSchedulerReminder.AlarmFormShowing event is fired before the notification form is shown. RadAlarmFormShowingEventArgs are passed as a parameter of the event. You can use this event to replace the default notification form. Could you please specify in which situation the AlarmFormShowing event is shown before the reminder takes place? A sample project demonstrating the exact scenario would be greatly appreciated. Thank you in advance.

    As to the question about getting the exact appointment, you can't get it directly. You can get only the RadSchedulerReminder which is the sender in AlarmFormShowing event.

    I am looking forward to your reply. 

    Regards,
    Dess
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  8. Rafael
    Rafael avatar
    10 posts
    Member since:
    Dec 2015

    Posted 20 Jan Link to this post

    Hi Dess,

     

    What I found out yesterday is that the AlarmFormShow envent is fiered every minute more or less, I guess de 60000milliseconds that are setup in the control. I guess that the routine that actualy shows the form does the aditional checkings to see if the form should be dispplayed or not.

    Also I found out that if I changed the dissmis property of the remind object the event is fired again.

    Also noticed that using the opacity property does not prevent the form from oppening, the form is just not visible. I will be looking a bit dipper on how to setup a custom alarm form, meybe that would clear more the situation for me. If you have more Information on how to set up the custom alarm form I will apreciate it. 

    Best Regards,

     

    Rafael

     

     

     

     

  9. Dess
    Admin
    Dess avatar
    1609 posts

    Posted 25 Jan Link to this post

    Hello Rafael,

    Thank you for writing back. 

    Note that the reminder's interval is necessary to specify the time interval in which RadSchedulerReminder will check for upcoming appointments. It internally uses a timer. Hence, you can obtain some delay in notifying if the reminder's timer is not ticking at the moment. When you press the Dismiss button, the currently selected reminder object is dismissed. However, for the rest of them, you should obtain a notification.

    Indeed, setting the opacity property just visually hides the RadAlarmForm. If you need to create a custom form, it is necessary to create a derivative of RadForm that implements IAlarmForm interface. You can download our source code and investigate the current implementation of RadAlarmForm. The following help article demonstrates how to download the product files: http://docs.telerik.com/devtools/winforms/installation,-deployment-and-distribution/download-product-files

    I hope this information helps. If you have any additional questions, please let me know.

    Regards,
    Dess
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top
UI for WinForms is Visual Studio 2017 Ready