I have implemented and registered my own CustomNotepadView. I have decided not to replace exiting one (by registering it as implementation of interface INotepadView) becaulse standard view is displayed in few regions and I would have to implement different behaviors:
Downside of it is that I have to control visibility of my View as I do not want user to see two different notepad tabs (when connection is Established)
So in order to activate my view I react to EventDestinationBusy and call InstantiateDynamicViewInRegion with proper parent.
Maybe someone finds it helpful.
Original Message:
Sent: 12-13-2023 06:50
From: Marcin Jarosz
Subject: WDE: showing NotepadView instantly with interaction
Thank you for your answer.
As you suggested I have called an action on viewEventManager like this after Busy event (region is already visible) like this;
viewEventManager.Publish(new GenericEvent()
{
Target = GenericContainerView.ContainerView,
Context = "InteractionDetailsRegion",
Action = new GenericAction[]
{
new GenericAction ()
{
Action = ActionGenericContainerView.ActivateThisPanel,
Parameters = new object[]
{
"NotepadVoiceNotepadView"
}
}
}
});
Unfortunately nothing happens.
No exceptions - no errors but still text field is not active.
Best
Marcin Jarosz
------------------------------
Marcin Jarosz
T-Mobile Polska Spolka Akcyjna
Original Message:
Sent: 12-06-2023 09:24
From: Anders Vejen
Subject: WDE: showing NotepadView instantly with interaction
As I recall you would activate the view based on an command that you've inserted into the chain as below. This is just examples and you'll need to find the right command chain to plug yours into:
commandManager.InsertCommandToChainOfCommandBefore( "InteractionVoiceReleaseCall", "ReleaseCall",
new List<CommandActivator>()
{
new CommandActivator() { CommandType = typeof(ActivateSamtaleEmner), Name = "ActivateSamtaleEmner" }
} );
View activation in that custom command is then:
class ActivateSamtaleEmner : IElementOfCommand
{
private readonly ILogger log;
private readonly IObjectContainer container;
private readonly IConfigurationService configService;
private readonly IViewEventManager viewEventManager;
/// <summary>
/// Initializes a new instance of the <see cref="ActivateSamtaleEmner"/> class.
/// </summary>
/// <param name="container">The container.</param>
public ActivateSamtaleEmner( ILogger log, IObjectContainer container, IConfigurationService configService, IViewEventManager viewEventManager )
{
try
{
this.log = log.CreateChildLogger( "CustomCommands.ActivateSamtaleEmner" );
this.log.Info( "Constructor(): START" );
this.container = container;
this.configService = configService;
this.viewEventManager = viewEventManager;
}
catch( Exception e )
{
this.log.Error( "Constructor(): Exception: " + e.Message );
}
this.log.Info( "Constructor(): END" );
}
/// <summary>
/// Gets the name of the command. This is optional.
/// </summary>
/// <value>The command name.</value>
public string Name { get; set; }
/// <summary>
/// Executes the command.
/// </summary>
/// <param name="parameters">The parameters.</param>
/// <param name="progress">The progress.</param>
/// <returns>True if the execution is stopped; false if successful.</returns>
public bool Execute( IDictionary<string, object> parameters, IProgressUpdater progress )
{
try
{
log.Info( "Execute(): START" );
// To the main thread.
if( Application.Current.Dispatcher != null && !Application.Current.Dispatcher.CheckAccess() )
{
object result = Application.Current.Dispatcher.Invoke( DispatcherPriority.Send, new ExecuteDelegate( Execute ), parameters, progress );
return ( bool )result;
}
else
{
log.Info( "Execute(): Trying to activate SamtaleEmner" );
// Activate the custom view in the ToolbarWorkplaceRegion
//IViewEventManager viewEventManager = ContainerAccessPoint.Container.Resolve<IViewEventManager>();
viewEventManager.Publish( new GenericEvent()
{
Target = GenericContainerView.ContainerView,
Context = "InteractionDetailsRegion",
Action = new GenericAction[]
{
new GenericAction ()
{
Action = ActionGenericContainerView.ActivateThisPanel,
Parameters = new object[]
{
"SamtaleEmnerView" // "SamtaleEmnerView"
}
}
}
} );
BR
Anders
------------------------------
Anders Vejen
NetDesign A/S, a part of Nuuday A/S
Original Message:
Sent: 12-04-2023 10:06
From: Marcin Jarosz
Subject: WDE: showing NotepadView instantly with interaction
Hi,
I made a step forward. I have managed to alter existing ViewActivator in order to show NotepadView immediately by setting Condition to null::
this.viewManager.ViewsByRegionName["InteractionDetailsRegion"].First(x => x.ViewName == "NotepadVoiceNotepadView").Condition = null;
Unfortunately text field and Save button are still disabled (button is even not visible).
Now - I would like to get a handle for NotepadView but those commands return null:
var a = viewManager.GetViewInRegion(this, "InteractionDetailsRegion", "NotepadVoiceNotepadView"); //direct request for NotepadView
var b = viewManager.GetViewInRegion(this, "ToolbarWorksheetRegion", "MainToolbarInteractionContainerView"); //request for InteractionDetailsRegion parent
I am only able to get "first level" region:
var c = viewManager.GetViewInRegion(this, "ToolbarWorksheetRegion", "MainToolbarInteractionContainerView");
Any ideas?
------------------------------
Marcin Jarosz
T-Mobile Polska Spolka Akcyjna
Original Message:
Sent: 11-28-2023 08:17
From: Marcin Jarosz
Subject: WDE: showing NotepadView instantly with interaction
Hi,
I would like to allow agents to add notes to voice interactions even though there was no connection. Unfortunately NotepadView is displayed only when call is established. Is there a way to customize this condition? I would not want to replace original NotepadView (NotepadVoiceNotepadView). I just want to show it instantly after dialing started.
I have tried to call :
viewManager.InstantiateDynamicViewInRegion(this, "InteractionDetailsRegion", "NotepadVoiceNotepadView", "NotepadVoiceNotepadView");
explicitly on EventDialling but it does not work.
I have also tried to create new activator like this:
this.viewManager.ViewsByRegionName["InteractionDetailsRegion"].Insert(0,
new ViewActivator
{
ViewType = typeof(INotepadView),
ViewName = "NotepadVoiceNotepadView",
ActivateView = true
});
hoping that view will appear statically but it also fails.
I would be grateful for any ideas.
#Implementation
------------------------------
Marcin Jarosz
T-Mobile Polska S.A.
------------------------------