zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    PHP 函数
    MariaDB——(三) MariaDB 10.0.15 standard replication主从复制搭建
    MariaDB——(二) MariaDB 10.0.15 日志文件—undo 日志
    MariaDB——(一)CentOS 6.5 下 MariaDB 10.0.15 YUM 安装
    虚拟机中的linux系统文件突然全部变成只读的问题
    复制虚拟机vmware centos搭建集群节点过程中网络配置eth0和eth1遇到的问题以及NAT模式下虚拟机静态IP配置方法
    WMware 中CentOS系统Hadoop 分布式环境搭建(一)——Hadoop安装环境准备
    关于Oracle字符集在dmp文件导入导出中的乱码影响
    VMware 打开虚拟机的时候提示 internal error 内部错误 遇到这个问题时我的解决方法
    ORACLE 存储过程中保存用户自定义异常信息的一种方式
  • 原文地址:https://www.cnblogs.com/godwar/p/1044511.html
Copyright © 2011-2022 走看看