Ejemplo n.º 1
0
        public Navigator()
        {
            Variants = new ObservableCollection <int>();
            Steps    = new StepsCollection();

            GoBackCommand    = new DelegateCommand(OnGoBack);
            GoForwardCommand = new DelegateCommand(OnForward);
            CodeCommand      = new DelegateCommand <int>(OnCode);
        }
Ejemplo n.º 2
0
        /// <summary>Constructor to the calculator of the best path between an origin and a destination point.</summary>
        /// <param name="pointRepository">Point repository.</param>
        /// <param name="stepRepository">Step repository.</param>
        /// <param name="routeBase">Route base holding the origin and destination points.</param>
        public BestPathCalculator(IPointRepository pointRepository, IStepRepository stepRepository, RouteBase routeBase, PathPerformanceOptions option)
        {
            _pointRepository = pointRepository;
            _stepRepository  = stepRepository;
            _routeBase       = routeBase;
            _pathOption      = option;
            _pointStepsList  = new List <PointSteps>();

            _isVisited = new List <Point>();

            StepsCollection = new StepsCollection();
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            System.Console.WriteLine("Start");
            var steps  = new StepsCollection(true);
            var script = Script.BuildScript(steps);

            System.Console.WriteLine(script);

            var runner = new ScriptRunner();
            var output = runner.RunScript(script);

            System.Console.WriteLine(output);

            System.Console.WriteLine("Finished");
            System.Console.WriteLine("Press any key to continue..");
            System.Console.ReadKey();
        }
Ejemplo n.º 4
0
            protected override void OnMessage(MessageEventArgs e)
            {
                Console.WriteLine(e.Data);
                JObject resp = JObject.Parse(e.Data);

                var command = new taskt.Core.Automation.Commands.SeleniumBrowserElementActionCommand();

                command.v_Comment = (string)resp.SelectToken("method") + " " +
                                    (string)resp.SelectToken("objectname") + " on " +
                                    (string)resp.SelectToken("page.title") + " page";

                command.v_WebActionParameterTable = new System.Data.DataTable
                {
                    TableName = "WebActionParamTable" + DateTime.Now.ToString("MMddyy.hhmmss")
                };
                command.v_WebActionParameterTable.Columns.Add("Parameter Name");
                command.v_WebActionParameterTable.Columns.Add("Parameter Value");

                string action = (string)resp.SelectToken("method");
                var    props  = resp.SelectToken("prop");
                // command.miscprops = new List<taskt.Core.KeyValuePair<string, string>>(7);
                var optional_props = new Dictionary <string, string>(7);

                if (!(props is null) && (!string.IsNullOrEmpty(props.ToString())))
                {
                    foreach (var prop in props)
                    {
                        JToken token = (JToken)prop;
                        if (!string.IsNullOrEmpty((string)token.SelectToken("val")))
                        {
                            optional_props.Add((string)token.SelectToken("prop"), (string)token.SelectToken("val"));
                        }
                    }
                }

                if (string.IsNullOrEmpty(action))
                {
                }

                if (action.Equals("Click"))
                {
                    command.v_SeleniumSearchType      = "Find Element By XPath";
                    command.v_SeleniumElementAction   = "Invoke Click";
                    command.v_SeleniumSearchParameter = (string)resp.SelectToken("prop[4].val");

                    var clickStep = new steps();
                    clickStep.id     = command.CommandID;
                    clickStep.action = command.v_SeleniumElementAction;
                    clickStep.compid = command.v_SeleniumSearchParameter;

                    App.Current.Dispatcher.Invoke((System.Action) delegate
                    {
                        StepsCollection.Add(clickStep);
                        lstScriptActions.Items.Add(CreateScriptCommandListViewItem(command));
                    });



                    //assign cell as a combobox

                    //  SAPScriptRecoder.outputList.Add(command);
                }

                if (action.Equals("Set") || action.Equals("setEncrypted"))
                {
                    command.v_SeleniumSearchType      = "Find Element By XPath";
                    command.v_SeleniumElementAction   = "Set Text";
                    command.v_SeleniumSearchParameter = (string)resp.SelectToken("prop[4].val");
                    command.v_WebActionParameterTable.Rows.Add(new Object[]
                                                               { "Text To Set", (string)resp.SelectToken("input") });
                    command.v_WebActionParameterTable.Rows.Add(new Object[]
                                                               { "Clear Element Before Setting Text", "No" });
                    DataGridViewComboBoxCell comparisonComboBox = new DataGridViewComboBoxCell();
                    comparisonComboBox.Items.Add("Yes");
                    comparisonComboBox.Items.Add("No");
                }

                if (action.Equals("selectByVisibleText"))
                {
                    command.v_SeleniumSearchType      = "Find Element By XPath";
                    command.v_SeleniumElementAction   = "Select By Visible Text";
                    command.v_SeleniumSearchParameter = (string)resp.SelectToken("prop[4].val");
                    command.v_WebActionParameterTable.Rows.Add(new Object[]
                                                               { "Text To Set", (string)resp.SelectToken("input") });
                    command.v_WebActionParameterTable.Rows.Add(new Object[]
                                                               { "Clear Element Before Setting Text", "No" });
                    DataGridViewComboBoxCell comparisonComboBox = new DataGridViewComboBoxCell();
                    comparisonComboBox.Items.Add("Yes");
                    comparisonComboBox.Items.Add("No");
                    //  SAPScriptRecoder.outputList.Add(command);
                }

                if (action.Equals("SwitchTab"))
                {
                    if (!string.IsNullOrEmpty((string)resp.SelectToken("input")))
                    {
                        var switchWindowCommand = new taskt.Core.Automation.Commands.SeleniumBrowserSwitchWindowCommand();
                        switchWindowCommand.v_WindowMatchType    = "Window Title";
                        switchWindowCommand.v_MatchSpecification = "Exact Match";
                        switchWindowCommand.v_MatchParameter     = (string)resp.SelectToken("input");
                    }
                }

                if (action.Equals("waitForPageLoaded"))
                {
                    var pausecommand = new taskt.Core.Automation.Commands.PauseCommand();
                    pausecommand.v_PauseLength = "10000";
                    // SAPScriptRecoder.outputList.Add(command);
                }
            }
Ejemplo n.º 5
0
 private void InitializeStepsCollection()
 {
     //steps = new StepsCollection(true, 3); // mock
     steps = new StepsCollection();
 }