Hi there,
I am using Telerik rad Scheduler Control only to display events meaning readonly and love the way to achieve this just setting property but issue with this control is performance so looking into ScheduleView control but there is no magic property like IsreadOnly anyway.
i need help how can i achieve same functionality where i want all events to be readonly and i am using WCF service to get data from sharepoint 2010 calendar.I have gone through resources from your site and did make me sense but don't know where it will in my case.
I am using Telerik rad Scheduler Control only to display events meaning readonly and love the way to achieve this just setting property but issue with this control is performance so looking into ScheduleView control but there is no magic property like IsreadOnly anyway.
i need help how can i achieve same functionality where i want all events to be readonly and i am using WCF service to get data from sharepoint 2010 calendar.I have gone through resources from your site and did make me sense but don't know where it will in my case.
ViewModel
public ObservableCollection<AppointmentViewModel> Appointments {
get;
private set;
}
public
MainViewModel(RadScheduleView _scheduler) {
if
(!DesignerProperties.IsInDesignTool) {
Scheduler = _scheduler;
var service =
new
PublicCalEventsServiceProxy();
// Events = new ObservableCollection<PublicCalEventViewModel>();
Appointments =
new
ObservableCollection<AppointmentViewModel>();
_service = service;
// _service.GetPublicCalEvents(HandleResult);
_service.GetPublicCalEventsbyUrl(HandleResult);
IsLoading =
true
;
}
}
//Callback from Service
private
void
HandleResult(ObservableCollection<PublicEvent> result, Exception ex) {
IsLoading =
false
;
Appointments.Clear();
if
(ex !=
null
) {
IsVisible = Visibility.Visible;
ErrorMessage = ex.Message;
return
;
}
if
(result ==
null
) {
return
;
}
foreach
(var publicCalEvent
in
result) {
AppointmentViewModel appoinment =
new
AppointmentViewModel(publicCalEvent);
Appointments.Add(appoinment)
}
}
AppointmentViewModel
Class
public
class
AppointmentViewModel : AppointmentBase {
public
AppointmentViewModel() {
}
public
AppointmentViewModel(PublicEvent appointment) {
this
.UniqueId = appointment.UniqueId;
this
.Subject = appointment.Subject;
this
.Start = appointment.Start;
this
.End = appointment.End;
this
.Body = appointment.Body;
this
.IsAllDayEvent = appointment.IsAllDayEvent;
this
.Location = appointment.Location;
// this.Category = _scheduler.Categories.GetCategoryByName(appointment.Category);
}
public
AppointmentViewModel(PublicEvent appointment, RadScheduleView _scheduler) {
this
.UniqueId = appointment.UniqueId;
this
.Subject = appointment.Subject;
this
.Start = appointment.Start;
this
.End = appointment.End;
this
.Body = appointment.Body;
this
.IsAllDayEvent = appointment.IsAllDayEvent;
this
.Location = appointment.Location;
// this.Category = _scheduler.Categories.GetCategoryByName(appointment.Category);
}
private
string
_UniqueId;
public
string
UniqueId
{
get
{
return
_UniqueId; }
set
{
if
(_UniqueId != value)
{
_UniqueId = value;
this
.OnPropertyChanged(UniqueId);
}
}
}
private
string
_location;
public
string
Location
{
get
{
return
this
._location; }
set
{
if
(_location != value)
{
this
._location = value;
this
.OnPropertyChanged(Location);
}
}
}
private
string
_body;
public
string
Body
{
get
{
return
_body; }
set
{
if
(_body != value)
{
this
._body = value;
this
.OnPropertyChanged(Body);
}
}
}
public
override
IAppointment Copy()
{
IAppointment appointment =
new
AppointmentViewModel();
appointment.CopyFrom(
this
);
return
appointment;
}
public
override
void
CopyFrom(IAppointment other)
{
AppointmentViewModel appointment = other
as
AppointmentViewModel;
if
(appointment !=
null
)
{
base
.CopyFrom(other);
UniqueId = appointment.UniqueId;
Body = appointment.Body;
Location = appointment.Location;
}
}
}
Please advise
Thanks
Ronak