예제 #1
0
        /// <summary>
        /// Auto answer the abort window in all the versions
        /// </summary>
        public void CloseAbortQuestionWindow()
        {
            IntPtr abortWindow  = IntPtr.Zero;
            IntPtr abortYeshWnd = IntPtr.Zero;

            if (version != VERSION.POST_E8285)
            {
                abortWindow = AppManipulation.FindWindowByWindowName("Abort Testing for System 1");
                if (abortWindow != IntPtr.Zero)
                {
                    abortYeshWnd = AppManipulation.FindChildWindowByWindowName(abortWindow, "&Yes");
                }
            }
            else
            {
                abortWindow = AppManipulation.FindWindowByWindowName("Stop the Test");
                if (abortWindow == IntPtr.Zero)
                {
                    abortWindow = AppManipulation.FindWindowByWindowName("Exit PoST");
                }
                if (abortWindow != IntPtr.Zero)
                {
                    abortYeshWnd = AppManipulation.FindChildWindowByWindowName(abortWindow, "&Yes");
                }
            }
            if (abortYeshWnd != IntPtr.Zero)
            {
                AppManipulation.SendClickToWindow(abortYeshWnd);
                abortRequested = false;
            }
        }
예제 #2
0
 /// <summary>
 /// Stop the required processes
 /// </summary>
 /// <param name="processesToStop">List of processes to stop</param>
 private void StopProcesses(ArrayList processesToStop)
 {
     ProgressItemCount = 0;
     foreach (string process in processesToStop)
     {
         this.onCurrentActivityChanged("Deteniendo " + process);
         ProgressItemCount++;
         this.calculateProgress(CurrentStepNumber, processesToStop.Count, ProgressItemCount);
         foreach (Process myProc in Process.GetProcesses())
         {
             try
             {
                 if (myProc.ProcessName == process)
                 {
                     myProc.Kill();
                 }
                 Console.WriteLine("{0} {1}", process, "closed");
             }
             catch
             {
             }
         }
     }
     Thread.Sleep(1000);
     AppManipulation.RefreshTrayArea();
 }
예제 #3
0
 private void GetBtnHwnds()
 {
     if (version != VERSION.NONE)
     {
         if (version != VERSION.POST_E8285)
         {
             IntPtr stopContainer = AppManipulation.FindChildWindowByClassNameByIndex(wtmHwnd, "WindowsForms10.Window.8.app3", 10);
             stopBtnHwnd         = AppManipulation.FindChildWindowByWindowName(stopContainer, "Stop Test Plan");
             viewTestCondBtnHwnd = AppManipulation.FindChildWindowByWindowName(stopContainer, "View Test Conditions");
             runBtnHwnd          = AppManipulation.FindChildWindowByWindowName(stopContainer, "Run Test Plan");
         }
         else
         {
             IntPtr mdi  = IntPtr.Zero;
             IntPtr pew  = IntPtr.Zero;
             IntPtr tabs = IntPtr.Zero;
             IntPtr cont = IntPtr.Zero;
             mdi = AppManipulation.FindChildWindowByClassName(wtmHwnd, "MDI Client");
             if (mdi != IntPtr.Zero)
             {
                 pew = AppManipulation.FindChildWindowByWindowName(mdi, "PoST Executive Window");
             }
             if (pew != IntPtr.Zero)
             {
                 tabs = AppManipulation.FindChildWindowByClassNameByIndex(pew, "SSTabCtlWndClass", 3);
             }
             if (tabs != IntPtr.Zero)
             {
                 cont = AppManipulation.FindChildWindowByWindowName(tabs, "Test Control");
             }
             runBtnHwnd  = AppManipulation.FindChildWindowByWindowName(cont, "&Start Test");
             stopBtnHwnd = AppManipulation.FindChildWindowByWindowName(cont, "&Stop Testing");
         }
     }
 }
예제 #4
0
 public void RunTest()
 {
     GetBtnHwnds();
     if (version != VERSION.NONE)
     {
         AppManipulation.FocusOnWindow(mainHWnd);
         AppManipulation.SendClickToWindow(runBtnHwnd);
     }
 }
