public JavaAutomation(IntPtr _rootWindow, string _ApplicationName, AgentDesktopSession _localSession, TraceLogger _LogWriter)
 {
     localSession    = _localSession;
     LogWriter       = _LogWriter;
     ApplicationName = _ApplicationName;
     rootWindow      = _rootWindow;
 }
Esempio n. 2
0
        public UIAutomation(IntPtr _rootWindow, string _ApplicationName, AgentDesktopSession _localSession, TraceLogger _LogWriter)
        {
            localSession    = _localSession;
            LogWriter       = _LogWriter;
            ApplicationName = _ApplicationName;
            rootWindow      = _rootWindow;

            //    this.IsWebApp = false;
            this.MainWindowHandle = (IntPtr)_rootWindow;
            RootAutomationElement = AutomationElement.FromHandle(this.MainWindowHandle);
            AutomationProperties  = UIAHelperMethods.GetAutomationElementIdentifiers();
            UIAHelperMethods.UpdateControlTypeNames();
            AutomationPropReturnTypes = UIAHelperMethods.GetAutomationReturnTypes();
            AutomationEventList       = UIAHelperMethods.GetAutomationEventList();
        }
        /// <summary>
        /// This event is raised when a session is closed.
        /// in the case there is an Active call, the desktop manager can get in the way of the session close event
        ///    and determine if any action needs to be taken.
        /// For example, writing a Call Wrap Event to an Audit log
        /// </summary>
        /// <param name="session">Session that is being closed. </param>
        /// <returns>True allows the session to close,  false prevents the session from closing</returns>
        private bool localSessionManager_SessionCloseEvent(Session session)
        {
            try
            {
                if (session != null)
                {
                    // Blocking Command here
                    // Get a copy of the current session.
                    AgentDesktopSession aSess = (AgentDesktopSession)session;
                    // Get a handle to the Context that is in that session
                    Context lastSessionClosedContext = aSess.AppHost.GetContext();

                    // if there is a call on this session
                    if (aSess.CtiCallRefId != Guid.Empty)
                    {
                        // Check to see if there is a secondary call on the same session.
                        if (aSess.CtiCallRefIdChat != Guid.Empty)
                        {
                            // if they are equivalent, they it is the same call.
                            if (aSess.CtiCallRefIdChat != aSess.CtiCallRefId)
                            {
                                // if not,
                                //   we may need to trigger a hang-up event for both the child and the parent Calls.
                                // So here,  Issue a Hang-up event
                                CallStateManager.HangUpCall(aSess.CtiCallRefIdChat);
                            }
                        }
                        // Now issue the Hang-up event to the primary call
                        CallStateManager.HangUpCall(aSess.CtiCallRefId);
                    }
                }
            }
            catch (Exception ex)
            {
                // write a log event here.
            }
            return(true);
        }