how to change scheduler header text? - c#

iam using devexpress scheduler. in my form iam using
schedulerControl1.ActiveViewType = DevExpress.XtraScheduler.SchedulerViewType.WorkWeek;
schedulerControl1.WorkWeekView.WorkTime.Start = System.TimeSpan.FromHours(7);
schedulerControl1.WorkWeekView.WorkTime.End = System.TimeSpan.FromHours(22);
schedulerControl1.WorkWeekView.ShowWorkTimeOnly = true;
schedulerControl1.WorkWeekView.ShowAllDayArea = false;
as you can see iam using workweek view, the start week setting properties was monday, but the header is displaying 10 october, 11 octoberand so on. the thing is how do i change the scheduler header to day name like monday, tuesday and so on.
n.b : if its duplicate please refer it

you can use formatting services (see Formatting Services - an example of use) for this purpose.
See Also:
Work Week View without specific dates
Refer these for the alternative way to implement this:
How to: Display Custom Day Headers
SchedulerControl.CustomDrawDayOfWeekHeader Event
How to: Custom Paint Day Headers
CustomDrawDayHeader, how to use custom captions with default background ?
Hope this help.

Related

Recurring events lose automatic timezone conversion

I'm setting up a calendar invite email using ical.net. Sending out a non-recurring event seems to work perfectly: I set the start and end date like this
iCalEvent.DtStart = new CalDateTime(DateTime.SpecifyKind(model.EventTime.Value, DateTimeKind.Utc));
iCalEvent.DtEnd = new CalDateTime(DateTime.SpecifyKind(model.EventTime.Value.AddMinutes(model.DurationMins.Value), DateTimeKind.Utc));
when the email arrives, the time zone has been converted to the recipients timezone (The timezone is -7, the eventTime is 4pm and the duration is 3 hours)
However, when I take this same exact code and add this line to it
IRecurrencePattern recurrence = new RecurrencePattern(FrequencyType.Daily, 1)
{
Until = DateTime.SpecifyKind(model.endDate.Value.AddDays(1), DateTimeKind.Utc)
};
iCalEvent.RecurrenceRules = new List<IRecurrencePattern> { recurrence };
Suddenly my timezone is no longer converted when the email is received (The timezone is -7, the eventTime is 4pm and the duration is 3 hours. The endDate is on the 28th)
I need the DateTime to be displayed to the user in their own timezone and I need to display recurring events from the eventTime to the endDate
It may also be useful to note that I do not have a timezone property specified on Calendar as it was causing the sent email to show a "not supported calendar message" in outlook. Before I removed it, it looked like this
iCal.AddTimeZone(new VTimeZone("UTC"));
when I opened ical files that had this time zone specified, they seemed to work correctly for multi day events, but as I need them to appear in outlook with the accept/decline/tentative buttons, it is out of the question to add it back
i've also tried specifying datetimes like this
iCalEvent.DtStart = new CalDateTime(leEvent.EventTime.Value, "UTC");
but nothing changed
EDIT: I now understand that the issue is due to a recurring event needing a timezone as specified here, but I'm not quite sure where the timezone needs to be specified. I went back to adding the vTimeZone back in and validating it through this site, and it appears that the iCal file is missing the standard/daylight section inside of the timezone block
I have also tried specifying the timezone as GMT and specifying the timezone as "\"America/Phoenix\"" so that the tzid came out as TZID:"America/Phoenix" (with quotes in the ical file.
This is my code at the moment that causes the issue.
iCalEvent.DtStart = new CalDateTime(DateTime.SpecifyKind(model.EventTime.Value, DateTimeKind.Utc));
iCalEvent.DtEnd = new CalDateTime(iCalEvent.DtStart.Value.AddMinutes(model.DurationMins.Value));
if (model.EndDate.HasValue)
{
IRecurrencePattern recurrence = new RecurrencePattern(FrequencyType.Daily, 1)
{
Until = DateTime.SpecifyKind(model.MaxDate.Value, DateTimeKind.Utc).ToLocalTime()
};
iCalEvent.RecurrenceRules = new List<IRecurrencePattern> { recurrence };
iCalEvent.DtStart = new CalDateTime(iCalEvent.DtStart.Value.ToLocalTime(), "America/Phoenix");
iCalEvent.DtEnd = new CalDateTime(iCalEvent.DtEnd.Value.ToLocalTime(), "America/Phoenix");
iCal.AddTimeZone(new VTimeZone("America/Phoenix"));
}
I'm not quite sure what needs to happen to correct the standard/daylight ical error from this point.
FINAL EDIT:
after reading through this post, I found that this issue has already been solved as of last november. I checked the version we had in our project and it turned out some genius just copied the dll straight in without setting it up through nuget (and a version from several years ago no less). I grabbed the latest version and this time specifying the timezone caused no issues in outlook. I'm still experimenting with addTimeZone and addLocalTimeZone but I'm definitely on the right track. Thank you to rianjs for this extremely useful library. I don't know how I would possible work with this crazy calendar standard without it.
A recurring event is always relative to the sender's timezone (or rather to the event location), and not to the recipient's timezone, because of daylight saving changes which may happen at different time between the organiser and the various recipients.
So in most cases you want to use a meaningful timezone in the event (i.e. not UTC).
Then Outlook is simply showing that the event is indeed happening according to the given timezone. This is an indication that the event may not always be at the same time of day for the recipient.
Since this took me so long to figure out, I might as well share my solution in case anyone else runs into this problem and finds this.
I defined the DtStart/DtEnd with two datetimes that had kind utc
calendarEvent.DtStart = new CalDateTime(model.EventTime.Value);
calendarEvent.DtEnd = new CalDateTime(model.EventTime.Value.AddMinutes(model.DurationMins.Value));
which worked great for single day events, but with multidays I ended up doing this
if (model.EndDate.HasValue)
{
RecurrencePattern recurrence = new RecurrencePattern(FrequencyType.Daily, 1)
{
Until = model.EndDate.Value //has kind: Utc
};
var timezoneOffsetString = "Etc/GMT";
if (timezoneOffset > 0) //client time zone offset, calculated through js
{
timezoneOffsetString += "-" + timezoneOffset;
}
else if (timezoneOffset < 0)
{
timezoneOffsetString += "+" + (-1 * timezoneOffset);
}
calendar.AddTimeZone(timezoneOffsetString);
calendarEvent.DtStart = calendarEvent.DtStart.ToTimeZone(timezoneOffsetString);
calendarEvent.DtEnd = calendarEvent.DtEnd.ToTimeZone(timezoneOffsetString);
calendarEvent.RecurrenceRules = new List<RecurrencePattern> { recurrence };
}
It's not fullproof as some places may have weird dst problems, but nodatime was treating the "America/Phoenix" tzid as an LMT time, which was giving me a time that was like 28 minutes off... Besides, treating all dates as GMT is closer to the implementation we have in the rest of our app so it worked for my situation
This solution gave me the idea to piece together the Etc/GMT stuff.

Get UWP app acquisition date

How can I get an app's acquisition date?
I tried using StoreContext - ExtendedJsonData() but it didn't have that information.
Many UWP devs have asked about this and it's true... you can't ask for this value. You can only get the purchase or first-time download date.
However, you can try this trick. It's just a workaround, so don't blame me if one day it fails you :)
var properties = await Package.Current.InstalledLocation.GetBasicPropertiesAsync();
var installationDate = properties.ItemDate; // Maybe?
Let me know if it works for you.

