Genesys CTI User Forum
Genesys CTI User Forum => Genesys-related Development => Topic started by: MJaskowski on February 25, 2020, 08:54:20 PM
-
Hello everyone,
I have question about create/add new button to existing view. Is it possible?
I want add button programatically to ContactInfoHistoryMultiRegion and exactly to ContactInformationView -> DockPanelContactHistoryContent -> Toolbar_Copy. I can't access to it and I don't know how to bite it. Did you have similar case?
Thank you for all tips.
Regards
Matt
-
Check WDE samples. There is a Button sample.
Enviado de meu SM-N9600 usando o Tapatalk
-
Hello cavagnaro,
thank you for answer. I know sample with button, I hope we talk about the same sample - I can create buttton in my NEW/OWN view, for example to ToolbarWorkplaceRegion I add new tab with button, right?
But my question is about existing view created default in WDE and more precisly I'm talking about Contacts History Tab. Or maybe I misunderstood you? Could you expand your thought?
-
Yeah, same, just get the View name, also at Documentation, and elaborate into that.
Enviado de meu SM-N9600 usando o Tapatalk
-
Cavagnaro,
I suppose to do something wrong or I don't know about any method. I found where is my problem, I'm adding new ViewActivator to ContactTabBottomHistoryMultiRegion but this region doesn't exist yet when ExtensionModule do Initialize() method.
[code]
public void Initialize()
{
container.RegisterType<IMyView, MyView>();
container.RegisterType<IMyViewModel, MyViewModel>();
}
[/code]
then I made viewEventManager.Subscribe(CheckingEvent) which raise event after select email in ContactHistoryView
[code]
private void CheckingEvent(object obj)
{
string loadedAction = (obj as GenericEvent).Action[0].Action as string;
ViewActivator toolbarContainer = null;
if (loadedAction == "LoadInteractionInformation")
{
foreach (ViewActivator view in viewManager.ViewsByRegionName["ContactInfoHistoryMultiRegion"])
{
if (view.ViewName == "ContactInformationView")
{
viewManager.ViewsByRegionName["ContactTabBottomHistoryMultiRegion"].Add(
new ViewActivator()
{
ViewType = typeof(IMyView),
ViewName = "MyView",
ActivateView = true
}
);
break;
}
}
}
}
[/code]
ViewActivator correctly add to region but unfortunately I don't see result. If I will add the same view to eg. ToolbarWorkplaceRegion, I see my view. I can't catch what is point.
Should I do it any other way?
-
I do not see any reason for iterating the existing view. You can directly add your custom view into existing region through the ViewManager. You just need to load your module after the ContactModule is loaded, thus why you cannot insert view right now as you trying to insert it so early.
I use ContactTabBottomHistoryMultiRegion region is several projects and never have encountered any issue on that.
-
My guess is I try too early to load my view that's why I made own event but this is wrong way. Did you do the same way or do you load view by other method? I can't catch where I am wrong.
Any keywords?
If I add ViewActivator by own event (when I have and I see ContactInfoHistoryMultiRegion region) then my view isn't visible, should I use any method or something yet?
-
[quote] You just need to load your module after the ContactModule is loaded [/quote]
How can I catch it? By event? Could you expand thought?
-
Hi Matt,
In initialize method try using the viewManager.AddViewsToRegion method, then you don't need to wait for the region to already exist:
[code] viewManager.AddViewsToRegion("ContactTabBottomHistoryMultiRegion", new List<ViewActivator>() {
new ViewActivator()
{
ViewType = typeof(ICancelRecordView),
ViewName = "MyView",
ActivateView = true,
ActivateOrder = 30
}
});[/code]
-
Pete!
You are an amazing guy! Thank you so much. Such a small change, and allowed me to do it the way I wanted. I understand that the AddViewsToRegion method creates a non-existent region? Something like a placeholder?
Thank you for your knowledge, again!
Matt
-
Pete is THE guy [emoji41]
Enviado de meu SM-N9600 usando o Tapatalk
-
Honestly, I am using both approaches (using AddViewsToRegion and ViewsByRegionName methods) and never have encountered issue with instanting custom view/part. I suppose there might be another issue that causes your custom part is not visible at all.
-
I don't know why the .Add () method for viewManager did not work for the region "ContactTabBottomHistoryMultiRegion". I checked the "ToolbarWorksheetRegion" region and it works fine.
The .AddViewsToRegion () method works well in both cases. Everything is located in the main module Initialize() loaded at startup (the same as ExtensionSampleModule). Maybe it's a bug? Have I implemented something bad maybe? But I didn't create something special, so I don't think so. Any idea what could I check?
-
Which version of IWS/WDE are you using?
-
WDE 8.5.127.06
-
Include this parameter in your ViewActivator:
[code]
CreateNewRegionManager = true
[/code]
Also check how the option interaction-workspace\views.ContactTabBottomHistoryMultiRegion.activate-order is set on your WDE application object
-
Hello,
Parameter CreateNewRegionManager has been changed on true, that was my first think about it but didn't change anything. If we talk about "interaction-workspace\views.ContactTabBottomHistoryMultiRegion.activate-order" parameter I guess we talk about CME options? If yes I checked it also and this doesn't help me, of course I added view likewise 3 other (standard) views. This did not make my view work. Of course, ordering works correctly.
-
Just in case if someone found this valuable topic like me today. There is one more easy workaround. Like Kubig said, we just have to register our view after ContactsModule is loaded. We can achieve this by choosing right task in the .module-config file:
[code]<task name="InteractionWorkspace.Contacts.canUse" modulesToLoad="CustomTabModule" />[/code]
Many thanks to all participiants!