Beispiel #1
0
        public static GuiSession NewSession(GuiSession currentSession)
        {
            if (currentSession == null)
            {
                currentSession = GetCurrentSession();
            }

            GuiConnection connection      = SAPGui.GetConnection();
            int           currNumSessions = connection.Children.Count;
            GuiSession    session         = currentSession;

            session.CreateSession();

            System.Threading.Thread.Sleep(500);

            int count = 0;

            while (connection.Children.Count <= currNumSessions && count < 20)
            {
                System.Threading.Thread.Sleep(500);
                count++;
                connection = SAPGui.GetConnection();
            }

            return(connection.Children.ElementAt(connection.Children.Count - 1) as GuiSession);
        }
Beispiel #2
0
        public static GuiSession GetCurrentSession()
        {
            GuiConnection connection = SAPGui.GetConnection();
            GuiSession    session    = connection.Children.ElementAt(0) as GuiSession;

            return(session);
        }
Beispiel #3
0
        public static void KeepOneSessionSAP()
        {
            GuiConnection connection = SAPGui.GetConnection();

            for (int count = connection.Sessions.Count - 1; count > 0; count--)
            {
                connection.CloseSession(connection.Sessions.ElementAt(count).Id);
            }
        }
Beispiel #4
0
        public static void DestroySession(object currentSession)
        {
            GuiConnection connection = SAPGui.GetConnection();

            connection.CloseSession((currentSession as GuiSession).Id);
        }