예제 #5
0
 private void SendAbortTestCommand()
 {
     if (version != VERSION.NONE)
     {
         GetBtnHwnds();
         Console.WriteLine("WirelessTestManager.cs - Abort test command sent");
         AppManipulation.SendClickToWindow(stopBtnHwnd);
     }
 }
예제 #6
0
 public void RunTest()
 {
     abortRequested = false;
     GetBtnHwnds();
     if (version != VERSION.NONE)
     {
         this.activity = WTM_ACTIVITY.TEST_FINISHED;
         Thread.Sleep(1000);
         AppManipulation.FocusOnWindow(wtmHwnd);
         AppManipulation.SendClickToWindow(runBtnHwnd);
     }
 }
예제 #7
0
        private void CloseWrongDatabaseWindow()
        {
            IntPtr errorWindow        = IntPtr.Zero;
            IntPtr errorWindowYeshWnd = IntPtr.Zero;

            if (version != VERSION.POST_E8285)
            {
                errorWindow = AppManipulation.FindWindowByWindowName("Incorrect Database Found");
                if (errorWindow != IntPtr.Zero)
                {
                    errorWindowYeshWnd = AppManipulation.FindChildWindowByWindowName(errorWindow, "&Yes");
                }
                if (errorWindowYeshWnd != IntPtr.Zero)
                {
                    AppManipulation.SendClickToWindow(errorWindowYeshWnd);
                }
            }
        }
