5 Answers, 1 is accepted
0
Hello Rafael,
Thank you for writing.
You can extract the RadReminderBindableObject by the RadGridView that is shown on the form. Here is a sample code snippet:
I hope this information helps. Should you have further questions I would be glad to help.
Regards,
Dess
Telerik by Progress
Thank you for writing.
You can extract the RadReminderBindableObject by the RadGridView that is shown on the form. Here is a sample code snippet:
this.radSchedulerReminder1.AlarmFormShowing += radSchedulerReminder1_AlarmFormShowing;this.radSchedulerReminder1.AssociatedScheduler = this.radScheduler1;this.radSchedulerReminder1.StartReminderInterval = DateTime.Now.AddDays(-1);this.radSchedulerReminder1.EndReminderInterval = DateTime.Now.AddDays(1);this.radSchedulerReminder1.TimeInterval = 5000;this.radScheduler1.Appointments.Add(new Appointment(DateTime.Now.AddMinutes(20),TimeSpan.FromMinutes(45),"Meeting A"));((Appointment)this.radScheduler1.Appointments[0]).Reminder = TimeSpan.FromMinutes(20);this.radScheduler1.Appointments.Add(new Appointment(DateTime.Now.AddMinutes(20),TimeSpan.FromMinutes(45),"Meeting B"));((Appointment)this.radScheduler1.Appointments[1]).Reminder = TimeSpan.FromMinutes(20);this.radSchedulerReminder1.StartReminder();private void radSchedulerReminder1_AlarmFormShowing(object sender, RadAlarmFormShowingEventArgs e){ RadAlarmForm f = e.AlarmForm as RadAlarmForm; if (f != null) { f.Shown -= f_Shown; f.Shown += f_Shown; }}private void f_Shown(object sender, EventArgs e){ RadAlarmForm f = sender as RadAlarmForm; if (f != null) { BindingList<RadReminderBindableObject> reminderBindableObjects; RadGridView grid = f.Controls["radGridViewEvents"] as RadGridView; reminderBindableObjects = grid.DataSource as BindingList<RadReminderBindableObject>; Console.WriteLine(reminderBindableObjects.Count); }}I hope this information helps. Should you have further questions I would be glad to help.
Regards,
Dess
Telerik by Progress
Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this blog post and share your thoughts.
0
Rafael
Top achievements
Rank 1
answered on 11 Jul 2016, 05:21 PM
Hi Tess Could you please explain what the instructions
f.Shown -= f_Shown;
f.Shown += f_Shown;
are doing or if you could post the sipnet in VB.
Thanks,
Rafael
0
Hello Rafael,
Thank you for writing back.
The purpose of the referred code snippet is to have only one subscription to the RadAlarmForm.Shown event because the AlarmFormShowing event is supposed to be fired more than once. Here is the relevant code in VB.NET:
Feel free to use the online code converter in future to convert C# to VB.NET and vice versa: http://converter.telerik.com/
I hope this information helps. If you have any additional questions, please let me know.
Regards,
Dess
Telerik by Progress
Thank you for writing back.
The purpose of the referred code snippet is to have only one subscription to the RadAlarmForm.Shown event because the AlarmFormShowing event is supposed to be fired more than once. Here is the relevant code in VB.NET:
Public Sub New() InitializeComponent() AddHandler Me.RadSchedulerReminder1.AlarmFormShowing, AddressOf radSchedulerReminder1_AlarmFormShowing Me.RadSchedulerReminder1.AssociatedScheduler = Me.RadScheduler1 Me.RadSchedulerReminder1.StartReminderInterval = DateTime.Now.AddDays(-1) Me.RadSchedulerReminder1.EndReminderInterval = DateTime.Now.AddDays(1) Me.RadSchedulerReminder1.TimeInterval = 5000 Me.RadScheduler1.Appointments.Add(New Appointment(DateTime.Now.AddMinutes(20), TimeSpan.FromMinutes(45), "Meeting A")) DirectCast(Me.RadScheduler1.Appointments(0), Appointment).Reminder = TimeSpan.FromMinutes(20) Me.RadSchedulerReminder1.StartReminder()End SubPrivate Sub radSchedulerReminder1_AlarmFormShowing(sender As Object, e As RadAlarmFormShowingEventArgs) Dim f As RadAlarmForm = TryCast(e.AlarmForm, RadAlarmForm) If f IsNot Nothing Then Console.WriteLine("alarm") RemoveHandler f.Shown, AddressOf f_Shown AddHandler f.Shown, AddressOf f_Shown End IfEnd SubPrivate Sub f_Shown(sender As Object, e As EventArgs) Dim f As RadAlarmForm = TryCast(sender, RadAlarmForm) If f IsNot Nothing Then Dim reminderBindableObjects As BindingList(Of RadReminderBindableObject) Dim grid As RadGridView = TryCast(f.Controls("radGridViewEvents"), RadGridView) reminderBindableObjects = TryCast(grid.DataSource, BindingList(Of RadReminderBindableObject)) Console.WriteLine(reminderBindableObjects.Count) End IfEnd SubFeel free to use the online code converter in future to convert C# to VB.NET and vice versa: http://converter.telerik.com/
I hope this information helps. If you have any additional questions, please let me know.
Regards,
Dess
Telerik by Progress
Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this blog post and share your thoughts.
0
Rafael
Top achievements
Rank 1
answered on 13 Jul 2016, 04:28 PM
Hi Dess,
I run the snippet you post and it works but I seeing that the f_Shown rutine only executes on the first appointment reminder that I set. On the second one the standard alarm form shows up but without executing the f_Shown code. Do you have an idea why is this?
0
Hello Rafael,
Thank you for writing back.
The RadAlarmForm.Shown event occurs whenever the form is first displayed. The Shown event is only raised the first time a form is displayed; subsequently minimizing, maximizing, restoring, hiding, showing, or invalidating and repainting will not raise this event. Feel free to use the Form.VisibleChanged event which si fired each time the form is displayed or hidden:
I hope this information helps. If you have any additional questions, please let me know.
Regards,
Dess
Telerik by Progress
Thank you for writing back.
The RadAlarmForm.Shown event occurs whenever the form is first displayed. The Shown event is only raised the first time a form is displayed; subsequently minimizing, maximizing, restoring, hiding, showing, or invalidating and repainting will not raise this event. Feel free to use the Form.VisibleChanged event which si fired each time the form is displayed or hidden:
Private Sub radSchedulerReminder1_AlarmFormShowing(sender As Object, e As RadAlarmFormShowingEventArgs) Dim f As RadAlarmForm = TryCast(e.AlarmForm, RadAlarmForm) If f IsNot Nothing Then Console.WriteLine("alarm") RemoveHandler f.VisibleChanged, AddressOf f_VisibleChanged AddHandler f.VisibleChanged, AddressOf f_VisibleChanged End IfEnd SubPrivate Sub f_VisibleChanged(sender As Object, e As EventArgs) Dim f As RadAlarmForm = TryCast(sender, RadAlarmForm) If f IsNot Nothing Then Dim reminderBindableObjects As BindingList(Of RadReminderBindableObject) Dim grid As RadGridView = TryCast(f.Controls("radGridViewEvents"), RadGridView) reminderBindableObjects = TryCast(grid.DataSource, BindingList(Of RadReminderBindableObject)) Console.WriteLine(reminderBindableObjects.Count) End IfEnd SubI hope this information helps. If you have any additional questions, please let me know.
Regards,
Dess
Telerik by Progress
Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this blog post and share your thoughts.
