Exemplo n.º 1
0
        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);
            }
        }
Exemplo n.º 2
0
        public override void OnEnter(CRMPage previousPage, CRMPageArgs args)
        {
            SelectTownPage townPage = previousPage as SelectTownPage;

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

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

            RestoreSelectorIndex();

            LocoCruiseControl.OnCruiseControlChange += LocoCruiseControl_OnCruiseControlChange;

            base.OnEnter(previousPage, args);
        }
Exemplo n.º 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);
     });
 }
Exemplo n.º 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();
            }

        }
Exemplo n.º 7
0
        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();
        }
Exemplo n.º 8
0
        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");
            }
        }
Exemplo n.º 9
0
        public override void OnEnter(CRMPage previousPage, CRMPageArgs args)
        {
            SetupSelector();

            base.OnEnter(previousPage, args);
        }
Exemplo n.º 10
0
 public abstract void OnEnter(CRMPage previousPage, CRMPageArgs args);