Beispiel #1
0
        private void CreateTrackRoute()
        {
            SetSubPage(typeof(SelectTownStationTrackPage), null, (lastPage) =>
            {
                SelectTrackPage trackPage = lastPage as SelectTrackPage;

                Terminal.Log($"Selected track {trackPage.SelectedTrack}");
                CommandArg[] args = new CommandArg[]
                {
                    new CommandArg()
                    {
                        String = "from"
                    },
                    new CommandArg()
                    {
                        String = "loco"
                    },
                    new CommandArg()
                    {
                        String = "to"
                    },
                    new CommandArg()
                    {
                        String = trackPage.SelectedTrack
                    }
                };
                BuildRoute(args, this);
            });
        }
Beispiel #2
0
        private void CreateTrackRoute()
        {
            SetSubPage(typeof(SelectTownStationTrackPage), null, async(lastPage) =>
            {
                SelectTrackPage trackPage = lastPage as SelectTrackPage;

                Terminal.Log($"Selected track {trackPage.SelectedTrack}");
                CommandArg[] args = new CommandArg[]
                {
                    new CommandArg()
                    {
                        String = "auto"
                    },
                    new CommandArg()
                    {
                        String = trackPage.SelectedTrack
                    }
                };

                try
                {
                    await RouteCommand.DoCommand(args);

                    DisplayText($"Going to {trackPage.SelectedTrack}", "");

                    await new WaitForSeconds(1.0f);

                    DisplayText(menuSelector.Current.displayText, menuSelector.Current.actionName);
                }
                catch (CommandException exc)
                {
                    RedirectToMessagePage(exc.Message, "MENU");
                }
                catch (Exception exc)
                {
                    Terminal.Log(exc.Message + ": " + exc.StackTrace);
                    RedirectToMessagePage("Error LocoAI, see console", "MENU");
                }
            });
        }