Пример #1
0
        public SessIdMessage StopCloseIntercept()
        {
            SessIdMessage msg = null;

            if (this.InterceptIsStarted == true)
            {
                var rc = Ehllapier.StopCloseIntercept(this.SessId);
                if (rc == 0)
                {
                    msg = new SessIdMessage()
                    {
                        SessId  = this.SessId,
                        Message = "Close intercept is stopped."
                    };
                    this.InterceptIsStarted = false;
                }

                else
                {
                    msg = new SessIdMessage()
                    {
                        SessId  = this.SessId,
                        Message = "StopCloseIntercept failed. rc:" + rc
                    };
                }
            }

            return(msg);
        }
Пример #2
0
        public MasterSessionItem(string SessId)
            : this()
        {
            this.SessId = SessId;

            this.WindowText = HostAccess.GetSessionTitle(SessId);
            this.hSessWnd   = HostAccess.GetSessionHwnd(SessId);

            var sa = Ehllapier.QuerySessionStatus(this.SessId);

            this.LongName = sa.LongName;
        }
Пример #3
0
        public static void StopHostNotification(this CloseInterceptItem SessionItem)
        {
            if (SessionItem.HostInterceptIsStarted == false)
            {
                throw new ApplicationException("Host notification is not started");
            }

            Ehllapier.StopHostNotification(SessionItem.SessId);

            SessionItem.HostTaskId             = 0;
            SessionItem.HostInterceptIsStarted = false;
        }
Пример #4
0
        public static void StartHostIntercept(this CloseInterceptItem SessionItem, IntPtr hWnd)
        {
            if (SessionItem.HostInterceptIsStarted == true)
            {
                throw new ApplicationException("Host notification is already started.");
            }

            var taskId = Ehllapier.StartHostNotification(SessionItem.SessId, hWnd);

            if (taskId != 0)
            {
                SessionItem.HostTaskId             = taskId;
                SessionItem.HostInterceptIsStarted = true;
            }
        }
Пример #5
0
 public void StartCloseIntercept(IntPtr hRequestWnd)
 {
     try
     {
         var taskId = Ehllapier.StartCloseIntercept(this.SessId, hRequestWnd);
         this.InterceptIsStarted = true;
         this.ErrorText          = null;
         this.TaskId             = taskId;
     }
     catch (ApplicationException Excp)
     {
         this.InterceptIsStarted = false;
         this.ErrorText          = Excp.Message;
     }
 }
Пример #6
0
        private void SessionTester( )
        {
            var ehSettings = EhllapiSettings.RecallSettings();

            // make sure the session is active.
            SessionScript.Assure_ClientAccessSession(ehSettings);

            // bring the 5250 window to the foreground.
            Ehllapier.SetForegroundWindow(ehSettings.SessId);

            // make sure signed on.
            if (SignonScreen.IsScreen(ehSettings))
            {
                var script = new SessionScript();
                script.Play_Signon(ehSettings);
            }

            // in the strseu screen. Exit back to presumably wrkmbrpdm.
            if (StrseuScreen.EditScreen.IsScreen(ehSettings))
            {
                StrseuScreen.EditScreen.F3_Exit(ehSettings);

                if (StrseuScreen.ExitScreen.IsScreen(ehSettings))
                {
                    StrseuScreen.ExitScreen.Enter(ehSettings);
                }
            }

            // in the seu browse screen. press enter to exit.
            if (StrseuScreen.BrowseScreen.IsScreen(ehSettings))
            {
                StrseuScreen.BrowseScreen.Enter_Exit(ehSettings);
            }

            using (DisplaySession sess = new DisplaySession())
            {
                bool isScreen = false;
                sess.Connect(ehSettings.SessId);

                // display messages. press enter.
                if (DisplayMessagesScreen.IsScreen(sess))
                {
                    sess.SendKeys(KeyboardKey.Enter);
                }
            }
        }
        public SessIdMessage StopNotification()
        {
            SessIdMessage msg = null;

            if (this.NotificationIsStarted == true)
            {
                string errmsg = null;
                try
                {
                    Ehllapier.StopHostNotification(this.SessId);
                }
                catch (ApplicationException Excp)
                {
                    errmsg = Excp.Message;
                }
                if (errmsg == null)
                {
                    msg = new SessIdMessage()
                    {
                        SessId  = this.SessId,
                        Message = "Host notification is stopped."
                    };
                    this.NotificationIsStarted = false;
                }

                else
                {
                    msg = new SessIdMessage()
                    {
                        SessId  = this.SessId,
                        Message = "StopCapture failed. " + errmsg
                    };
                }
            }

            return(msg);
        }
        /// <summary>
        /// build MasterSessionList containing an iterm for each ehllapi session.
        /// </summary>
        public List <ActionItem <MasterSessionItem> > RefreshList()
        {
            var actionList = new List <ActionItem <MasterSessionItem> >();

            // first, build a new list from QuerySessionList output.
            var tempList = new MasterSessionList();

            {
                foreach (var si in pcsapi.QuerySessionList())
                {
                    var item = new MasterSessionItem(si);
                    tempList.Add(item);

                    // get the session long name.
                    var sa = Ehllapier.QuerySessionStatus(item.SessId);
                    item.LongName = sa.LongName;
                }
            }

            // using the list of sessions,

            // mark as IsEnded all the actual list items not found in the temp list.
            {
                List <MasterSessionItem> endedList = new List <MasterSessionItem>();
                foreach (var item in this)
                {
                    if (item.IsEnded == false)
                    {
                        var found = tempList.FirstOrDefault(c => c.SessId == item.SessId);
                        if (found == null)
                        {
                            item.IsEnded = true;
                            ChangedSignal.Set();
                        }
                    }
                }
            }

            // mark as IsEnded any matching SessId items where the hWnd is different.
            foreach (var item in tempList)
            {
                var found = this.FirstOrDefault(
                    c => c.SessId == item.SessId && c.hSessWnd != item.hSessWnd &&
                    c.IsEnded == false);
                if (found == null)
                {
                    item.IsEnded = true;
                    ChangedSignal.Set();
                }
            }

            // add new temp list items to actual list.
            foreach (var item in tempList)
            {
                var found = this.FirstOrDefault(c => c.SessId == item.SessId && c.IsEnded == false);
                if (found == null)
                {
                    var newItem = new MasterSessionItem(item);
                    this.Add(newItem);
                    ChangedSignal.Set();
                    actionList.Add(new ActionItem <MasterSessionItem>(ActionCode.Add, newItem));
                }
            }

            // change any items with a different window text.
            foreach (var item in this)
            {
                if (item.IsEnded == false)
                {
                    var found = tempList.FirstOrDefault(
                        c => c.SessId == item.SessId && c.WindowText != item.WindowText);
                    if (found != null)
                    {
                        item.WindowText = found.WindowText;
                        ChangedSignal.Set();
                        actionList.Add(new ActionItem <MasterSessionItem>(ActionCode.Change, item));
                    }
                }
            }

            return(actionList);
        }