Coder Social home page Coder Social logo

devexpress-examples / xaf-how-to-create-custom-event-and-resource-classes-for-scheduler Goto Github PK

View Code? Open in Web Editor NEW
1.0 33.0 0.0 212 KB

This repository contains examples of custom Event and Resource classes for Scheduler in XAF applications

License: Other

HTML 15.02% C# 84.30% CSS 0.68%
dotnet ef-core expressapp expressapp-framework expressappframework xaf xaf-blazor xaf-winforms xpo

xaf-how-to-create-custom-event-and-resource-classes-for-scheduler's Introduction

XAF - Create Custom Event and Resource Classes for XAF Scheduler

Scheduler List Views work with events (IEvent objects) and resources (IResource objects).

XAF's Business Class Library implements these interfaces in Event and Resource classes. In some cases, you may need to extend these classes or even implement their corresponding interfaces from scratch.

The example in this repository implements the following scenarios:

  1. Use custom event and resource objects.

  2. Use ApplicationUser as a resource.

  3. Create an event with a single resource.

NOTE
Instructions below describe classes specific to Entity Framework Core ORM. For XPO-specific classes refer to the following files:

  • "c:\Program Files\DevExpress 2X.Y\Components\Sources\DevExpress.Persistent\DevExpress.Persistent.BaseImpl.Xpo\Event.cs"
  • "c:\Program Files\DevExpress 2X.Y\Components\Sources\DevExpress.Persistent\DevExpress.Persistent.BaseImpl.Xpo\Resource.cs"

Implement Custom Events and Resources

  1. Create a new event class and add properties. See the #region Base Properties section in the source code. It contains all IEvent properties except ResourceId.

  2. Implement a resource object. See the #region Resources section in the source code.

    The IEvent interface requires a string ResourceId property that stores a collection of resources in an XML string (required by the Scheduler control). In XAF, we recommend that you add an associated collection of objects instead. Add the ResourceId string property and the Resources collection property and set up synchronization between them.

  3. Implement IRecurrentEvent. See the #region IRecurrentEvent section in the source code.

  4. Implement IReminderEvent. See the #region IReminderEvent section in the source code.

    Note Reminders are currently not supported in XAF Scheduler Module for ASP.NET Core Blazor. Skip this section for ASP.NET Core Blazor applications.

  5. Add Blazor compatibility options. See the #region Blazor compatibility section in the source code. Skip this step if you do not plan to implement the Event class in an ASP.NET Core Blazor application.

  6. Implement object construction. See the #region Construction section in the source code.

    If you need to initialize a property (for example the StartOn or EndOn property) when XAF creates a new CustomEvent, override the OnCreated event.

  7. If you want to add validation, see the #region Validation section in the source code.

    To use the Validation Module, add validation rules to your object. For example, you can demand that the StartOn date always precedes the EndOn date.

Implement the IResource Interface in the ApplicationUser Class

  1. Implement the IResource interface in the ApplicationUser class.

    Note
    In this example, we implement IResource.Id explicitly because ApplicationUser already has an ID property. This implicit implementation causes an ambiguous exception in Windows Forms applications that use Entity Framework Core ORM. To resolve this issue, remap the Scheduler to the ID property directly instead of the IResource.Id property. For implementation details, refer to CustomEventWithUserResourcesController.cs.

  2. If you implement IResource in multiple classes, specify a Resource class for the corresponding Scheduler List View. For more information, refer to the following topic: Use a Custom Resource Class.

Use Application Model to Customize Objects in Scheduler

  1. Enable drag-and-drop in Scheduler.

    By default, Scheduler does not allow to edit objects. You need to set the AllowEdit property to true in the Model.DesignedDiffs.xafml file.

  2. Customize the Start and End properties to show time.

    By default, DateTime property editors only display date. Change DisplayFormat and EditMask to show and edit time. For details, see the Model.DesignedDiffs.xafml file.

Create an Event with a Single Resource

  1. If you want to create a One-to-Many relationship between a resource and events, change ResourceId implementation. For details, see the following source file: CustomEventWithCustomResource.cs.

  2. Create a custom Resource class and implement the IResource interface. For implementation details, see the following source file: CustomResource.cs.

Files to Review

Documentation

Does this example address your development requirements/objectives?

(you will be redirected to DevExpress.com to submit your response)

xaf-how-to-create-custom-event-and-resource-classes-for-scheduler's People

Contributors

abadzhev avatar anastasiakiseleva avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.