Author Topic: WDE 8.5 Customization How to receive event notification for Agent Skills update?  (Read 6069 times)

Offline CarloACN

  • Newbie
  • *
  • Posts: 15
  • Karma: 0
Hi all,

how can i receive and notify to the agent his skills update?

I tried using the IConfigurationService  in the following way:
this.configurationService.PropertyChanged += new PropertyChangedEventHandler(notifyPropertyChanged_PropertyChanged);
but the method notifyPropertyChanged_PropertyChanged is not invoked for the skills update.

I saw that the IConfigurationService  has the following methods:
[list]
[li]SubscribeNotification(Genesyslab.Platform.ApplicationBlocks.ConfigurationObjectModel.ICfgObject CfgObject, object asker);[/li]
[li]SubscribeNotification(Genesyslab.Platform.ApplicationBlocks.ConfigurationObjectModel.NotificationQuery notificationQuery, object asker);[/li]
[/list]

Can they help?
if yes how to apply those subscription?

Thanks a lot.

Carlo

Offline daniel_san

  • Jr. Member
  • **
  • Posts: 84
  • Karma: 1
[quote author=CarloACN link=topic=8873.msg39568#msg39568 date=1432663074]
Hi all,

how can i receive and notify to the agent his skills update?

I tried using the IConfigurationService  in the following way:
this.configurationService.PropertyChanged += new PropertyChangedEventHandler(notifyPropertyChanged_PropertyChanged);
but the method notifyPropertyChanged_PropertyChanged is not invoked for the skills update.

I saw that the IConfigurationService  has the following methods:
[list]
[li]SubscribeNotification(Genesyslab.Platform.ApplicationBlocks.ConfigurationObjectModel.ICfgObject CfgObject, object asker);[/li]
[li]SubscribeNotification(Genesyslab.Platform.ApplicationBlocks.ConfigurationObjectModel.NotificationQuery notificationQuery, object asker);[/li]
[/list]

Can they help?
if yes how to apply those subscription?

Thanks a lot.

Carlo
[/quote]

I was trying to do something similar but it was not able.

You may try to get the groups who agent belongs.


Offline CarloACN

  • Newbie
  • *
  • Posts: 15
  • Karma: 0
Thanks daniel_san and Regard Miyagi san by me  ;D

Talking seriously...how to apply your advise? how to retrieve the agent group? my problem is that i need a notification of this update and not a simple retriev...
My biggest problem is that i dont understand how to invoke the SubscribeNotification method...what are the input parameter?
[list type=decimal]
[li]ICfgObject CfgObject...Is it my agent's skill? is it a new instance of CfgSkill in my case??[/li]
[li]object asker...What is it? a new EventHandler? My own class?  a reference of something else?[/li]
[li]the Subscription return value...what to do with it?[/li]
[/list]

Please Help...


Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 7639
  • Karma: 56330
Usually you convert them to IMessages and then you can work with them. but now...a listener to an update...CfgServer propagates changes to all its clients. Maybe see what CfgServer sends when you do that change and try to capture that.

The fact you have a query means it limits what it listens...shouldn't be that...

Offline daniel_san

  • Jr. Member
  • **
  • Posts: 84
  • Karma: 1
[quote author=CarloACN link=topic=8873.msg39582#msg39582 date=1432741173]
Thanks daniel_san and Regard Miyagi san by me  ;D

Talking seriously...how to apply your advise? how to retrieve the agent group? my problem is that i need a notification of this update and not a simple retriev...
My biggest problem is that i dont understand how to invoke the SubscribeNotification method...what are the input parameter?
[list type=decimal]
[li]ICfgObject CfgObject...Is it my agent's skill? is it a new instance of CfgSkill in my case??[/li]
[li]object asker...What is it? a new EventHandler? My own class?  a reference of something else?[/li]
[li]the Subscription return value...what to do with it?[/li]
[/list]

Please Help...
[/quote]

Regards from miyagi  ;D

I didnīt konw that you can subscribe to skill events. Something new i know now  :)

I needed to do someting similar, Refresh Skills on Agent. I did it working with events of WD. For example on makecallcommand, i read directly the configuration of the agent on configuration manager to see what groups has the agent. The IAgent on constructor was not refreshing and i did it reading on configuration.

I donīt know if itīs usefull for you, i think that i can not help you  :(

Offline Kubig

  • Hero Member
  • *****
  • Posts: 2752
  • Karma: 44
Notifications about configuration changes are distributed to the IWS/WDE client by default (driven by option). So, there must be existing part, where you are able to get these information. Just have never tried it.

Offline CarloACN

  • Newbie
  • *
  • Posts: 15
  • Karma: 0
Well...i hope it could be useful for someone else too...please find below the solution:

           
            readonly Genesyslab.Desktop.Modules.Core.SDK.Configurations.IConfigurationService configurationService;
          private Genesyslab.Platform.ApplicationBlocks.ConfigurationObjectModel.Subscription subscriptionCFGSkill;
          private Genesyslab.Platform.ApplicationBlocks.ConfigurationObjectModel.Subscription subscriptionCFGPerson;
                                        .
                                        .
                                        .
            this.configurationService.NecessaryNotificationAgainEvent += new EventHandler(this.configurationService_NecessaryNotificationAgainEvent);

            this.configurationService.ConfigService.Register(new Action<ConfEvent>(this.NotifConfigUpdateHandler));
            this.subscriptionCFGPerson = this.configurationService.SubscribeNotification(new NotificationQuery()
            {
                ObjectType = CfgObjectType.CFGPerson,
                TenantDbid = this.configurationService.WorkingTenant,
                ObjectDbid = this.agent.ConfPerson.ObjectDbid
            }, (object)this);
            this.subscriptionCFGSkill = this.configurationService.SubscribeNotification(new NotificationQuery()
            {
                ObjectType = CfgObjectType.CFGSkill,
                TenantDbid = this.configurationService.WorkingTenant
            }, (object)this);
                                                    .
                                                    .
                                                    .
            private void configurationService_NecessaryNotificationAgainEvent(object sender, EventArgs e)
        {
            if (this.subscriptionCFGPerson != null)
                this.subscriptionCFGPerson = this.configurationService.SubscribeNotification(new NotificationQuery()
                {
                    ObjectType = CfgObjectType.CFGPerson,
                    TenantDbid = this.configurationService.WorkingTenant
                }, (object)this);
        }
            private void NotifConfigUpdateHandler(ConfEvent message)
        {
            log.Debug("Agent Update check, Updated EventType: " + message.ObjectType);
            switch (message.ObjectType)
            {
                case CfgObjectType.CFGPerson:
                      .
                      .
                      .
                    break;
            }
        }

                                             

Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 7639
  • Karma: 56330
Thanks a lot for sharing!  ;D

Offline daniel_san

  • Jr. Member
  • **
  • Posts: 84
  • Karma: 1
Great!  :D