GithubHelp home page GithubHelp logo

devexpress-examples / winforms-scheduler-replace-default-command Goto Github PK

View Code? Open in Web Editor NEW
0.0 56.0 0.0 40 KB

Replace a default command with a custom command in the WinForms Scheduler control.

License: Other

C# 49.09% Visual Basic .NET 50.91%
dotnet xtrascheduler-suite winforms behavior-customization commands custom-command scheduler scheduler-service windows-forms

winforms-scheduler-replace-default-command's Introduction

WinForms Scheduler - Replace a default Scheduler command with a custom command

The WinForms Scheduler Control exposes the ISchedulerCommandFactoryService interface that enables you to substitute the default command with your own (custom) command. This example replaces the default SplitAppointmentOperationCommand with a custom command. The custom command has the SplitAppointmentCommandStep property that specifies a fixed split operation's step.

public class CustomSplitAppointmentOperationCommand : SplitAppointmentOperationCommand {
    public CustomSplitAppointmentOperationCommand(ISchedulerCommandTarget target) : base(target) { }
    public CustomSplitAppointmentOperationCommand(SchedulerControl control) : base(control) { }
    private TimeSpan splitInterval = TimeSpan.FromMinutes(10);
    public TimeSpan SplitAppointmentCommandStep {
        get {
            return splitInterval;
        }
        set {
            splitInterval = value;
        }
    }
    protected override IOperation CreateOperation() {
        TimeScaleCollection timeScales = new TimeScaleCollection();
        timeScales.Add(new TimeScaleFixedInterval(SplitAppointmentCommandStep));
        return new SplitAppointmentOperation(SchedulerControl, timeScales, SchedulerControl.SelectedAppointments[0]);
    }
}

Implementation Details

  • Create a custom command class inherited from the command that you wish to replace.
  • Override required methods of the command.
  • Create a class that implements the ISchedulerCommandFactoryService interface. In this class, you need to implement the CreateCommand method to instantiate a custom command class. An identifier of the currently processed command is passed as a parameter of this method.
  • Use the custom class that implements the ISchedulerCommandFactoryService interface to substitute the default command service. In this case, the Scheduler control will use the custom command instead of the default command.

Files to Review

Documentation

winforms-scheduler-replace-default-command's People

Contributors

albertov05 avatar devexpressexamplebot avatar iam0k 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  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.