DevExpress.XtraScheduler控件的使用方法

DevExpress.XtraScheduler控件的使用方法,第1张

概述DevExpress.XtraScheduler控件使用方法  花了两天时间,总算把XtraScheduler控件的使用方法大致搞明白了。由于这方面的中文资料特别少,所以把这方面的心得整理下来。 一、数据的读取和保存  1. 使用XML文档(参考Demo修改)     保存: schedulerStorage1.Appointments.Items.WriteXml("xmlFile.xml") 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上的方法。

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

总结

以上是内存溢出为你收集整理的DevExpress.XtraScheduler控件的使用方法全部内容,希望文章能够帮你解决DevExpress.XtraScheduler控件的使用方法所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/sjk/1182915.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-02
下一篇 2022-06-02

发表评论

登录后才能评论

评论列表(0条)

保存