DevExpress.XtraScheduler控件的使用方法一

花了两天时间,总算把XtraScheduler控件的使用方法大致搞明白了。由于这方面的中文资料特别少,所以把这方面的心得整理下来。

一、数据的读取和保存
 1. 使用XML文档(参考Demo修改)
    保存: schedulerStorage1.Appointments.Items.WriteXml("xmlFile.xml");
    读取:
public static void FillStorageCollection(PersistentObjectCollection c, string xmlFile) {
            using(Stream stream = new System.IO.FileStream(xmlFile, FileMode.Open, FileAccess.Read)
            {
                c.ReadXml(stream);
                stream.Close();
            }
        }

public static void FillStorageData(SchedulerStorage storage) {
            FillStorageCollection(storage.Appointments.Items, "XmlFile.xml");
        }

在Form_Load中直接填充数据:FillStorageData(schedulerStorage1)就OK了。

二、使用数据表
TableName:【UserScheduler】
 (1). ID  Primary int 
 (2). UserName   nvarchar(20) AllowNull
 (3). AppAllDay   bit AllowNull
 (4). AppDescription   text(16) AllowNull
 (5). AppEnd   datetime AllowNull
 (6). AppLabel   int AllowNull
 (7). AppLocation   varchar(100) AllowNull
 (8). AppRecurrenceInfo   xml AllowNull
 (9). AppReminderInfo   xml AllowNull
 (10). AppResourceId   int AllowNull
 (11). AppStart   datetime AllowNull
 (12). AppStatus   varchar(50) AllowNull
 (13). AppSubject   varchar(100) AllowNull
 (14). AppType   varchar(50) AllowNull
其中ID是自增类型, UserName是用户名,其余都是保存Appointment的相关信息。
AppRecurrenceInfo和AppReminderInfo分别用来保存循环和提醒信息,我用的数据库是SQLServer2005,采用的是XML数据类型,采用Text也没问题。

定义一个变量: DataSet ds = new DataSet();
读取数据:
schedulerStorage1.Appointments.Mappings.AllDay = "AppAllDay";
            schedulerStorage1.Appointments.Mappings.Description = "AppDescription";
            schedulerStorage1.Appointments.Mappings.End = "AppEnd";
            schedulerStorage1.Appointments.Mappings.Label = "AppLabel";
            schedulerStorage1.Appointments.Mappings.Location = "AppLocation";
            schedulerStorage1.Appointments.Mappings.RecurrenceInfo = "AppRecurrenceInfo";
            schedulerStorage1.Appointments.Mappings.ReminderInfo = "AppReminderInfo";
            schedulerStorage1.Appointments.Mappings.ResourceId = "AppResourceId";
            schedulerStorage1.Appointments.Mappings.Start = "AppStart";
            schedulerStorage1.Appointments.Mappings.Status = "AppStatus";
            schedulerStorage1.Appointments.Mappings.Subject = "AppSubject";
            schedulerStorage1.Appointments.Mappings.Type = "AppType";

           ds = ...........................;           
            schedulerStorage1.Appointments.DataSource = ds.Tables[0];

保存数据:
schedulerStorage1.Appointments.EndUpdate();
这样会把数据更新到DataSet,然后吧这个DataSet写回数据库就OK了。

三、schedulerStorage1.Resources的设置,和Appointment差不多,我直接使用了Demo上的方法。

四、弹出Appointments表单的汉化。
看XtraScheduler的源码,是直接使用Form做的。我直接在上面汉化,然后重新编译的。
比较好的办法是直接修改DevExpress.XtraScheduler.Localization,然后在Form中调用Localization里面的文字,这样汉化就比较方便了。呵呵,偶偷懒,没有去做。


http://blog.csdn.net/patrickpan/archive/2007/09/05/1772578.aspx

转载于:https://www.cnblogs.com/godwar/archive/2008/01/18/1044511.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值