/// <summary>
        /// send keystrokes intended to signoff the display session to the Settings.SessId
        /// identified display session window.
        /// </summary>
        /// <param name="InSess"></param>
        public void Play_Signoff(DisplaySession InSess)
        {
            while (true)
            {
                PresentationSpace          ps  = InSess.GetPresentationSpace();
                CommonScreens.SignonScreen sos = new CommonScreens.SignonScreen(ps);
                if (sos.IsScreen( ))
                {
                    throw new EhllapiExcp("At signon screen. cant signoff from this screen.");
                }

                InSess.SendKeys(Ehllapier.Key.SystemRequest + Ehllapier.Key.Enter);
                InSess.Wait();

                ps = InSess.GetPresentationSpace();
                var sysrqs = new CommonScreens.SystemRequestMenuScreen(ps);
                if (sysrqs.IsScreen( ))
                {
                    break;
                }
            }

            InSess.SendKeys("90" + Ehllapier.Key.Enter);
            InSess.Wait();

            // signoff prompt
            InSess.SendKeys(Ehllapier.Key.Enter);
            InSess.Wait();

            return;

            InSess.SendKeys(Ehllapier.Key.SystemRequest + "90" + Ehllapier.Key.Enter);
            Play_Signoff_WaitUntilSignedOff(InSess);
        }
 private void Play_Signoff_WaitUntilSignedOff(DisplaySession InSess)
 {
     while (true)
     {
         InSess.Wait( );
         PresentationSpace          ps  = InSess.GetPresentationSpace();
         CommonScreens.SignonScreen sos = new CommonScreens.SignonScreen(ps);
         if (sos.IsScreen( ))
         {
             break;
         }
         Thread.Sleep(1);
     }
 }
        /// <summary>
        /// Scrape the screen to determine if the Samuel signon screen is displayed.
        /// </summary>
        /// <param name="InSess"></param>
        /// <returns></returns>
        public bool IsAtxSignon(DisplaySession InSess)
        {
            PresentationSpace ps = null;

            ps = InSess.GetPresentationSpace();
            if ((ps.IndexOf("Sign On") != null) &&
                (ps.IndexOf("User  . . .") != null) &&
                (ps.IndexOf("Password  .") != null))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public static PresentationSpace ReadPresentationSpace(
            EhllapiSettings InSettings)
        {
            PresentationSpace ps = null;

            try
            {
                using (DisplaySession sess = new DisplaySession())
                {
                    sess.Connect(InSettings.SessId);

                    ps = sess.GetPresentationSpace();
                }
            }
            catch (ApplicationException excp)
            {
                throw new EhllapiExcp("ReadPresentationSpace failed", excp);
            }
            return(ps);
        }
        public void AssureSignoff(EhllapiSettings Settings)
        {
            SessionScript script = new SessionScript();

            try
            {
                using (DisplaySession sess = new DisplaySession())
                {
                    sess.Connect(Settings.SessId);
                    var sos = new CommonScreens.SignonScreen(sess.GetPresentationSpace( ));
                    if (sos.IsScreen( ) == true)
                    {
                        Play_Signoff(sess);
                    }
                }
            }
            catch (ApplicationException excp)
            {
                throw new EhllapiExcp("AssureSignoff failed. " + excp.Message, excp);
            }
        }