Google calendar incorrect imports DDay multiple-day events

I'm using a DDay library to create iCal file. Here's an example of one event that I created:
BEGIN:VCALENDAR
VERSION:2.0
METHOD:PUBLISH
PRODID:-//MyProduct
BEGIN:VEVENT
CATEGORIES:Office event
DESCRIPTION:Rudniy\, Kazahstan office has a work day.
DTEND;VALUE=DATE:20141207
DTSTAMP:20141230T085900Z
DTSTART;VALUE=DATE:20141206
SEQUENCE:0
SUMMARY:Work Day in RDN
UID:6418abbe-1904-40c4-8544-e87dd4f4c002
END:VEVENT
END:VCALENDAR
When I import that calendar to Google Calendar, the result event is only on 2014-12-06 and is one day long (instead of two).
Can please somebody tell what's wrong?
When you use end.date and start date properties, you will give date in the format "yyyy-mm-dd". In google calendar, these properties are used to create ONLY "All-day events". Here is link for the details on using properties.
Try using the properties end.dateTime(format is 2015-01-03T10:00:00.000-07:00) and start.dateTime properties to create multiple-day events.
Okay, finally I got it. The END date specifies NON-INCLUSIVE end date for event. So I just should add 1 day to each end date by myself.

Showing different calendars in Windows Phone 7

