Author Topic: Genesys IWS C# extension: programatically open tab  (Read 4040 times)

Offline Gabi

  • Jr. Member
  • **
  • Posts: 64
  • Karma: 0
Genesys IWS C# extension: programatically open tab
« on: December 03, 2014, 12:32:43 PM »
Hello. I am working on an IWS extension and I have created a view and inserted it in a tab within the Workspace region.

Is there any way to make the new tab get focus (and the Workspace region open if it was closed) when receiving a certain event? I mean, is there a way to do it programmatically rather than have the user click buttons manually?

Thank you in advance.

Offline Kubig

  • Hero Member
  • *****
  • Posts: 2752
  • Karma: 44
Re: Genesys IWS C# extension: programatically open tab
« Reply #1 on: December 03, 2014, 12:40:13 PM »
I think, all is possible :) Try to debug, which methods and objects are called/created during the focusing any tab and try to use it within your code-behind. IWS is just an WPF application, so if it is possible in WPF in general, in IWS will be too.

Offline Gabi

  • Jr. Member
  • **
  • Posts: 64
  • Karma: 0
Re: Genesys IWS C# extension: programatically open tab
« Reply #2 on: December 03, 2014, 05:02:37 PM »
Thank you for your reply. That would be a nice thing to be able to do, but I don't have the source for the IWS itself nor its DLLs (other than my own extension), so how can I tell what methods are called when I click on a particular IWS button or focus on a particular tab?
« Last Edit: December 03, 2014, 05:09:56 PM by Gabi »

Offline PeteHoyle

  • Full Member
  • ***
  • Posts: 126
  • Karma: 13
Re: Genesys IWS C# extension: programatically open tab
« Reply #3 on: December 10, 2014, 08:59:45 AM »
Hi,

Try something like this:


[code]        private void ShowTab(string name)
        {

            if (Application.Current.Dispatcher != null && !Application.Current.Dispatcher.CheckAccess())
            {
                Application.Current.Dispatcher.Invoke(DispatcherPriority.Send, new ExecuteDelegate(ShowTab), name);
                return;
            }           

            viewEventManager_.Publish(new GenericEvent()
            {
                Target = GenericContainerView.ContainerView,
                Context = "ToolbarWorkplace",
                Action = new GenericAction[]
{
new GenericAction ()
{
Action = ActionGenericContainerView.ActivateThisPanel,
Parameters = new object[] { name }
}
}
            });
            viewEventManager_.Publish(new GenericEvent()
            {
                Target = GenericContainerView.ContainerView,
                Context = "ToolbarWorksheet",
                Action = new GenericAction[]
                    {
                                    new GenericAction ()
                                    {
                                                    Action = ActionGenericContainerView.ShowHidePanelRight,
                                                    Parameters = new object[] { Visibility.Visible, "MyWorkplaceContainerView" }
                                    },
                                    new GenericAction ()
                                    {
                                                    Action = ActionGenericContainerView.ActivateThisPanel,
                                                    Parameters = new object[] { "MyWorkplaceContainerView" }
                                    }
                    }
            });

        }[/code]

Cheers,

Pete.

Offline abudwill

  • Full Member
  • ***
  • Posts: 157
  • Karma: 4
Re: Genesys IWS C# extension: programatically open tab
« Reply #4 on: December 18, 2014, 08:51:37 PM »
Hi Gabi,

I second Pete's example.  This is how I have "programatically clicked" the tabs in the past.  One of the IWS Extension samples also demonstrates this well.

Regards,
Andrew

Offline Gabi

  • Jr. Member
  • **
  • Posts: 64
  • Karma: 0
Re: Genesys IWS C# extension: programatically open tab
« Reply #5 on: December 29, 2014, 12:41:24 PM »
Thank you very much, PeteHoyle!