Current filter:
                                You should refresh the page.
                                  • Hi there. I have a client that uses the ExpressScheduler with the DB storage and the suggested fields from the DevExpress documentation. That client now wants me to read and write this information, but from a .NET application (I need to sync the schedule data with Exchange). It looks to me like the ResourceID and Recurrence Info are stored as some sort of binary representation.
                                    Do you have, or could you provide, some sample code in C# that reads/writes the ResourceID and Recurrence Info from the VCL schedule control? Or are these Delphi classes and data that are streamed as bytes? In that case it almost sounds like I'd need to do interop with a Delphi DLL or console EXE to read/write these things.
                                    Would love to know your thoughts on this. Thanks in advance!

                                Show all comments
                                • Ingvar (DevExpress Support) 01.23.2012

                                  Hello Nathanial.
                                  Thank you for your message. Please refer to the Convert ResourceID to .NET report, which describes how to convert the ExpressScheduler's data to pass it to XtraScheduler.
                                  I hope this will help you achieve the required functionality.
                                  Best regards,
                                  Ingvar.

                                • Nate Woolls - DevExpress MVP 01.23.2012

                                  Ingvar - that sample is in Delphi. I need to read/write the scheduler data from .NET, not Delphi.

                                • Serge (DevExpress Support) 01.25.2012

                                  Hi Nate,
                                  I am happy to hear from you. Hope you are doing well.
                                  By design, the ExpressSchedule stores these values as byte streams. This means that it will be impossible to directly read and parse this information from your .NET application. At the same time, structures of these values are different:

                                  1. ResourceID is a variant value converted from a list of IDs
                                  2. RecurrenceInfo is an object of the TcxSchedulerEventRecurrenceInfo type. You can read about its fields in the ExpressScheduler's documentation.
                                  If I were you, I would design a Delphi DLL parsing these values. I refer you to tickets Q99806 (events share resources - Generate ResourceID value programmatically) and Q214425 (How to deal with RecurrenceInfo) where I explained how to utilize the ResourceID and RecurrenceInfo values, respectively.
                                  Regards,
                                  Serge
                                • Nate Woolls - DevExpress MVP 01.25.2012

                                  Thanks very much for the reply Sergey. I had a feeling I would need to interop with Delphi to do this from looking at the code. I appreciate you confirming this for me. Have a good day!

                                • Nate Woolls - DevExpress MVP 01.25.2012

                                  Thanks again!

                                • Serge (DevExpress Support) 01.26.2012

                                  You are always welcome, Nate!

                                1 Solution

                                Creation Date Importance Sort by

                                Hi there!
                                I wonder if I could get you guys to reconsider this answer. I spent quite a bit of time writing a Delphi DLL, learning to interop between Delphi and C#, digging into encoding/decoding recurrence info etc and, in the end, I'm pretty sure a Delphi DLL is not necessary.
                                From what I can tell, the recurrence information is stored as an array of bytes. If I use a method like this:
                                        static void ByteArrayToStructure(byte[] bytearray, ref object obj)
                                        {
                                            int len = Marshal.SizeOf(obj);
                                            IntPtr i = Marshal.AllocHGlobal(len);
                                            Marshal.Copy(bytearray, 0, i, len);
                                            obj = Marshal.PtrToStructure(i, obj.GetType());
                                            Marshal.FreeHGlobal(i);
                                        }
                                I seem to get the right results in reading/writing the array of bytes right in C#. The struct is defined like this:
                                [Flags]
                                        private enum Days : byte
                                        {
                                            Sunday = 0x01,
                                            Monday = 0x02,
                                            Tuesday = 0x04,
                                            Wednesday = 0x08,
                                            Thursday = 0x10,
                                            Friday = 0x20,
                                            Saturday = 0x40
                                        }
                                        [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
                                        private struct SchedulerEventRecurrenceInfoData
                                        {
                                            public int Count;
                                            public int DayNumber;
                                            public byte DayType;
                                            public double Finish;
                                            public Days OccurDays;
                                            public int Periodicity;
                                            public byte Recurrence;
                                            public double Start;
                                            public int YearPeriodicity;
                                            public byte Reserved1;
                                            public int DismissDate;
                                        }
                                Basically I get the same results calling either my Delphi DLL (which calls cxStringToRecurrenceInfoData) or using the above ByteArrayToStructure method.
                                Am I missing something or does this work OK? On the one hand it would be nice to do this all in C# without needing a DLL. On the other there were a lot of hours spent already struggling with what may be unnecessary interop ;)

                                • Serge (DevExpress Support) 02.14.2012

                                  Hi Nate,
                                  Thank you for the update. I am happy to hear of your progress and apologize if my suggestion directed you to a wrong track. Of course, your approach is also good and it surely should work faster. I am only a bit sceptical about ResourceID values, which are variant values by design. Still, I think that using a Delphi DLL is a more stable approach because it is based on the "native" ExpressScheduler code. If we ever change the structure of this data, your DLL will not fail.
                                  Regards,
                                  Serge

                                • Nate Woolls - DevExpress MVP 02.14.2012

                                  Fantastic, thanks for the update. You are absolutely right on your concerns about the ResourceID values and potential changes to the inner workings of the VCL grid.
                                  The way my DLL is currently coded, it passes the TcxSchedulerEventRecurrenceInfoData record directly, so I think a change to that would still break my DLL (not positive on this). However, that may be a good thing.
                                  For instance, if you added a new member to TcxSchedulerEventRecurrenceInfoData, and my code didn't break, then my code might read/write an event and now lose that extra bit of information.
                                  That said I do appreciate these extra considerations, that was exactly what I was looking for. Thanks!

                                • Serge (DevExpress Support) 02.15.2012

                                  I am happy to be helpful, Nate!