If your class extends IModule then you must be talking about the entry point class that is run when IWS starts.
I don't think it is possible to directly obtain a reference to any views here, since the views don't actually exist yet / no windows are actually being displayed.
What I have done before is make a dummy control that is empty, and add it to some region I know will always be displayed. Then from within the dummy control I can obtain references to any views I need. Alternatively you could examine the IInteractionManager interface - there are some event handlers that will be of interest to you. Specifically InteractionCreated and InteractionEvent.
If you subscribe to these events, you can add your own event handler. In the event handler you can look for whatever combination of UserData that might exist that would indicate it is time to remove the view you want. Then you can get a reference to the view through the EventArgs and go to town.
For example, registering your own event handler against IInteractionManager.InteractionEvent in your entry point class:
[code]
try
{
interactionManager.InteractionEvent += interactionManager_InteractionEvent;
}
catch (Exception ex)
{
// some handling
}
[/code]
Now create your event handler in your entry point class, note you will have to insert breakpoints and examine the UserData to determine what views you might have access to, and what combination of data that you want to act upon. This example is very ugly but works when a PushPreview interaction is received:
[code]
private void interactionManager_InteractionEvent(object sender, EventArgs<IInteraction> args)
{
if(args.Value != null)
{
if(args.Value.UserData != null)
{
if(args.Value.UserData.ContainsKey("InteractionView"))
{
if(args.Value.State.Equals(Genesyslab.Enterprise.Model.Interaction.InteractionStateType.Connected))
{
IInteractionPreviewToolbarView toolbarView = args.Value.UserData["InteractionView"] as IInteractionPreviewToolbarView; // get a ref to some view we see on the screen
IDictionary<string, object> contextDictionary = (toolbarView.Context as IDictionary<string, object>); // turn its Context into a dictionary
object caseViewObject;
if(contextDictionary.TryGetValue("CaseView", out caseViewObject))
{
ICaseView caseView = caseViewObject as ICaseView;
viewManager.RemoveViewInRegion(caseView, "ConsultationBundlesRegion", "MainBundleView");
}
}
}
}
}
}
[/code]
I just wrote that code by hand and haven't tested / compiled it. It may contain some typos.
I would strongly suggest reading up on the MVVM pattern and Dependency Injection. There is also always the option of Genesys Developer training.
Regards,
Andrew