Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagec#
    public class ExampleCallAction : ICallCommand, IModuleSelector<CallCommandSelector>
    {
        public IModuleSelector<CallCommandSelector> Selector => this;

        public AntonyCommandInfo ActionInfo => new AntonyCommandInfoBuilder()
            .WithDisplayName("-> Ticket")
            .WithGroupName("Example")
            .WithGeneralPageName()
            .Build();

        public event EventHandler CommandStateChanged;

        public async Task ExecuteAsync(ICall call, IntPtr parentWindow, IProgressReporter reporter)
        {
            using (var client = new HttpClient())
            {
                var content = new StringContent($"{{" +
                                                    $"\"from\": {call.FromNumber}," +
                                                    $"\"title\": From antony call," +
                                                    $"\"description\": {call.Subject}," +
                                                $"}}");
                await client.PostAsync("http://example.ticketsystem.com/api/tickets", content);
            }
        }

        public CommandState GetCommandState()
        {
            return CommandState.Normal;
        }

        public AntonyPriority GetPriority(CallCommandSelector selectorParameter)
        {
            if (selectorParameter.Direction == CallDirection.Incoming)
                return AntonyPriority.Buildin;

            return AntonyPriority.None;
        }
    }

The code above should provide an example howto implement a ICallCommand. Of course this is not production ready, as we dont have authentication, configuration or Exception handling!

Tip

You are able to access all client side services here. For example the IUserInfoService or IClientAppointmentService to create an appointment.

Conclusion

As in all others modules you only need to provide an ICallCommand within the DI container and you can start implementing your own modules. You can start now.