public override void OnEnter(CRMPage previousPage, CRMPageArgs args)
        {
            exited = false;

            string msg = args.GetString(PARAM_MESSAGE);

            if (msg != null)
            {
                action  = args.GetString(PARAM_ACTION);
                message = msg;
                DisplayText(msg, action ?? "");
            }
            else
            {
                DisplayText(message, this.action ?? "");
            }

            float?timeout = args.GetFloat(PARAM_TIMEOUT);

            if (timeout.HasValue)
            {
                waitForTimeoutCancellation = new CancellationTokenSource();
                WaitForTimeout(timeout.Value);
            }
        }
Exemple #2
0
        public override void OnEnter(CRMPage previousPage, CRMPageArgs args)
        {
            SelectTownPage townPage = previousPage as SelectTownPage;

            selectedTownCode = townPage.SelectedTownCode;
            SetupSelector();
            base.OnEnter(previousPage, args);
        }
        public override void OnEnter(CRMPage previousPage, CRMPageArgs args)
        {
            SelectStationPage stationPage = previousPage as SelectStationPage;

            selectedTownStationCode = stationPage.SelectedTownStationCode;
            Terminal.Log(selectedTownStationCode);
            SetupSelector();
            base.OnEnter(previousPage, args);
        }
        public override void OnEnter(CRMPage previousPage, CRMPageArgs args)
        {
            Terminal.Log("CruiseControlPage.OnEnter");
            SetupSelector();

            RestoreSelectorIndex();

            LocoCruiseControl.OnCruiseControlChange += LocoCruiseControl_OnCruiseControlChange;

            base.OnEnter(previousPage, args);
        }
Exemple #5
0
 public override void OnEnter(CRMPage previousPage, CRMPageArgs args)
 {
     // call sequentionaly all three pages
     SetSubPage(typeof(SelectTownPage), null, (townPage) =>
     {
         Manager.SetSubPage(typeof(SelectStationPage), (stationPage) =>
         {
             //here we should be ruterned back to caller
             Manager.SetPage(typeof(SelectTrackPage), null, stationPage);
         }, null, townPage);
     });
 }
Exemple #6
0
        public override void OnEnter(CRMPage previousPage, CRMPageArgs args)
        {
            if (Module.VersionForUpdate != null && !updateExecuted)
            {
                DisplayText($"NEW VERSION {Module.VersionForUpdate.Version} AVAILABLE!", "UPDATE");
                updateExecuted = true;

                Module.StartCoroutine(DoUpdate());
            }
            else
            {
                SetMainDisplay();
            }

        }
        public override void OnEnter(CRMPage previousPage, CRMPageArgs args)
        {
            if (!selectorSetup)
            {
                if (!SetupSelector())
                {
                    //selector setup failed, so create at least exit menu
                    menuSelector = new Selector <MenuItem>(new List <MenuItem>()
                    {
                        GetExitMenu()
                    });
                }
            }

            PrintCurrentSelector();
        }
        public static async void BuildRoute(CommandArg[] args, CRMPage page)
        {
            try
            {
                page.DisplayText("Computing route", "");

                await RouteCommand.DoCommand(args);

                if (Module.ActiveRoute.IsSet)
                {
                    StringBuilder via = Module.ActiveRoute.Route.Path.Select(p => p.logicTrack.ID.FullID)
                                        .Where(s => !s.StartsWith(SelectTrackPage.GENERAL_TRACK_PREFIX))
                                        .Select(s => s.GetUntilOrEmpty(SelectTrackPage.TRACK_PARTS_SEPARATOR))
                                        .Distinct()
                                        .Aggregate(new StringBuilder(), (current, next) => current.Append(current.Length == 0 ? "" : ", ").Append(next));

                    string routeInfo = $"Route {(Module.ActiveRoute.Route.Length / 1000.0):0.#}km\nHeading: {Module.ActiveRoute.Route.StartHeading}\nvia: {via}";

                    if (Module.ActiveRoute.Route.Reverses.Count > 0)
                    {
                        routeInfo += $"\nReverses: {Module.ActiveRoute.Route.Reverses.Count}";
                    }

                    page.RedirectToMessagePage(routeInfo, "MENU");
                }
                else
                {
                    page.RedirectToMessagePage("Route not found", "MENU");
                }
            }
            catch (CommandException exc)
            {
                page.RedirectToMessagePage(exc.Message, "MENU");
            }
            catch (Exception exc)
            {
                Terminal.Log(exc.Message + ": " + exc.StackTrace);
                page.RedirectToMessagePage("Error in building path, see console", "MENU");
            }
        }
Exemple #9
0
        public override void OnEnter(CRMPage previousPage, CRMPageArgs args)
        {
            SetupSelector();

            base.OnEnter(previousPage, args);
        }
Exemple #10
0
 public abstract void OnEnter(CRMPage previousPage, CRMPageArgs args);