locked
Unified Service desk - DynamicsBaseHostedControl is not closing RRS feed

  • Question

  • Hi, 

    I have created DynamicsBaseHostedControl and it is global.

    I am trying to close it from one of the method with   this.Close();

    Can anybody suggest me on this.

    Thank you,


    Sreeni Pavalla

    Tuesday, December 23, 2014 10:50 AM

All replies

  • can you try this

    localSessionManager.ActiveSession.AppHost.

    UnloadDynamicApplication()

    OR [if you are sure it's global then use globalsession.]

    localSessionManager.GlobalSession.AppHost.

    UnloadDynamicApplication()

     u need to pass application instance for it which you can get from getapplication.

    Wednesday, December 24, 2014 12:56 PM
  • There is a Close action for all HostedControls (except if it is CCA based controls). Create a new action call for this close and use it with FireRequestAction from any of your other controls/same control to close ...

    If it is CCA based one, 2 ways.

    a) First Create a dummy action (some thing like CloseIt), Override this action in your adapter and use this.Close() to close the application.

    b)Get the IHostedApplication of this application from AppHost and use IhostedApplication.Close() method to close the application.

    Either ways should work for you..

    -Srikanth


    Imposible it self is having Posible.. Dont leave it until you get it..

    Thursday, December 25, 2014 5:03 PM
  • Hi Dilip,

    Yes, That is a global control. I ahve created Custom wpf control and using it as a search control. 

    Once i search i am opening a session. And trying to close. And i have added this control into toolbar to open when user clicks on it.

    To close i have used this as you said i have used 

     localSessionManager.GlobalSession.AppHost.UnloadDynamicApplication(this);

    Now it is closing my control and session is getting opened. If i go click on tool bar again it is not opening that control again as the session is still opened. 

    if i close the session and click on toolbar it is getting opened.

    I am very new to USD. Can you guide me on this.

    Thanks,


    Sreeni Pavalla

    Friday, December 26, 2014 7:50 AM
  • Hi Srikanth,

    As you said , I have tried like this

     var apps = localSessionManager.GlobalSession.AppHost.GetApplications();
                    foreach (var app in apps)
                    {
                        if (app.ApplicationName == "SearchControl")
                        {
                            app.Close();
                        }
                    }
    But it is not closing the Search Control.


    Sreeni Pavalla

    Friday, December 26, 2014 9:05 AM
  • Sreeni I think what you need here is hide and show not to close an reload isn't it ..? if so just fire an action called MoveTopanel on the control with value as "UnkownPanel" to hide and to show fire the sameaction with value "MainPanel"
    Monday, January 5, 2015 10:02 AM
  • Yes.. Global Apps do not "close" as they would in a session.

    the close action on global app hides it.. this is to save on app load times, however it means that your control needs to handle resetting itself to the initial state ( if that's what you want to do ) when shown.

    the easiest way to do that would be to add an action ( say "reset" ) to your control and call it either after you have been closed or just before you open.  By call it I mean add a call to the action from a USD action call.

    Saturday, January 24, 2015 5:41 AM
  • Hi Guys,

    I have a similar problem with my USD hosted control but it is session-based (not global) with initial Display Group set to "UnknownPanel". When I need to display the control I use USD Action to move it to "MainPanel". It is possible for multiple instances of this control running at the same time, one instance for each USD session. Under certain situation I need close the control (remove it from the session) with the following code:

    this.FireRequestAction(new Microsoft.Uii.Csr.RequestActionEventArgs(this.localSession.SessionId.ToString(), "MyUSDHostedControl", "MoveToPanel", "UnknownPanel"));

    The code works but it also hides all other instances as well which is not what I want. It makes no difference even when I am passing in the ssession id. I also tried Close() method but that doesn't do anything. Do you guys have any recommendation? Thanks!


    Ronald


    • Edited by Ronald Liu Tuesday, April 14, 2015 3:27 AM
    Tuesday, April 14, 2015 3:27 AM