I'm trying to get a complete list of all calendars. If I list
(new Appointments()).Accounts
I get only accounts like "Windows Live" or "Google". Actually I need a way to get the calendars and the appointments to that calendar inside the accounts. But it has to be on any account, not only the Live Account. Read only access is enough though. Is there any possibility?
If there is no chance, is this possible under WP8? Yes, I know, hardware capabilities were to high for this feature under WP7.8.
There is a method Appointments.SearchAsync which you should use. There is quite a nice example on MSDN:
Appointments appts = new Appointments();
appts.SearchCompleted += new EventHandler<AppointmentsSearchEventArgs>(Appointments_SearchCompleted);
DateTime start = DateTime.Now;
DateTime end = start.AddDays(7);
appts.SearchAsync(start, end, "Appointments Test #1");
Within callback function you'll have access to args.Results of type IEnumerable<Appointment>.
This is available on both WP7.1 and WP8.

MPXJ Set 24 Hours Calendar on Resource

I am working with MPXJ framework to generate an XML file with i import into project 2007. I have run in to allot of problems but i can't seem to find an answer to the following.
I have a fixed Work and duration on a task, but when i add a resource and import it in project i get an error message:
"The resource is assigned outside the original dates for task 2 in project. The duration of this fixed-duration task will change to accommodate the resource assignment".
Project then changes the work and or duration value. that is not what i want. i want the resource to use the 24 hours calendar but i can't seem to attach the project 2007 standard calendar, so i thought lets make my own 24 hours calendar and attach that to resource. now i can't seem to set the 0:00:00 to 0:00:00 time in a work day.
ProjectCalendar calendar = projectFile.addResourceCalendar();
calendar.setName("24 Hours");
calendar.setUniqueID(Count);
calendar.setWorkingDay(Day.MONDAY, true);
calendar.setWorkingDay(Day.TUESDAY, true);
calendar.setWorkingDay(Day.WEDNESDAY, true);
calendar.setWorkingDay(Day.TUESDAY, true);
calendar.setWorkingDay(Day.FRIDAY, true);
Resource resource = projectFile.addResource();
resource.setUniqueID(Count);
resource.setName("Painters");
resource.setResourceCalendar(calendar);
Any one know of a solution to one get the default 24 hour calendar set to the resource of make my own.
The code below illustrates how to create a 24 hour calendar. My apologies for the long-winded way each day is set up, I need to improve the way the Day class works so that it is easier to iterate.
The key point to note is that the DateRange instance is set up to start at 00:00 hours on one date, and finish at 00:00 hours on the following day. The actual date used is irrelevant, the calendar is only using the time element of the date.
Hope that makes sense!
//
// Use this date formatter to make it simple to specific the range
// start and wne dates
//
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");
//
// This is an immutable date range, so we can share it without
// worrying about it being changed
//
DateRange range = new DateRange(format.parse("2000-01-01 00:00"), format.parse("2000-01-02 00:00"));
//
// Add the calendar and name it
//
ProjectCalendar test = file.addBaseCalendar();
test.setName("Test 24 Hours");
//
// Mark each day as working
//
test.setWorkingDay(Day.SUNDAY, true);
test.setWorkingDay(Day.MONDAY, true);
test.setWorkingDay(Day.TUESDAY, true);
test.setWorkingDay(Day.WEDNESDAY, true);
test.setWorkingDay(Day.THURSDAY, true);
test.setWorkingDay(Day.FRIDAY, true);
test.setWorkingDay(Day.SATURDAY, true);
//
// Add a working hours range to each day
//
ProjectCalendarHours hours;
hours = test.addCalendarHours(Day.SUNDAY);
hours.addRange(range);
hours = test.addCalendarHours(Day.MONDAY);
hours.addRange(range);
hours = test.addCalendarHours(Day.TUESDAY);
hours.addRange(range);
hours = test.addCalendarHours(Day.WEDNESDAY);
hours.addRange(range);
hours = test.addCalendarHours(Day.THURSDAY);
hours.addRange(range);
hours = test.addCalendarHours(Day.FRIDAY);
hours.addRange(range);
hours = test.addCalendarHours(Day.SATURDAY);
hours.addRange(range);

Categories

Resources