Exemplo n.º 1
0
        void ITestModule.Run()
        {
            Mouse.DefaultMoveTime        = 1;
            Keyboard.DefaultKeyPressTime = 5;
            Delay.SpeedFactor            = 1.0;
            string programLog = GlobalFunction.GetConfigSettings("EnableErrorLog");
            string dbVersion  = "v" + WinComponent.sxDBVersion; //GlobalFunction.GetConfigSettings("DBVersion");
            string rxVersion  = Ranorex.Host.Local.RanorexVersion;

            rxVersion = rxVersion.Remove(rxVersion.Length - 2);
            string executionTime = GlobalFunction.ExecutionTime();
            string logFilename   = "";

            if (programLog == "true")
            {
                logFilename = @"Logs\System-XAuto-Test - EventLog_" + executionTime.Replace("-", String.Empty).Replace(":", String.Empty).Replace(" ", String.Empty) + ".htm";
                System.IO.File.WriteAllText(logFilename, System.IO.File.ReadAllText("Logs\\System-XAuto-Test - EventLog.htm"));
                System.IO.File.WriteAllText(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\AppEvent.log", logFilename);
                GlobalFunction.WriteReportHeaderInfo(logFilename, "%Version%", WinComponent.GetAppInfo("Version"));
                GlobalFunction.WriteReportHeaderInfo(logFilename, "%BuildDate%", WinComponent.GetAppInfo("BuildDate"));
                GlobalFunction.WriteReportHeaderInfo(logFilename, "%DBVersion%", dbVersion);
                GlobalFunction.WriteReportHeaderInfo(logFilename, "%RXVersion%", rxVersion);
            }

            //bool dbcheck = MySQLConnector.CheckDbConnection();

            /*bool dbcheck = true;
             *
             * if (dbcheck)
             * {
             *  if (!GlobalFunction.IsConfigFileOK())
             *  {
             *          GlobalFunction.ShowMessage("Feil på config-fil. Sjekk opsjoner eller logfil for mer informasjon.", MessageBoxIcon.Warning);
             *          if (programLog == "true") {Process.Start(logFilename);}
             *          dbcheck = false;
             *  }
             * }
             *
             * SystemXTest.WinComponent Component = new SystemXTest.WinComponent(dbcheck);
             *  Component.InitializeComponent(dbcheck);*/
            if (!GlobalFunction.IsConfigFileOK())
            {
                GlobalFunction.ShowMessage("Feil på config-fil. Sjekk opsjoner eller logfil for mer informasjon.", MessageBoxIcon.Exclamation);
                if (programLog == "true")
                {
                    Process.Start(logFilename);
                }
            }
            else
            {
                //bool dbcheck = MySQLConnector.CheckDbConnection();
                SystemXTest.WinComponent Component = new SystemXTest.WinComponent();
                Component.InitializeComponent();
            }
        }
Exemplo n.º 2
0
        public static bool Check(WinComponent component)
        {
            if (!component.Class.ToLower().Contains("button"))
            {
                return(false);
            }
            int style           = component.Style;
            int BS_TYPEMASK     = 0x0000000F;
            int BS_CHECKBOX     = 0x2;
            int BS_AUTOCHECKBOX = 0x3;

            style = style & BS_TYPEMASK;
            return(style == BS_AUTOCHECKBOX || style == BS_CHECKBOX);
        }
Exemplo n.º 3
0
        public static bool Check(WinComponent component)
        {
            if (!component.Class.ToLower().Contains("button"))
            {
                return(false);
            }
            int style              = component.Style;
            int BS_TYPEMASK        = 0x0000000F;
            int BS_RADIOBUTTON     = 0x0004;
            int BS_AUTORADIOBUTTON = 0x0009;

            style = style & BS_TYPEMASK;
            return(style == BS_RADIOBUTTON || style == BS_AUTORADIOBUTTON);
        }
Exemplo n.º 4
0
        private static WinComponent FromHandle(IntPtr hwndCur)
        {
            var chArWindowClass = new StringBuilder(257);

            PInvoke.GetClassName(hwndCur, chArWindowClass, 256);
            var strWndClass = chArWindowClass.ToString();

            var length = PInvoke.GetWindowTextLength(hwndCur);
            var sb     = new StringBuilder(length + 1);

            PInvoke.GetWindowText(hwndCur, sb, sb.Capacity);

            PInvoke.RECT rct;
            PInvoke.GetWindowRect(hwndCur, out rct);

            var style = PInvoke.GetWindowLong(hwndCur, PInvoke.GWL_STYLE);
            var res   = new WinComponent(strWndClass, sb.ToString(), hwndCur, rct.Left, rct.Top, style);

            return(res);
        }
Exemplo n.º 5
0
 static WinceComponent FromWinComponent(WinComponent c)
 {
     if (WinceComboBox.Check(c))
     {
         return(new WinceComboBox(c.Handle));
     }
     else if (WinceButton.Check(c))
     {
         return(new WinceButton(c.Handle));
     }
     else if (WinceCheckBox.Check(c))
     {
         return(new WinceCheckBox(c.Handle));
     }
     else if (WinceTextBox.Check(c))
     {
         return(new WinceTextBox(c.Handle));
     }
     else if (WinceLabel.Check(c))
     {
         return(new WinceLabel(c.Handle));
     }
     else if (WinceRadio.Check(c))
     {
         return(new WinceRadio(c.Handle));
     }
     else if (WinceListBox.Check(c))
     {
         return(new WinceListBox(c.Handle));
     }
     else if (WinceContainer.Check(c))
     {
         return(new WinceContainer(c.Handle));
     }
     else
     {
         throw new NotImplementedException(string.Format("handle {0:X} unsupported", c.Handle));
     }
 }
Exemplo n.º 6
0
 public static bool Check(WinComponent c)
 {
     return(c.Class.ToLower().Equals("static"));
 }
Exemplo n.º 7
0
 public static bool Check(WinComponent e)
 {
     return(e.Class.ToLower().Contains("button") && !WinceCheckBox.Check(e) && !WinceRadio.Check(e));
 }
Exemplo n.º 8
0
 public static bool Check(WinComponent c)
 {
     return(c.Class.ToLower().Contains("listbox"));
 }
Exemplo n.º 9
0
 private static Boolean isButton(WinComponent e)
 {
     return(e.Class.ToLower().Contains("button") && !isCheckBox(e) && !isRadio(e));
 }
Exemplo n.º 10
0
 private static bool isTextBox(WinComponent e)
 {
     return(e.Class.ToLower().Contains("edit"));
 }
Exemplo n.º 11
0
 private bool isLabel(WinComponent c)
 {
     return(c.Class.ToLower().Equals("static"));
 }
Exemplo n.º 12
0
 private bool isContainer(WinComponent c)
 {
     return(c.Class.ToLower().Equals("#netcf_agl_base_"));
 }