예제 #8
0
        private void LoadVersionAndState()
        {
            //NOT USED ANYMORE
            STATE        currentState    = state;
            VERSION      currentVersion  = version;
            WTM_ACTIVITY currentActivity = activity;
            string       currentTestplan = string.Empty;

            //Check if Wtm is open
            mainHWnd = AppManipulation.FindWindowByClassName("WindowsForms10.Window.8.app3");

            //Set version
            if (mainHWnd != IntPtr.Zero)
            {
                wtmHwnd = AppManipulation.FindWindowByWindowName("E6567C Agilent cdma2000/IS-95/AMPS/1xEV-DO Wireless Test Manager");
                if (wtmHwnd != IntPtr.Zero)
                {
                    version = VERSION.AGILENT_E6567;
                }
                if (wtmHwnd == IntPtr.Zero)
                {
                    wtmHwnd = AppManipulation.FindWindowByWindowName("Agilent E6567D cdma2000/IS-95/AMPS/1xEV-DO/LTE Wireless Test Manager");
                    if (wtmHwnd != IntPtr.Zero)
                    {
                        version = VERSION.AGILENT_E6567;
                    }
                }
                if (wtmHwnd == IntPtr.Zero)
                {
                    wtmHwnd = AppManipulation.FindWindowByWindowName("Agilent E6567E cdma2000/IS-95/AMPS/1xEV-DO/LTE Wireless Test Manager");
                    if (wtmHwnd != IntPtr.Zero)
                    {
                        version = VERSION.AGILENT_E6567;
                    }
                }
                if (wtmHwnd == IntPtr.Zero)
                {
                    wtmHwnd = AppManipulation.FindWindowByWindowName("Agilent E6560C cdma2000/IS-95/AMPS Wireless Test Manager");
                    if (wtmHwnd != IntPtr.Zero)
                    {
                        version = VERSION.AGILENT_E6560;
                    }
                }
                if (wtmHwnd == IntPtr.Zero)
                {
                    wtmHwnd = AppManipulation.FindWindowByWindowName("Agilent E6568C WCDMA/GSM/GPRS/EGPRS Wireless Test Manager");
                    if (wtmHwnd != IntPtr.Zero)
                    {
                        version = VERSION.AGILENT_E6568;
                    }
                }
                if (wtmHwnd == IntPtr.Zero)
                {
                    wtmHwnd = AppManipulation.FindWindowByWindowName("Agilent E6568E WCDMA/GSM/GPRS/EGPRS/LTE Wireless Test Manager");
                    if (wtmHwnd != IntPtr.Zero)
                    {
                        version = VERSION.AGILENT_E6568;
                    }
                }
            }
            else
            {
                wtmHwnd  = AppManipulation.FindWindowByWindowName("PoST- 8924C/E & E8285A CDMA Mobile Tests");
                mainHWnd = wtmHwnd;
                if (wtmHwnd != IntPtr.Zero)
                {
                    version = VERSION.POST_E8285;
                }
            }

            //Set state
            if (mainHWnd != IntPtr.Zero)
            {
                if (wtmHwnd != IntPtr.Zero)
                {
                    state = STATE.OPEN;
                }
                else
                {
                    state = STATE.OPENING;
                }
            }
            else
            {
                state = STATE.CLOSED;
            }

            //Set current wtm activity
            if (mainHWnd != IntPtr.Zero && state == STATE.OPEN && version != VERSION.NONE)
            {
                if (version != VERSION.POST_E8285)
                {
                    try
                    {
                        #region Set the activity for the Wtm versions
                        if (this.gettingStatus)
                        {
                            if (!AppManipulation.IsWindowMinimized(wtmHwnd))
                            {
                                //Get all the handlers for all the Wtm versions
                                int ContainerCount = AppManipulation.FindChildWindowCountByClassName(mainHWnd, "WindowsForms10.Window.8.app3");
                                if (ContainerCount > 0)
                                {
                                    ContainerCount = (ContainerCount > 30) ? 30 : ContainerCount;
                                    activity       = WTM_ACTIVITY.NONE;
                                    string[] captions;
                                    bool     somethingFound = false;
                                    for (int j = ContainerCount - 3; j < ContainerCount; j++)
                                    {
                                        IntPtr statusContainer = AppManipulation.FindChildWindowByClassNameByIndex(mainHWnd, "WindowsForms10.Window.8.app3", j);//27
                                        if (statusContainer != IntPtr.Zero)
                                        {
                                            int count = AppManipulation.FindChildWindowCountByClassName(statusContainer, "WindowsForms10.msctls_statusbar32.app3");//6 o 7

                                            for (int i = 6; i < count; i++)
                                            {
                                                IntPtr statusPtr = AppManipulation.FindChildWindowByClassNameByIndex(statusContainer, "WindowsForms10.msctls_statusbar32.app3", i);
                                                if (statusPtr != IntPtr.Zero)
                                                {
                                                    Valutech.IO.StatusBar status = new Valutech.IO.StatusBar(statusPtr);
                                                    captions = status.Captions;
                                                    if (captions.Length > 1)
                                                    {
                                                        string statusText = captions[1];
                                                        if (statusText != string.Empty)
                                                        {
                                                            somethingFound = true;
                                                            if (activity == WTM_ACTIVITY.NONE)
                                                            {
                                                                if (statusText == "	")
                                                                {
                                                                    activity = WTM_ACTIVITY.FIRST_TIME_START;
                                                                }
                                                                Regex regex = new Regex("Performing CDMAVoiceQuality . . .|Performing GSMMobileInitiatedCall . . .");
                                                                if (regex.IsMatch(statusText))
                                                                {
                                                                    activity = WTM_ACTIVITY.CHECKING_VOICE_QUALITY;
                                                                }
                                                                regex = new Regex("Performing CDMAPage . . .");
                                                                if (regex.IsMatch(statusText))
                                                                {
                                                                    activity = WTM_ACTIVITY.PERFORMING_CDMA_PAGE;
                                                                }
                                                                regex = new Regex("Performing WCDMAOrigination . . .");
                                                                if (regex.IsMatch(statusText))
                                                                {
                                                                    activity = WTM_ACTIVITY.PERFORMING_CDMA_PAGE;
                                                                }
                                                                regex = new Regex("Passed = [0-9]{1,}[ ]{1,}Failed = [0-9]{1,}|Test Plan Aborted");
                                                                if (regex.IsMatch(statusText))
                                                                {
                                                                    activity = WTM_ACTIVITY.TEST_FINISHED;
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                    if (somethingFound && activity == WTM_ACTIVITY.NONE)
                                    {
                                        activity = WTM_ACTIVITY.TESTING;
                                    }
                                }

                                //Get the testplan directly from window
                                int comboboxCount = AppManipulation.FindChildWindowCountByClassName(mainHWnd, "WindowsForms10.COMBOBOX.app3");
                                if (comboboxCount > 0)
                                {
                                    IntPtr comboBoxItem  = IntPtr.Zero;
                                    int    windowsNumber = 15;
                                    while (comboBoxItem == IntPtr.Zero && windowsNumber < 18)
                                    {
                                        comboBoxItem    = AppManipulation.FindChildWindowByClassNameByIndex(mainHWnd, "WindowsForms10.COMBOBOX.app3", windowsNumber);
                                        currentTestplan = AppManipulation.GetText(comboBoxItem);
                                        windowsNumber++;
                                    }
                                }
                            }
                        }
                        else
                        {
                            //AppManipulation.WriteInNotepad("Not getting status");
                        }
                        #endregion
                    }
                    catch { }
                }
                else
                {
                    try
                    {
                        #region Set the activity for the 8285 equipment

                        IntPtr statusContainer = AppManipulation.FindWindowByWindowName("PoST Operator Instructions");
                        if (statusContainer != IntPtr.Zero)
                        {
                            IntPtr statusPtr = AppManipulation.FindChildWindowByClassName(statusContainer, "RichTextWndClass");
                            if (statusPtr != IntPtr.Zero)
                            {
                                string caption = AppManipulation.GetText(statusPtr);
                                if (caption != String.Empty)
                                {
                                    activity = WTM_ACTIVITY.PERFORMING_CDMA_PAGE;
                                    Regex regex = new Regex("Waiting for operator to answer call");
                                    if (regex.IsMatch(caption))
                                    {
                                        activity = WTM_ACTIVITY.WAITING_TO_ANSWER_CALL;
                                    }
                                    regex = new Regex("Speak into the phone");
                                    if (regex.IsMatch(caption))
                                    {
                                        activity = WTM_ACTIVITY.CHECKING_VOICE_QUALITY;
                                    }
                                }
                            }
                        }
                        else
                        {
                            if (currentActivity != WTM_ACTIVITY.WAITING_TO_ANSWER_CALL)
                            {
                                GetBtnHwnds();
                                if (stopBtnHwnd != IntPtr.Zero)
                                {
                                    if (AppManipulation.IsWindowVisible(stopBtnHwnd))
                                    {
                                        activity = WTM_ACTIVITY.TESTING;
                                    }
                                    else
                                    {
                                        activity = WTM_ACTIVITY.TEST_FINISHED;
                                    }
                                }
                            }
                            else
                            {
                                activity = currentActivity;
                            }
                        }

                        #endregion
                    } catch { }
                }
            }
            else
            {
                stopBtnHwnd = IntPtr.Zero;
                runBtnHwnd  = IntPtr.Zero;
            }

            //Send events depending on the change
            if (currentState != state)
            {
                if (StateChanged != null)
                {
                    StateChanged(this, EventArgs.Empty);
                }
            }
            if (currentActivity != activity)
            {
                if (ActivityChanged != null)
                {
                    ActivityChanged(this, EventArgs.Empty);
                }
            }
            if (currentVersion != version)
            {
                if (VersionChanged != null)
                {
                    VersionChanged(this, EventArgs.Empty);
                }
            }
            if (currentTestplan != testplan && currentState == STATE.OPEN && !currentTestplan.Contains("Data terminal ready:") && currentTestplan != string.Empty)
            {
                testplan = currentTestplan;
                if (TestplanChanged != null)
                {
                    TestplanChanged(testplan);
                }
            }
        }
예제 #9
0
        private void LoadVersionAndState()
        {
            STATE        currentState    = state;
            VERSION      currentVersion  = version;
            WTM_ACTIVITY currentActivity = activity;
            string       currentTestplan = testplan;

            //Check if Wtm is open
            mainHWnd = AppManipulation.FindWindowByClassName("WindowsForms10.Window.8.app3");

            //Set version
            if (mainHWnd != IntPtr.Zero)
            {
                string wName = AppManipulation.GetWindowName(mainHWnd);
                wtmHwnd = mainHWnd;
                if (wName.IndexOf("E6560") > -1)
                {
                    version = VERSION.AGILENT_E6560;
                }
                else if (wName.IndexOf("E6567") > -1)
                {
                    version = VERSION.AGILENT_E6567;
                }
                else if (wName.IndexOf("E6568") > -1)
                {
                    version = VERSION.AGILENT_E6568;
                }

                //Get the testplan directly from window
                bool next = false;
                foreach (IntPtr hWnd in AppManipulation.GetChildWindows(mainHWnd))
                {
                    if (next == true)
                    {
                        if (currentState == STATE.OPEN)
                        {
                            this.testplan = AppManipulation.GetText(hWnd);
                        }
                        next = false;
                    }
                    if (AppManipulation.GetText(hWnd).IndexOf("DUT serial number") > -1)
                    {
                        next = true;
                    }
                }
            }
            else
            {
                wtmHwnd  = AppManipulation.FindWindowByWindowName("PoST- 8924C/E & E8285A CDMA Mobile Tests");
                mainHWnd = wtmHwnd;
                if (wtmHwnd != IntPtr.Zero)
                {
                    version = VERSION.POST_E8285;
                }
            }

            //Set state
            if (mainHWnd != IntPtr.Zero)
            {
                if (wtmHwnd != IntPtr.Zero)
                {
                    state = STATE.OPEN;
                }
                else
                {
                    state = STATE.OPENING;
                }
            }
            else
            {
                state = STATE.CLOSED;
            }

            //Set current wtm activity
            if (mainHWnd != IntPtr.Zero && state == STATE.OPEN && version != VERSION.NONE)
            {
                if (version != VERSION.POST_E8285)
                {
                    try
                    {
                        #region Set the activity for the Wtm versions
                        if (this.gettingStatus)
                        {
                            if (!AppManipulation.IsWindowMinimized(wtmHwnd))
                            {
                                //Get all the handlers for all the Wtm versions
                                int ContainerCount = AppManipulation.FindChildWindowCountByClassName(mainHWnd, "WindowsForms10.Window.8.app3");
                                if (ContainerCount > 0)
                                {
                                    ContainerCount = (ContainerCount > 30) ? 30 : ContainerCount;
                                    activity       = WTM_ACTIVITY.NONE;
                                    string[] captions;
                                    bool     somethingFound = false;
                                    for (int j = ContainerCount - 3; j < ContainerCount; j++)
                                    {
                                        IntPtr statusContainer = AppManipulation.FindChildWindowByClassNameByIndex(mainHWnd, "WindowsForms10.Window.8.app3", j);//27
                                        if (statusContainer != IntPtr.Zero)
                                        {
                                            int count = AppManipulation.FindChildWindowCountByClassName(statusContainer, "WindowsForms10.msctls_statusbar32.app3");//6 o 7

                                            for (int i = 6; i < count; i++)
                                            {
                                                IntPtr statusPtr = AppManipulation.FindChildWindowByClassNameByIndex(statusContainer, "WindowsForms10.msctls_statusbar32.app3", i);
                                                if (statusPtr != IntPtr.Zero)
                                                {
                                                    Valutech.IO.StatusBar status = new Valutech.IO.StatusBar(statusPtr);
                                                    captions = status.Captions;
                                                    if (captions.Length > 1)
                                                    {
                                                        string statusText = captions[1];
                                                        if (statusText != string.Empty)
                                                        {
                                                            somethingFound = true;
                                                            if (activity == WTM_ACTIVITY.NONE)
                                                            {
                                                                if (statusText == "	")
                                                                {
                                                                    activity = WTM_ACTIVITY.FIRST_TIME_START;
                                                                }
                                                                Regex regex = new Regex("Performing CDMAVoiceQuality . . .|Performing GSMMobileInitiatedCall . . .");
                                                                if (regex.IsMatch(statusText))
                                                                {
                                                                    activity = WTM_ACTIVITY.CHECKING_VOICE_QUALITY;
                                                                }
                                                                regex = new Regex("Performing CDMAPage . . .");
                                                                if (regex.IsMatch(statusText))
                                                                {
                                                                    activity = WTM_ACTIVITY.PERFORMING_CDMA_PAGE;
                                                                }
                                                                regex = new Regex("Performing WCDMAOrigination . . .");
                                                                if (regex.IsMatch(statusText))
                                                                {
                                                                    activity = WTM_ACTIVITY.PERFORMING_CDMA_PAGE;
                                                                }
                                                                regex = new Regex("Passed = [0-9]{1,}[ ]{1,}Failed = [0-9]{1,}|Test Plan Aborted");
                                                                if (regex.IsMatch(statusText))
                                                                {
                                                                    activity = WTM_ACTIVITY.TEST_FINISHED;
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                    if ((somethingFound && activity == WTM_ACTIVITY.NONE))
                                    {
                                        activity = WTM_ACTIVITY.TESTING;
                                    }
                                }
                            }
                        }
                        else
                        {
                            Console.WriteLine("Not getting status");
                        }
                        #endregion
                    }
                    catch { }
                }
                else
                {
                    try
                    {
                        #region Set the activity for the 8285 equipment

                        IntPtr statusContainer = AppManipulation.FindWindowByWindowName("PoST Operator Instructions");
                        if (statusContainer != IntPtr.Zero)
                        {
                            IntPtr statusPtr = AppManipulation.FindChildWindowByClassName(statusContainer, "RichTextWndClass");
                            if (statusPtr != IntPtr.Zero)
                            {
                                string caption = AppManipulation.GetText(statusPtr);
                                if (caption != String.Empty)
                                {
                                    activity = WTM_ACTIVITY.PERFORMING_CDMA_PAGE;
                                    Regex regex = new Regex("Waiting for operator to answer call");
                                    if (regex.IsMatch(caption))
                                    {
                                        activity = WTM_ACTIVITY.WAITING_TO_ANSWER_CALL;
                                    }
                                    regex = new Regex("Speak into the phone");
                                    if (regex.IsMatch(caption))
                                    {
                                        activity = WTM_ACTIVITY.CHECKING_VOICE_QUALITY;
                                    }
                                }
                            }
                        }
                        else
                        {
                            if (currentActivity != WTM_ACTIVITY.WAITING_TO_ANSWER_CALL)
                            {
                                GetBtnHwnds();
                                if (stopBtnHwnd != IntPtr.Zero)
                                {
                                    if (AppManipulation.IsWindowVisible(stopBtnHwnd))
                                    {
                                        activity = WTM_ACTIVITY.TESTING;
                                    }
                                    else
                                    {
                                        activity = WTM_ACTIVITY.TEST_FINISHED;
                                    }
                                }
                            }
                            else
                            {
                                activity = currentActivity;
                            }
                        }

                        #endregion
                    }
                    catch { }
                }
            }
            else
            {
                stopBtnHwnd         = IntPtr.Zero;
                runBtnHwnd          = IntPtr.Zero;
                dutSerialNumberHwnd = IntPtr.Zero;
            }

            //Send events depending on the change
            if (currentState != state)
            {
                if (StateChanged != null)
                {
                    StateChanged(this, EventArgs.Empty);
                }
                if (state == STATE.OPEN)
                {
                    this.model = GetModelInUse();
                    if (ModelInUseChanged != null)
                    {
                        ModelInUseChanged(this.model);
                    }
                }
            }
            if (currentActivity != activity)
            {
                if (ActivityChanged != null)
                {
                    ActivityChanged(this, EventArgs.Empty);
                }
            }
            if (currentVersion != version)
            {
                if (VersionChanged != null)
                {
                    VersionChanged(this, EventArgs.Empty);
                }
            }
            if (currentTestplan != this.testplan && currentState == STATE.OPEN)
            {
                if (TestplanChanged != null)
                {
                    TestplanChanged(this.testplan);
                }
            }
        }