예제 #1
0
 void m_AutomationEngine_ExecutionBegin(object sender, ExecutionBeginEventArgs e)
 {
     ThreadingUtils.InvokeControlAction(this, ctl =>
     {
         zOnExecutionStart(EventArgs.Empty);
     });
 }
예제 #2
0
        public void PollElements(ElementIdentifier identifier, HtmlElement relativeTo, TimeSpan timeout, Action <List <HtmlElement> > callback)
        {
            //Make initial pass at finding element synchronously (in case element is there, don't waste time starting a task)
            List <HtmlElement> results = FindElements(identifier, relativeTo);

            if (results.Count > 0)
            {
                callback(results);
                return;
            }

            //If initial pass returns nothing, start polling task
            Task.Factory.StartNew(() =>
            {
                DateTime start = DateTime.Now;
                bool stop      = false;
                while (!stop)
                {
                    ThreadingUtils.InvokeControlAction(Browser, ctl =>
                    {
                        List <HtmlElement> pollResults = FindElements(identifier, relativeTo);
                        if (pollResults.Count > 0 || DateTime.Now.Subtract(start) >= timeout)
                        {
                            stop = true;
                            callback(pollResults);
                        }
                    });
                    Thread.Sleep(100);
                }
            });
        }
예제 #3
0
 private void zRefreshVariables()
 {
     ThreadingUtils.InvokeControlAction(tlvVariables, tv =>
     {
         tlvVariables.SetObjects(m_AutomationEngine.DataContext.StateVariables.Values, true);
         tlvVariables.RefreshObjects(m_AutomationEngine.DataContext.StateVariables.Values.ToList());
     });
 }
예제 #4
0
 void m_AutomationEngine_StepBegin(object sender, StepEventArgs e)
 {
     ThreadingUtils.InvokeControlAction(tlvSequence, tlv =>
     {
         tlv.ExpandToObject(m_AutomationEngine.CurrentStep);
         tlv.RefreshObject(m_AutomationEngine.CurrentStep);
         tlv.Refresh();
     });
 }
예제 #5
0
        private void zRefreshSteps()
        {
            zBuildStepIndex();
            ThreadingUtils.InvokeControlAction(tlvSequence, tlv =>
            {
                tlv.SetObjects(m_AutomationEngine.Sequence, true);
            });

            zRefreshVariables();
        }
예제 #6
0
        void m_AutomationEngine_ExecutionComplete(object sender, ExecutionCompleteEventArgs e)
        {
            zRefreshVariables();
            m_Executing = false;
            ThreadingUtils.InvokeControlAction(this, ctl =>
            {
                zResumeRecording();
                zSelectAllStepElements();

                zOnExecutionStop(EventArgs.Empty);
            });
        }
예제 #7
0
 public override void Send(string subject, string message)
 {
     if (m_UIContext != null)
     {
         ThreadingUtils.InvokeControlAction(m_UIContext, ctl =>
         {
             frmPopup frm = new frmPopup(subject, message);
             frm.Show();
         });
     }
     else
     {
         System.Diagnostics.Debug.WriteLine("Unable to show popup notification as no UIContext was provided.");
     }
 }
예제 #8
0
        void m_AutomationEngine_ExecutionComplete(object sender, ExecutionCompleteEventArgs e)
        {
            m_AutomationEngine.ExecutionComplete -= m_AutomationEngine_ExecutionComplete;

            ElementIdentifier containerIdentifier = null;

            if (m_GroupStepEditContext != null)
            {
                GroupStep groupStep = (GroupStep)m_GroupStepEditContext.Step;
                containerIdentifier = ((ElementSetIteration)groupStep.Iteration).ElementSetContainer;
            }

            ThreadingUtils.InvokeControlAction(this, ctl =>
            {
                zDetect(containerIdentifier);
            });
        }
예제 #9
0
        protected override void zExecuteStep()
        {
            ElementIdentifier elementIdentifier = zGetElementIdentifier();

            ThreadingUtils.InvokeControlAction(m_Context.BrowserHelper.Browser, ctl =>
            {
                if (m_Step.ElementType == ElementType.Static)
                {
                    HtmlElement element = m_Context.BrowserHelper.FindElement(elementIdentifier, CurrentScope.ElementSetIteratorItem);
                    zElementLocated(element);
                }
                else
                {
                    m_Context.BrowserHelper.PollElement(elementIdentifier, CurrentScope.ElementSetIteratorItem, m_Step.PollingTimeout.Value, zElementLocated);
                }
            });
        }
예제 #10
0
        void m_AutomationEngine_ExecutionComplete(object sender, ExecutionCompleteEventArgs e)
        {
            m_AutomationEngine.ExecutionComplete -= m_AutomationEngine_ExecutionComplete;

            GroupStep groupStep = (GroupStep)m_StepEditContext.Step;

            m_Pattern = groupStep.Steps.OfType <ElementStep>().Select(gvs => gvs.Element).ToList();

            ThreadingUtils.InvokeControlAction(this, ctl =>
            {
                if (m_ContainerIdentifier != null)
                {
                    zElementSelected();
                }
                zPreview();

                pbLoading.Visible   = false;
                EditorPanel.Visible = true;
            });
        }
예제 #11
0
        private void zCreateElementSetIterator(ElementSetIteration iteration)
        {
            ListStateVariable listStateVariable = null;

            if (iteration.IsSetIteration)
            {
                listStateVariable = (ListStateVariable)CurrentScope.DataScope.GetStateVariable(iteration.ObjectSetListName);
                if (listStateVariable == null)
                {
                    listStateVariable = new ListStateVariable(DataUtils.GetUnscopedVariableName(iteration.ObjectSetListName), iteration.PersistenceMode, new List <IStateVariable>());
                    CurrentScope.DataScope.SetStateVariable(iteration.ObjectSetListName, listStateVariable);
                }
                listStateVariable.IncludeInXML = iteration.IncludeInXML;
            }
            ElementSetIterator iterator = new ElementSetIterator(iteration, listStateVariable);

            ElementIdentifier containerIdentifier = zGetElementSetContainer(iteration);

            ThreadingUtils.InvokeControlAction(m_Context.BrowserHelper.Browser, ctl =>
            {
                if (iteration.ElementType == Model.Automation.ElementType.Static)
                {
                    List <HtmlElement> containerElements = m_Context.BrowserHelper.FindElements(containerIdentifier, CurrentScope.ElementSetIteratorItem);
                    iterator.SetElements(containerElements);
                    zCompleteGroupStep(iterator);
                }
                else
                {
                    m_Context.BrowserHelper.PollElements(containerIdentifier, CurrentScope.ElementSetIteratorItem, iteration.PollingTimeout.Value, containerElements =>
                    {
                        iterator.SetElements(containerElements);
                        zCompleteGroupStep(iterator);
                    });
                }
            });
        }
예제 #12
0
 private void zDone()
 {
     ThreadingUtils.InvokeControlAction(this, frm => frm.Close());
 }
예제 #13
0
 private void zUpdateStatus(string status, int pbValue)
 {
     ThreadingUtils.InvokeControlAction(lblStatus, lbl => lbl.Text = status);
     ThreadingUtils.InvokeControlAction(pbStatus, pb => pb.Value   = pbValue);
 }