Example #1
0
        private IRemoteEndpointInformation GetRemoteEndpointInformation(String displayName)
        {
            try
            {
                Ranorex.Core.Remoting.IRemoteEndpoint remoteEndpoint = RemoteServiceLocator.Service.GetByDisplayName(displayName);
                if (remoteEndpoint != null)
                {
                    return(remoteEndpoint.RemoteInfo);
                }

                /*XmlNode storedDevices = MobilePluginConfig.StoredDevices;
                 * string innerText = storedDevices.InnerText;
                 * List<EndpointInformation> list = StringXmlSerializer.Deserialize<List<EndpointInformation>>(innerText);
                 * foreach (EndpointInformation endpointInfo in list)
                 * {
                 *  if (endpointInfo.DisplayName == displayName)
                 *  {
                 *      return endpointInfo;
                 *  }
                 * }*/
            }
            catch (Exception exc)
            {
            }

            return(null);
        }
Example #2
0
 private Ranorex.Core.Remoting.IRemoteEndpoint GetEndpoint(IRemoteEndpointInformation information)
 {
     Ranorex.Core.Remoting.IRemoteEndpoint result;
     try
     {
         if (information != null)
         {
             Ranorex.Core.Remoting.IRemoteEndpoint remoteEndpointFromInfo = RemoteServiceLocator.Service.GetRemoteEndpointFromInfo(information);
             result = remoteEndpointFromInfo;
         }
         else
         {
             result = null;
         }
     }
     catch (Exception ex)
     {
         result = null;
     }
     return(result);
 }
Example #3
0
 void remoteEndpoint_StatusChangedEvent(object sender, EventArgs e)
 {
     if (isTerminating)
     {
         return;
     }
     if (sender is Ranorex.Core.Remoting.IRemoteEndpoint)
     {
         Ranorex.Core.Remoting.IRemoteEndpoint endpoint = (Ranorex.Core.Remoting.IRemoteEndpoint)sender;
         if (endpoint.Status == ChannelState.Error)
         {
             isTerminating = true;
             SendTerminate(endpoint.StatusMessage);
             agentServer.DropClient();
         }
         else if (endpoint.Status == ChannelState.DeviceConnected)
         {
             //isTerminating = true;
             //SendTerminate(endpoint.StatusMessage);
             //agentServer.DropClient();
         }
     }
 }
Example #4
0
        private void OpenSession(Command openCommand)
        {
            this.sessionType      = (string)openCommand.arguments["sessionType"];
            this.startupArguments = openCommand.arguments;
            this.showExecutionUI  = (bool)openCommand.arguments["showExecutionUI"];
            command = (string)openCommand.arguments["command"];
            if (sessionType == "Web")
            {
                Host.Local.OpenBrowser(command, (string)startupArguments["browserType"]);
                recordTable.RecordingMode = RecordTable.RecorderMode.Web;
            }
            else if (sessionType == "Desktop")
            {
                procesID = Host.Local.RunApplication(command, (string)startupArguments["applicationArguments"]);
                recordTable.RecordingMode = RecordTable.RecorderMode.Desktop;
            }
            else if (sessionType == "Mobile")
            {
                mobileDevice = command;
                string mobileApp = (string)startupArguments["mobileAppPlatform"];
                remoteEndpoint = GetEndpoint(GetRemoteEndpointInformation(command));
                try
                {
                    remoteEndpoint.StartApplication(new AppInformation(mobileApp, string.Empty, -1, string.Empty));
                    remoteEndpoint.EnableEventSynchronization(true);
                }
                catch (Exception e)
                {
                    if (e.HelpLink == "http://www.ranorex.com/support/user-guide-20/ios-testing.html#DebugImage")
                    {
                        remoteEndpoint.Reconnect();
                        remoteEndpoint.EnableEventSynchronization(true);
                    }
                    else
                    {
                        throw;
                    }
                }

                new EndpointRecorderConnector(recorder, remoteEndpoint, false);
                remoteEndpoint.StatusChangedEvent += new EventHandler <EventArgs>(remoteEndpoint_StatusChangedEvent);
                recordTable.RecordingMode          = RecordTable.RecorderMode.Mobile;
            }
            else
            {
                throw new Exception("Unknown session type: " + sessionType);
            }

            Delay.Milliseconds(1000);

            if ((bool)openCommand.arguments["capture"])
            {
                StartRecording();
            }
            else
            {
                if ((bool)openCommand.arguments["showExecutionUI"])
                {
                    ShowProgressForm();
                }
            }
        }