Ejemplo n.º 1
0
        public static GuiConnection CreateConnection(string description, string user, string password, string language)
        {
            CSapROTWrapper sapROTWrapper = new CSapROTWrapper();
            object         SapGuilRot    = sapROTWrapper.GetROTEntry("SAPGUI");
            object         engine        = SapGuilRot.GetType().InvokeMember("GetSCriptingEngine", System.Reflection.BindingFlags.InvokeMethod,
                                                                             null, SapGuilRot, null);

            GuiApplication app = (GuiApplication)engine;
            GuiConnection  conn;

            if (app.Connections.Count == 0)
            {
                conn = app.OpenConnection(description);
                GuiSession       session     = conn.Children.ElementAt(0) as GuiSession;
                GuiTextField     name        = (GuiTextField)session.FindById("wnd[0]/usr/txtRSYST-BNAME");
                GuiPasswordField pass        = (GuiPasswordField)session.FindById("wnd[0]/usr/pwdRSYST-BCODE");
                GuiTextField     lang        = (GuiTextField)session.FindById("wnd[0]/usr/txtRSYST-LANGU");
                GuiMainWindow    mainWindows = (GuiMainWindow)session.FindById("wnd[0]");

                name.Text = user;
                pass.Text = password;
                lang.Text = language;
                mainWindows.SendVKey(0);
            }
            else
            {
                conn = (GuiConnection)app.Connections.ElementAt(0);
            }

            return(conn);
        }
Ejemplo n.º 2
0
        public string GetWindowText(string strWindowID)
        {
            GuiSession SapSession = getCurrentSession();
            var        wndWindow  = SapSession.ActiveWindow.FindById(strWindowID, "GuiMainWindow");

            if (wndWindow.Type == "GuiMessageWindow")
            {
                GuiMessageWindow wndMsgWindow = (GuiMessageWindow)wndWindow;
                return(wndMsgWindow.MessageText);
            }
            else if (wndWindow.Type == "GuiFrameWindow")
            {
                GuiFrameWindow wndFrmWindow = (GuiFrameWindow)wndWindow;
                return(wndFrmWindow.AccText);
            }
            else if (wndWindow.Type == "GuiMainWindow")
            {
                GuiMainWindow wndMainWindow = (GuiMainWindow)wndWindow;
                return(wndMainWindow.AccText);
            }
            else if (wndWindow.Type == "GuiModalWindow")
            {
                GuiModalWindow wndMainWindow = (GuiModalWindow)wndWindow;
                return(wndMainWindow.PopupDialogText);
            }
            else
            {
                return("");
            }
        }
 public static T FindDescendantByProperty <T>(this GuiMainWindow MainWindow, Func <T, bool> Property = null)
     where T : class
 {
     if (Property == null)
     {
         Property = new Func <T, bool>(t => true);
     }
     return(findDescendantByPropertyTemplate <T>(MainWindow.Children, Property));
 }
 public static IEnumerable <T> FindAllByName <T>(this GuiMainWindow MainWindow, string Name)
     where T : class
 {
     return(findAllByNameTemplate <T>(Name, MainWindow.FindAllByName));
 }
Ejemplo n.º 5
0
 public static T FindById <T>(this GuiMainWindow MainWindow, string Id)
     where T : class
 {
     return(findByIdTemplate <T>(Id, MainWindow.FindById));
 }
Ejemplo n.º 6
0
 public static T FindByName <T>(this GuiMainWindow MainWindow, string Name)
     where T : class
 {
     return(findByNameTemplate <T>(Name, MainWindow.FindByName));
 }
Ejemplo n.º 7
0
 public static T FindChildByProperty <T>(this GuiMainWindow MainWindow, Func <T, bool> Property = null)
     where T : class
 {
     return(findChildByPropertyTemplate <T>(MainWindow.Children, Property));
 }
 public static T FindByNameEx <T>(this GuiMainWindow MainWindow, string Name, int TypeId)
     where T : class
 {
     return(findByNameExTemplate <T>(Name, TypeId, MainWindow.FindByNameEx));
 }
 public static void SendKey(this GuiMainWindow Window, SAPKeys key)
 {
     Window.SendVKey((int)key);
 }
Ejemplo n.º 10
0
 public static IEnumerable <T> FindDescendantsByProperty <T>(this GuiMainWindow MainWindow, Func <T, bool> Property = null)
     where T : class
 {
     return(findDescendantsByPropertyTemplate <T>(MainWindow.Children, Property));
 }
Ejemplo n.º 11
0
 public void ForwardAllInvocationsTo(GuiMainWindow mainWindow)
 {
     _mainWindow = mainWindow;
 }