zoukankan      html  css  js  c++  java
  • DevExpress.XtraScheduler控件的使用方法

    DevExpress.XtraScheduler控件的使用方法 花了两天时间,总算把XtraScheduler控件的使用方法大致搞明白了。由于这方面的中文资料特别少,所以把这方面的心得整理下来。 一、数据的读取和保存 1. 使用XML文档(参考Demo修改) 保存: schedulerStorage1.Appoi
      

    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里面的文字,这样汉化就比较方便了。呵呵,偶偷懒,没有去做。

  • 相关阅读:
    godep使用
    golang导入包的几个说明:import
    X-Frame-Options 响应头
    HTTP Strict Transport Security
    为什么我们要使用HTTP Strict Transport Security?
    IFrame安全问题解决办法(跨框架脚本(XFS)漏洞)
    基于iframe的CFS(Cross Frame Script)和Clickjacking(点击劫持)攻击
    javaWeb防止恶意登陆或防盗链的使用
    关于Cookie 的HttpOnly属性(java/web操作cookie+Tomcat操作jsessionid)
    会话cookie中缺少HttpOnly属性 解决
  • 原文地址:https://www.cnblogs.com/linghe/p/1658091.html
Copyright © 2011-2022 走看看